Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
aec3361
first commit
pablodcar Apr 5, 2024
30c2791
wip
pablodcar Apr 8, 2024
05e9b08
wip
pablodcar Apr 8, 2024
970ddb6
wip
pablodcar Apr 8, 2024
eb8e1fe
wip
pablodcar Apr 8, 2024
2888adc
use github actions to build package
pablodcar Apr 9, 2024
5369aa8
wip
pablodcar Apr 9, 2024
3e22e40
fix cibuildwheel workflow
pablodcar Apr 9, 2024
2c046f1
fix wheel 2
pablodcar Apr 9, 2024
a75f79a
fix 4
pablodcar Apr 9, 2024
756ae98
fix 5
pablodcar Apr 9, 2024
116c0c9
fix 7
pablodcar Apr 9, 2024
9945641
test
pablodcar Apr 9, 2024
d9a7a5d
fix 10
pablodcar Apr 9, 2024
3eb3e26
test
pablodcar Apr 9, 2024
0ef3afd
test
pablodcar Apr 9, 2024
20e1f15
test
pablodcar Apr 9, 2024
266d00b
test
pablodcar Apr 9, 2024
9ec2147
test 1
pablodcar Apr 9, 2024
3fb761d
double-conversion
pablodcar Apr 9, 2024
ca93f16
test
pablodcar Apr 9, 2024
c1ca052
build linux
pablodcar Apr 9, 2024
c91e533
test
pablodcar Apr 9, 2024
0e85044
aarch64
pablodcar Apr 9, 2024
2a00722
test qemu
pablodcar Apr 9, 2024
d43c873
install openssl in qemu
pablodcar Apr 9, 2024
fb6a92d
test using ubuntu apt
pablodcar Apr 9, 2024
4d48fbf
fix permissions
pablodcar Apr 9, 2024
f7cff0c
fix package name
pablodcar Apr 9, 2024
3b700b8
install openssl after python setup
pablodcar Apr 9, 2024
05a36bb
install dependencies using before_all
pablodcar Apr 9, 2024
6d2d3f0
use script
pablodcar Apr 9, 2024
54ca540
yum
pablodcar Apr 9, 2024
d984d31
setup-yum
pablodcar Apr 9, 2024
eff8da7
yum 2
pablodcar Apr 9, 2024
23556c5
fix cmd
pablodcar Apr 9, 2024
a6df8c7
remove old callbacks
pablodcar Apr 9, 2024
494418e
fix syntax
pablodcar Apr 9, 2024
f16a63e
refactor directory structure
pablodcar Apr 9, 2024
800ab96
update
pablodcar Apr 9, 2024
e57eb35
test upload to pypi
pablodcar Apr 9, 2024
cc005d4
change sdist output dir
pablodcar Apr 9, 2024
62186b9
Allow disabling SSL verification for client (#1)
pablodcar Apr 16, 2024
c3dbe61
fix long description for PyPi package
pablodcar Apr 16, 2024
2e39c37
Update build_wheels.yml
NickM83 Nov 4, 2024
a095658
Update build_wheels.yml
NickM83 Nov 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 139 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Build

on: [push, pull_request]

jobs:
build-wheels-linux:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
python_build: [cp311-manylinux_aarch64, cp312-manylinux_aarch64] # Added cp312 for Python 3.12
os: [ubuntu-latest]
env:
CIBW_ARCHS: aarch64
CIBW_BUILD: ${{ matrix.python_build }}

steps:
- uses: actions/checkout@v4

- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64

- uses: actions/setup-python@v5
with:
python-version: '3.12' # Changed from 3.11 to 3.12

- name: Build wheels
uses: pypa/cibuildwheel@v2.17.0
with:
package-dir: quickfix-py
env:
CIBW_BEFORE_ALL_LINUX: 'uname -a && ls -la && ./setup-linux-yum.sh'
CIBW_BUILD: ${{ matrix.python_build }}

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.python_build }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build-wheels-osx:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
python_build: [cp311-macosx_arm64, cp312-macosx_arm64] # Added cp312 for Python 3.12
os: [macos-14]
env:
CIBW_ARCHS: 'auto'
CIBW_BUILD: ${{ matrix.python_build }}

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.12' # Changed from 3.11 to 3.12

- name: Build wheels
uses: pypa/cibuildwheel@v2.17.0
with:
package-dir: quickfix-py

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.python_build }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

build-wheels-windows:
name: Build wheels on Windows
runs-on: windows-latest
strategy:
matrix:
python_build: [cp311-win_amd64, cp312-win_amd64] # Added cp312 for Python 3.12
env:
CIBW_BUILD: ${{ matrix.python_build }}
CIBW_ENVIRONMENT: "CXXFLAGS='-std=c++17'" # Enforces C++17

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Build Tools
run: |
choco install visualstudio2019buildtools
choco install visualstudio2019-workload-vctools

- name: Build wheels
uses: pypa/cibuildwheel@v2.17.0
with:
package-dir: quickfix-py

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.python_build }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

make_sdist:
name: Make sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- name: Build sdist
run: pipx run build --sdist --outdir dist quickfix-py

- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

upload_all:
name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/') # Only publish to PyPI on tag pushes
needs: [build-wheels-linux, build-wheels-osx, build-wheels-windows, make_sdist]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/quickfix-py
permissions:
id-token: write
steps:
- name: Download distributions
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true

- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
.*
!.gitignore
!.github
*~
*.gz
*.zip
/quickfix
*.egg-info
/quickfix
build/
92 changes: 92 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@

# Scripts to package quickfix in Python

Based on https://github.com/quickfix/quickfix-package, original author: Oren Miller (oren@quickfixengine.org)

This project is an update to run with latest changes,
and compile and distribute a package in Python 3 with SSL support.

# Why

The original package is not being maintained.

# Build Instructions

# On OSX

## Install Python using pyenv

Ensure you have g++, openssl, python-dev, autoconf, etc. (run ./setup-osx.sh if needed)
Ensure you are using the same Python version you would use in the application when building.

1. Setting Environment Variables flags to enable SSL:

On MacOS:

```
export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include -DHAVE_SSL=1"
```

On Linux:

```
export LDFLAGS="-L/usr/lib/aarch64-linux-gnu"
export CPPFLAGS="-I/usr/include/openssl -DHAVE_SSL=1"
```

2. Build sources

```
./build.sh
```

This step will download quickfix source code from repository
https://github.com/pablodcar/quickfix and leave C++ and compiled objects into `quickfix` directory.

3. Use the C++ source code to update the Python package

```
./package-python.sh
```

# Publishing

1. Create and activate a virtual environment to install distribution dependencies:

```
python -m pip install --upgrade build twine
```

2. Create Distribution files

```
python -m build
```

This step will leave a `dist/` directory with .tar.gz file (source distribution) and a .whl file (a built distribution). Built distribution depends on the OS, architecture, Python version.

e.g.
```
ls -1 dist
quickfix-py-0.0.1.tar.gz
quickfix_py-0.0.1-cp311-cp311-macosx_14_0_arm64.whl
```

3. Publish to PyPi (manual)

If you are going to test how the package looks like, use TestPyPi https://test.pypi.org/account/register/:

* Follow the instructions to create a token: https://packaging.python.org/en/latest/tutorials/packaging-projects/#uploading-the-distribution-archives,
* Configure the token on your local environment, e.g. ~/.pypirc


```
python3 -m twine upload --repository testpypi dist/*
```

Remove the option --repository testpypi to use the production repository.

4. Publish to PyPi (Github actions)

Before executing the action pypa/gh-action-pypi-publish, you need to register the Github Repository as a _trusted publisher_. see [Adding a trusted publisher to an existing PyPI project](https://docs.pypi.org/trusted-publishers/adding-a-publisher/)
32 changes: 32 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
WITH_MYSQL=${WITH_MYSQL:-0}

arguments=(--with-python --with-openssl)

# TODO: support building with mysql and postgresql support
# if [ "$WITH_MYSQL" -eq 1 ]; then
# arguments+=(--with-mysql)
# fi

if [ -d quickfix ]; then
echo "quickfix directory already exists."
exit
fi

git clone https://github.com/pablodcar/quickfix
rm -rf quickfix/.git

# pushd quickfix/doc
# ./document.sh
# popd

pushd quickfix || exit
./bootstrap
./configure "${arguments[@]}" && make
# make check TODO: tests need to be fixed in the original quickfix
popd || exit

pushd quickfix/src/python || exit
echo "building Python interface..."
./swig.sh
popd || exit
Loading