Skip to content

Commit 23debd1

Browse files
committed
initial working version
0 parents  commit 23debd1

23 files changed

+15243
-0
lines changed

Diff for: .github/workflows/build_and_release.yml

+169
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
name: Build and release to PyPI
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
reduce-release-tag:
6+
description: Reduce tag to build
7+
required: true
8+
default: v4.14
9+
version-tag:
10+
description: Python package version to release to PyPI (without 'v')
11+
required: true
12+
default: 4.14.post7
13+
dry-run:
14+
description: Dry run
15+
type: boolean
16+
default: false
17+
exclude-types:
18+
description: Commit types to exclude from the changelog
19+
required: false
20+
default: build,docs,style,other
21+
22+
jobs:
23+
build-linux:
24+
runs-on: ${{ matrix.platform.runner }}
25+
strategy:
26+
matrix:
27+
platform:
28+
- runner: ubuntu-24.04
29+
target: manylinux_2_17_x86_64.manylinux2014_x86_64
30+
steps:
31+
- uses: actions/checkout@v4
32+
- name: Install dependencies
33+
run: |
34+
pip install uv --user --break-system-packages
35+
uv tool install build
36+
uv tool install wheel
37+
- name: Build app
38+
run: |
39+
bash build_reduce_linux.sh ${{ inputs.reduce-release-tag }}
40+
- name: Build python wheel
41+
run: |
42+
bash build_python.sh wheel ${{ inputs.version-tag }} ${{ matrix.platform.target }}
43+
- name: Upload wheels
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: wheel-linux-${{ matrix.platform.target }}
47+
path: build_python/dist/*.whl
48+
49+
build-macos:
50+
runs-on: ${{ matrix.platform.runner }}
51+
strategy:
52+
matrix:
53+
platform:
54+
# Use the oldest version possible to maximize compatibility
55+
- runner: macos-13
56+
target: macosx_10_12_x86_64
57+
target_env: 10.12
58+
- runner: macos-15
59+
target: macosx_11_0_arm64
60+
target_env: 11.0
61+
steps:
62+
- uses: actions/checkout@v4
63+
- name: Install dependencies
64+
run: |
65+
uname -a
66+
pip install uv --break-system-packages
67+
uv tool update-shell
68+
uv tool install build
69+
uv tool install wheel
70+
brew install gnu-sed
71+
- name: Build app
72+
run: |
73+
MACOSX_DEPLOYMENT_TARGET=${{ matrix.platform.target_env }} bash build_reduce_mac.sh ${{ inputs.reduce-release-tag }}
74+
- name: Build python wheel
75+
run: |
76+
export PATH="/Users/runner/.local/bin:$PATH"
77+
bash build_python.sh wheel ${{ inputs.version-tag }} ${{ matrix.platform.target }}
78+
- name: Upload wheels
79+
uses: actions/upload-artifact@v4
80+
with:
81+
path: build_python/dist/*.whl
82+
name: wheel-macos-${{ matrix.platform.target }}
83+
84+
test-ubuntu:
85+
runs-on: ${{ matrix.os }}
86+
strategy:
87+
matrix:
88+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
89+
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
90+
target: [manylinux_2_17_x86_64.manylinux2014_x86_64]
91+
# python-version: ['3.8']
92+
# os: [ubuntu-20.04]
93+
needs: [build-linux]
94+
steps:
95+
- uses: actions/checkout@v4
96+
- uses: actions/download-artifact@v4
97+
with:
98+
path: dist
99+
name: wheel-linux-${{ matrix.target }}
100+
- uses: actions/setup-python@v5
101+
with:
102+
python-version: ${{ matrix.python-version }}
103+
- name: Test wheel
104+
run: |
105+
pip install uv --break-system-packages
106+
uv venv
107+
source .venv/bin/activate
108+
uv pip install -r requirements_test.txt
109+
uv pip install dist/*.whl
110+
pytest
111+
112+
test-macos:
113+
runs-on: ${{ matrix.platform.runner }}
114+
strategy:
115+
matrix:
116+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
117+
platform:
118+
- runner: macos-12
119+
target: macosx_10_12_x86_64
120+
- runner: macos-13
121+
target: macosx_10_12_x86_64
122+
- runner: macos-14
123+
target: macosx_11_0_arm64
124+
- runner: macos-15
125+
target: macosx_11_0_arm64
126+
needs: [build-macos]
127+
steps:
128+
- uses: actions/checkout@v4
129+
- uses: actions/download-artifact@v4
130+
with:
131+
path: dist
132+
name: wheel-macos-${{ matrix.platform.target }}
133+
- uses: actions/setup-python@v5
134+
with:
135+
python-version: ${{ matrix.python-version }}
136+
- name: Test wheel
137+
run: |
138+
pip install uv --break-system-packages
139+
uv venv
140+
source .venv/bin/activate
141+
uv pip install -r requirements_test.txt
142+
uv pip install dist/*.whl
143+
pytest
144+
145+
commit-changelog-and-release-github:
146+
needs: [test-ubuntu, test-macos]
147+
uses: deargen/workflows/.github/workflows/commit-changelog-and-release.yml@master
148+
with:
149+
version-tag: ${{ github.event.inputs.version-tag }}
150+
dry-run: ${{ github.event.inputs.dry-run == 'true' }}
151+
changelog-path: docs/CHANGELOG.md
152+
exclude-types: ${{ github.event.inputs.exclude-types }}
153+
154+
release-to-pypi:
155+
name: Release to PyPI
156+
if: ${{ github.event.inputs.dry-run == 'false' }}
157+
runs-on: ubuntu-24.04
158+
needs: [commit-changelog-and-release-github]
159+
steps:
160+
- uses: actions/download-artifact@v4
161+
with:
162+
path: dist
163+
pattern: wheel-*
164+
merge-multiple: true
165+
- name: Build and upload to PyPI
166+
run: |
167+
pip install uv --break-system-packages
168+
uv tool install twine
169+
twine upload dist/* -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} --non-interactive

Diff for: .gitignore

+180
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
/binary_glibc_dependency.txt
2+
/build/
3+
/build_python/
4+
# Created by https://www.toptal.com/developers/gitignore/api/python
5+
# Edit at https://www.toptal.com/developers/gitignore?templates=python
6+
7+
### Python ###
8+
# Byte-compiled / optimized / DLL files
9+
__pycache__/
10+
*.py[cod]
11+
*$py.class
12+
13+
# C extensions
14+
*.so
15+
16+
# Distribution / packaging
17+
.Python
18+
build/
19+
develop-eggs/
20+
dist/
21+
downloads/
22+
eggs/
23+
.eggs/
24+
lib/
25+
lib64/
26+
parts/
27+
sdist/
28+
var/
29+
wheels/
30+
share/python-wheels/
31+
*.egg-info/
32+
.installed.cfg
33+
*.egg
34+
MANIFEST
35+
36+
# PyInstaller
37+
# Usually these files are written by a python script from a template
38+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
39+
*.manifest
40+
*.spec
41+
42+
# Installer logs
43+
pip-log.txt
44+
pip-delete-this-directory.txt
45+
46+
# Unit test / coverage reports
47+
htmlcov/
48+
.tox/
49+
.nox/
50+
.coverage
51+
.coverage.*
52+
.cache
53+
nosetests.xml
54+
coverage.xml
55+
*.cover
56+
*.py,cover
57+
.hypothesis/
58+
.pytest_cache/
59+
cover/
60+
61+
# Translations
62+
*.mo
63+
*.pot
64+
65+
# Django stuff:
66+
*.log
67+
local_settings.py
68+
db.sqlite3
69+
db.sqlite3-journal
70+
71+
# Flask stuff:
72+
instance/
73+
.webassets-cache
74+
75+
# Scrapy stuff:
76+
.scrapy
77+
78+
# Sphinx documentation
79+
docs/_build/
80+
81+
# PyBuilder
82+
.pybuilder/
83+
target/
84+
85+
# Jupyter Notebook
86+
.ipynb_checkpoints
87+
88+
# IPython
89+
profile_default/
90+
ipython_config.py
91+
92+
# pyenv
93+
# For a library or package, you might want to ignore these files since the code is
94+
# intended to run in multiple environments; otherwise, check them in:
95+
# .python-version
96+
97+
# pipenv
98+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
99+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
100+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
101+
# install all needed dependencies.
102+
#Pipfile.lock
103+
104+
# poetry
105+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106+
# This is especially recommended for binary packages to ensure reproducibility, and is more
107+
# commonly ignored for libraries.
108+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109+
#poetry.lock
110+
111+
# pdm
112+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113+
#pdm.lock
114+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
115+
# in version control.
116+
# https://pdm.fming.dev/#use-with-ide
117+
.pdm.toml
118+
119+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
120+
__pypackages__/
121+
122+
# Celery stuff
123+
celerybeat-schedule
124+
celerybeat.pid
125+
126+
# SageMath parsed files
127+
*.sage.py
128+
129+
# Environments
130+
.env
131+
.venv
132+
env/
133+
venv/
134+
ENV/
135+
env.bak/
136+
venv.bak/
137+
138+
# Spyder project settings
139+
.spyderproject
140+
.spyproject
141+
142+
# Rope project settings
143+
.ropeproject
144+
145+
# mkdocs documentation
146+
/site
147+
148+
# mypy
149+
.mypy_cache/
150+
.dmypy.json
151+
dmypy.json
152+
153+
# Pyre type checker
154+
.pyre/
155+
156+
# pytype static type analyzer
157+
.pytype/
158+
159+
# Cython debug symbols
160+
cython_debug/
161+
162+
# PyCharm
163+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
164+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
165+
# and can be added to the global gitignore or merged into this file. For a more nuclear
166+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
167+
#.idea/
168+
169+
### Python Patch ###
170+
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
171+
poetry.toml
172+
173+
# ruff
174+
.ruff_cache/
175+
176+
# LSP config files
177+
pyrightconfig.json
178+
179+
# End of https://www.toptal.com/developers/gitignore/api/python
180+

0 commit comments

Comments
 (0)