Skip to content

Commit 3d63a74

Browse files
authored
upgrade & fix binary wheel build+publish (#563)
* upgrade RalfG/python-wheels-manylinux-build * add newer manylinux targets * switch to setuptools-scm * release: tag first * black: ignore autogenerated _version.py * bandit: our usage of sax is safe
1 parent 0e20ca6 commit 3d63a74

File tree

12 files changed

+41
-66
lines changed

12 files changed

+41
-66
lines changed

.github/workflows/wheel-prep.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export SCHEMA_SALAD_USE_MYPYC=1
22
export MYPYPATH=typeshed
3+
export SETUPTOOLS_SCM_PRETEND_VERSION=$(grep __version__ schema_salad/_version.py | awk -F\' '{ print $2 }')

.github/workflows/wheels.yml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,23 @@ jobs:
1212
- uses: actions/checkout@v3
1313
with:
1414
fetch-depth: 0 # slow, but gets all the tags
15-
- name: Build manylinux2010 Python wheels
16-
uses: RalfG/[email protected]_x86_64
15+
- name: set version
16+
run: pip install setuptools_scm[toml] && python -m setuptools_scm
17+
- name: Build manylinux2014 x86 Python wheels
18+
uses: RalfG/[email protected]_x86_64
1719
with:
18-
python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310'
1920
pre-build-command: source .github/workflows/wheel-prep.sh
2021
build-requirements: -rrequirements.txt -rmypy-requirements.txt
21-
- name: Build manylinux2014 Python wheels
22-
uses: RalfG/python-wheels-manylinux-build@v0.3.4-manylinux2014_x86_64
22+
- name: Build manylinux_2_24 x86 Python wheels
23+
uses: RalfG/python-wheels-manylinux-build@v0.4.2-manylinux_2_24_x86_64
2324
with:
24-
python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310'
2525
pre-build-command: source .github/workflows/wheel-prep.sh
2626
build-requirements: -rrequirements.txt -rmypy-requirements.txt
27+
# - name: Build manylinux_2_28 x86 Python wheels
28+
# uses: RalfG/[email protected]_2_28_x86_64
29+
# with:
30+
# pre-build-command: source .github/workflows/wheel-prep.sh
31+
# build-requirements: -rrequirements.txt -rmypy-requirements.txt
2732
- name: Move audited wheels to new directory
2833
run: mkdir audited_wheels && cp dist/*-manylinux*.whl audited_wheels/
2934
- name: Publish wheels to PyPI
@@ -41,12 +46,23 @@ jobs:
4146
fetch-depth: 0 # slow, but gets all the tags
4247
- name: Set up QEMU
4348
uses: docker/setup-qemu-action@v2
44-
- name: Build manylinux2014 Python wheels
45-
uses: RalfG/[email protected]_aarch64
49+
- name: set version
50+
run: pip install setuptools_scm[toml] && python -m setuptools_scm
51+
- name: Build manylinux2014 aarch64 Python wheels
52+
uses: RalfG/[email protected]_aarch64
4653
with:
47-
python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310'
4854
pre-build-command: source .github/workflows/wheel-prep.sh
4955
build-requirements: -rrequirements.txt -rmypy-requirements.txt
56+
# - name: Build manylinux2_24 aarch64 Python wheels
57+
# uses: RalfG/[email protected]_24_aarch64
58+
# with:
59+
# pre-build-command: source .github/workflows/wheel-prep.sh
60+
# build-requirements: -rrequirements.txt -rmypy-requirements.txt
61+
# - name: Build manylinux2_28 aarch64 Python wheels
62+
# uses: RalfG/[email protected]_28_aarch64
63+
# with:
64+
# pre-build-command: source .github/workflows/wheel-prep.sh
65+
# build-requirements: -rrequirements.txt -rmypy-requirements.txt
5066
- name: Move audited wheels to new directory
5167
run: mkdir audited_wheels && cp dist/*-manylinux*.whl audited_wheels/
5268
- name: Publish wheels to PyPI

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include gittaggers.py Makefile LICENSE.txt requirements.txt mypy-requirements.txt test-requirements.txt mypy.ini
1+
include Makefile LICENSE.txt requirements.txt mypy-requirements.txt test-requirements.txt mypy.ini
22
include schema_salad/py.typed
33
include schema_salad/avro/*
44
recursive-include schema_salad/java *

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ diff_pydocstyle_report: pydocstyle_report.txt
9898

9999
## format : check/fix all code indentation and formatting (runs black)
100100
format:
101-
black --exclude metaschema.py schema_salad setup.py typeshed
101+
black --exclude metaschema.py --exclude _version.py schema_salad setup.py typeshed
102102

103103
format-check:
104-
black --diff --check --exclude metaschema.py schema_salad setup.py typeshed
104+
black --diff --check --exclude metaschema.py --exclude _version.py schema_salad setup.py typeshed
105105

106106
## pylint : run static code analysis on Python code
107107
pylint: $(PYSOURCES)
@@ -188,12 +188,13 @@ release-test: FORCE
188188
./release-test.sh
189189

190190
release: release-test
191+
git tag ${VERSION}
191192
. testenv2/bin/activate && \
192193
python testenv2/src/${PACKAGE}/setup.py sdist bdist_wheel
193194
. testenv2/bin/activate && \
194195
pip install twine && \
195196
twine upload testenv2/src/${PACKAGE}/dist/* && \
196-
git tag ${VERSION} && git push --tags
197+
git push --tags
197198

198199
flake8: $(PYSOURCES)
199200
flake8 $^

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import os
1414
import sys
1515

16-
from pkg_resources import get_distribution
16+
from importlib.metadata import version
1717

1818
sys.path.insert(0, os.path.abspath('..'))
1919

@@ -62,7 +62,7 @@
6262
html_static_path = ['_static']
6363

6464

65-
release = get_distribution('schema-salad').version
65+
release = version('schema-salad')
6666
version = '.'.join(release.split('.')[:2])
6767

6868
autoapi_dirs = ['../schema_salad']

gittaggers.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[tool.setuptools_scm]
2+
write_to = "schema_salad/_version.py"

schema_salad/codegen.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
)
1414
from urllib.parse import urlsplit
1515

16-
from .dotnet_codegen import DotNetCodeGen
17-
1816
from . import schema
1917
from .codegen_base import CodeGenBase
18+
from .dotnet_codegen import DotNetCodeGen
2019
from .exceptions import SchemaSaladException
2120
from .java_codegen import JavaCodeGen
2221
from .python_codegen import PythonCodeGen

schema_salad/dotnet_codegen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
Set,
1515
Union,
1616
)
17+
from xml.sax.saxutils import escape # nosec
1718

1819
import pkg_resources
19-
from xml.sax.saxutils import escape
2020

2121
from . import _logger, schema
2222
from .codegen_base import CodeGenBase, TypeDef

schema_salad/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
)
3535

3636
from . import _logger, jsonld_context, ref_resolver, validate
37-
from .avro.schema import Names, SchemaParseException, make_avsc_object, is_subtype
37+
from .avro.schema import Names, SchemaParseException, is_subtype, make_avsc_object
3838
from .exceptions import (
3939
ClassValidationException,
4040
SchemaSaladException,

0 commit comments

Comments
 (0)