Skip to content

Commit 608f9c2

Browse files
committed
Switch to ABI3 compatible wheels
1 parent d5f17b3 commit 608f9c2

File tree

12 files changed

+198
-189
lines changed

12 files changed

+198
-189
lines changed

.github/workflows/build.yml

Lines changed: 42 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,16 @@ jobs:
4040
runs-on: ${{ matrix.os }}
4141

4242
steps:
43-
- uses: actions/checkout@v3
43+
- uses: actions/checkout@v4
4444

4545
- name: Set up Python ${{ matrix.python-version }}
4646
uses: actions/setup-python@v4
4747
with:
4848
python-version: ${{ matrix.python-version }}
4949

50-
- name: Install dependencies
51-
run: |
52-
python -m pip install -U pytest pytest-cov coveralls>=3.0.0 parameterized
53-
5450
- name: Install
5551
run: |
56-
python -m pip install .
52+
python -m pip install '.[dev]'
5753
5854
- name: Test
5955
run: |
@@ -67,12 +63,12 @@ jobs:
6763
pytest
6864
6965
- name: Coveralls
70-
if: ${{ matrix.python-version != 3.5 }} # coveralls no longer works well on 3.5
7166
env:
7267
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7368
COVERALLS_PARALLEL: true
7469
run: |
7570
cd test
71+
python -m pip install -U coveralls>=3.0.0
7672
coveralls --service=github
7773
7874
finish_coveralls:
@@ -96,44 +92,41 @@ jobs:
9692
lint:
9793
runs-on: ubuntu-latest
9894
steps:
99-
- uses: actions/checkout@v3
95+
- uses: actions/checkout@v4
10096
- name: Set up Python
10197
uses: actions/setup-python@v4
10298
with:
103-
python-version: "3.10"
104-
105-
- name: Install dependencies
106-
run: |
107-
python -m pip install -U pylint
99+
python-version: "3.11"
108100

109101
- name: Install
102+
env:
103+
SYSTEMRDL_SKIP_BINARY_BUILD: ~
110104
run: |
111-
python setup.py install
105+
python -m pip install '.[dev]'
112106
113107
- name: Run Lint
114108
run: |
115-
pylint --rcfile test/pylint.rc systemrdl
109+
pylint --rcfile test/pylint.rc src/systemrdl
116110
117111
#-------------------------------------------------------------------------------
118112
mypy:
119113
runs-on: ubuntu-latest
120114
steps:
121-
- uses: actions/checkout@v3
115+
- uses: actions/checkout@v4
122116
- name: Set up Python
123117
uses: actions/setup-python@v4
124118
with:
125-
python-version: "3.10"
119+
python-version: "3.11"
126120

127-
- name: Install dependencies
121+
- name: Install
122+
env:
123+
SYSTEMRDL_SKIP_BINARY_BUILD: ~
128124
run: |
129-
python -m pip install -U types-Markdown
130-
131-
# Exclude version due to: https://github.com/python/mypy/issues/16770
132-
python -m pip install -U "mypy != 1.8.0"
125+
python -m pip install '.[dev]'
133126
134127
- name: Type Check
135128
run: |
136-
mypy --config-file test/mypy.ini systemrdl
129+
mypy --config-file test/mypy.ini src/systemrdl
137130
138131
#-------------------------------------------------------------------------------
139132
build_wheels:
@@ -149,47 +142,40 @@ jobs:
149142
os:
150143
- windows-latest
151144
- macos-latest
145+
- ubuntu-latest
152146
include:
153147
# Only build CPython 3.x targets
154148
- cibw_build: "cp3*"
155-
cibw_skip: ""
156-
name_suffix: ""
157-
158-
# Parallelize Linux builds because there are many!
159-
- os: ubuntu-latest
160-
name_suffix: "manylinux_x86_64"
161-
cibw_build: "cp3*-manylinux_x86_64"
162-
cibw_skip: ""
163-
- os: ubuntu-latest
164-
name_suffix: "manylinux_i686"
165-
cibw_build: "cp3*-manylinux_i686"
166-
cibw_skip: ""
167-
- os: ubuntu-latest
168-
name_suffix: "musllinux_x86_64"
169-
cibw_build: "cp3*-musllinux_x86_64"
170-
cibw_skip: ""
171-
- os: ubuntu-latest
172-
name_suffix: "others"
173-
cibw_build: "cp3*"
174-
cibw_skip: "cp3*-{manylinux_x86_64,manylinux_i686,musllinux_x86_64}"
175-
176149

177150
steps:
178-
- uses: actions/checkout@v3
151+
- uses: actions/checkout@v4
179152

180153
- name: Build wheels
181-
uses: pypa/cibuildwheel@v2.16.5
154+
uses: pypa/cibuildwheel@v2.22.0
182155
env:
183-
CIBW_BUILD: ${{ matrix.cibw_build }}
184-
CIBW_SKIP: ${{ matrix.cibw_skip }}
156+
# Only build CPython 3.x targets
157+
CIBW_BUILD: "cp3*"
185158
# Ensure full C++17 availability on macOS builds
186159
MACOSX_DEPLOYMENT_TARGET: "10.13"
187160
# Signal setup.py to fail if binary build fails
188161
SYSTEMRDL_REQUIRE_BINARY_BUILD: ~
189162

163+
- name: Set up Python
164+
uses: actions/setup-python@v4
165+
with:
166+
python-version: "3.11"
167+
168+
- name: Install dependencies
169+
run: |
170+
python -m pip install abi3audit
171+
172+
- name: ABI3 audit
173+
run: |
174+
abi3audit --debug --verbose --summary --strict wheelhouse/*.whl
175+
190176
- uses: actions/upload-artifact@v4
191177
with:
192-
name: whl-${{ matrix.os }}${{ matrix.name_suffix }}
178+
name: whl-${{ matrix.os }}-${{ strategy.job-index }}
193179
path: ./wheelhouse/*.whl
194180

195181
#-------------------------------------------------------------------------------
@@ -201,15 +187,19 @@ jobs:
201187
name: Build source distribution
202188
runs-on: ubuntu-latest
203189
steps:
204-
- uses: actions/checkout@v3
190+
- uses: actions/checkout@v4
205191

206192
- uses: actions/setup-python@v4
207193
name: Install Python
208194
with:
209-
python-version: "3.10"
195+
python-version: "3.11"
196+
197+
- name: Install dependencies
198+
run: |
199+
python -m pip install build
210200
211201
- name: Build sdist
212-
run: python setup.py sdist
202+
run: python -m build --sdist
213203

214204
- uses: actions/upload-artifact@v4
215205
name: sdist

MANIFEST.in

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
include LICENSE
2-
include LICENSE-3RD-PARTY
3-
include systemrdl/preprocessor/ppp_runner.pl
4-
include systemrdl/py.typed
5-
recursive-include systemrdl/parser/ext *
61
recursive-exclude test *
2+
recursive-exclude docs *
3+
recursive-exclude examples *
4+
recursive-exclude .github *

pyproject.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,20 @@ classifiers = [
4141
"Topic :: Software Development :: Code Generators",
4242
]
4343

44+
[project.optional-dependencies]
45+
dev = [
46+
"pytest",
47+
"pytest-cov",
48+
"parameterized",
49+
"pylint",
50+
51+
# Avoiding newer mypy for now because I didn't know how to do type hints
52+
# 5 years ago...
53+
# https://github.com/python/mypy/issues/16770
54+
"mypy < 1.8.0",
55+
"types-Markdown",
56+
]
57+
4458
[project.urls]
4559
Source = "https://github.com/SystemRDL/systemrdl-compiler"
4660
Tracker = "https://github.com/SystemRDL/systemrdl-compiler/issues"

setup.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ def run_setup(with_binary):
3030
sources=get_files("src/systemrdl/parser/ext", "*.cpp"),
3131
depends=get_files("src/systemrdl/parser/ext", "*.h"),
3232

33-
extra_compile_args=extra_compile_args.get(target, [])
33+
extra_compile_args=extra_compile_args.get(target, []),
34+
define_macros=[("Py_LIMITED_API", "0x03060000")],
35+
py_limited_api=True,
3436
)
3537
ext_modules = [parser_ext]
3638
else:
@@ -39,6 +41,7 @@ def run_setup(with_binary):
3941
setuptools.setup(
4042
ext_modules=ext_modules,
4143
cmdclass={"build_ext": ve_build_ext},
44+
options={"bdist_wheel": {"py_limited_api": "cp36"}},
4245
)
4346

4447

@@ -89,6 +92,9 @@ def build_extension(self, ext):
8992
# Force using fallback python parser under some conditions
9093
using_fallback = is_jython or is_pypy or is_old_python
9194

95+
if 'SYSTEMRDL_SKIP_BINARY_BUILD' in os.environ:
96+
using_fallback = True
97+
9298
if not using_fallback:
9399
try:
94100
run_setup(with_binary=True)

0 commit comments

Comments
 (0)