Skip to content

Commit 128fc5a

Browse files
Merge branch 'master' into feature/enum_ns
2 parents 8bd75b5 + 73bef05 commit 128fc5a

15 files changed

Lines changed: 446 additions & 124 deletions

.github/workflows/ci-autowrap.yaml

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,37 @@ jobs:
3131
python-version: "3.11"
3232
- CYTHON: "==3.1.0"
3333
python-version: "3.12"
34+
- CYTHON: "==3.1.0"
35+
python-version: "3.13"
3436
steps:
3537
- uses: actions/checkout@v4
3638

3739
- name: Set up Python ${{ matrix.python-version }}
38-
uses: actions/setup-python@v4
40+
uses: actions/setup-python@v5
3941
with:
4042
python-version: ${{ matrix.python-version }}
4143

42-
- name: Upgrade pip version
43-
run: |
44-
python -m pip install -U pip
45-
- name: Install pytest
46-
run: |
47-
python -m pip install pytest
48-
- name: Install setuptools
44+
- name: Cache pip dependencies
45+
uses: actions/cache@v4
46+
with:
47+
path: ~/.cache/pip
48+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
49+
restore-keys: |
50+
${{ runner.os }}-pip-${{ matrix.python-version }}-
51+
${{ runner.os }}-pip-
52+
53+
- name: Upgrade pip and install build tools
4954
run: |
50-
python -m pip install setuptools
51-
- name: Upgrade cython version
55+
python -m pip install -U pip build setuptools wheel
56+
57+
- name: Install Cython
5258
run: |
5359
python -m pip install "Cython${{ matrix.CYTHON }}"
54-
- name: run tests
60+
61+
- name: Install package in development mode
62+
run: |
63+
python -m pip install -e .[test]
64+
65+
- name: Run tests
5566
run: |
56-
python setup.py develop
57-
py.test tests/
67+
python -m pytest tests/ -v

.github/workflows/release-autowrap.yaml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,17 @@ jobs:
1818
- uses: actions/checkout@v4
1919

2020
- name: Set up Python
21-
uses: actions/setup-python@v4
21+
uses: actions/setup-python@v5
2222
with:
23-
python-version: 3.11
23+
python-version: "3.11"
2424

25-
- name: Upgrade pip version
25+
- name: Install build dependencies
2626
run: |
27-
python -m pip install -U pip
28-
29-
- name: Install wheel
30-
run: |
31-
python -m pip install wheel
32-
33-
- name: Install setuptools
34-
run: |
35-
python -m pip install setuptools
27+
python -m pip install -U pip build
3628
3729
- name: Build wheel and source distribution
3830
run: |
39-
python setup.py bdist_wheel sdist
31+
python -m build
4032
4133
- name: Publish package to PyPI
4234
uses: pypa/gh-action-pypi-publish@master
@@ -46,7 +38,7 @@ jobs:
4638
packages_dir: ${{ github.workspace }}/dist
4739

4840
- name: Parse version
49-
run: echo "version=$(python3 -c 'from autowrap.version import __version__ as v; print("%d.%d.%d" % v)')" >> $GITHUB_OUTPUT
41+
run: echo "version=$(python3 -c 'from autowrap.version import __version__; print(__version__)')" >> $GITHUB_OUTPUT
5042
id: version
5143

5244
- name: Create github release
@@ -71,7 +63,11 @@ jobs:
7163
cat CHANGELOG.md >> HISTORY.md
7264
echo >> HISTORY.md
7365
rm CHANGELOG.md && echo "autowrap $NEXT_VER" > CHANGELOG.md
74-
sed -i -e "s/^[[:space:]]*__version__.*/__version__ = \(${NEXT_VER//./, }\)/g" autowrap/version.py
66+
# Update string version
67+
sed -i -e "s/^__version__ = \".*\"/__version__ = \"$NEXT_VER\"/g" autowrap/version.py
68+
# Update tuple version for backward compatibility
69+
TUPLE_VER=$(echo $NEXT_VER | sed 's/\./, /g')
70+
sed -i -e "s/^__version_tuple__ = (.*)/__version_tuple__ = ($TUPLE_VER)/g" autowrap/version.py
7571
7672
- uses: stefanzweifel/git-auto-commit-action@v4.15.2
7773
with:

.gitignore

Lines changed: 146 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,153 @@
1-
*.py[co]
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Environments
105+
.env
106+
.venv
107+
env/
108+
venv/
109+
ENV/
110+
env.bak/
111+
venv.bak/
112+
113+
# Spyder project settings
114+
.spyderproject
115+
.spyproject
116+
117+
# Rope project settings
118+
.ropeproject
119+
120+
# mkdocs documentation
121+
/site
122+
123+
# mypy
124+
.mypy_cache/
125+
.dmypy.json
126+
dmypy.json
127+
128+
# Pyre type checker
129+
.pyre/
130+
131+
# IDEs and editors
132+
.idea/
133+
.vscode/
134+
*.swp
135+
*.swo
136+
*~
2137

3138
# gvim
4139
.*.sw[ijklmnop]
5-
*~
6140

7-
# Packages
141+
# OS files
142+
.DS_Store
143+
.DS_Store?
144+
._*
145+
.Spotlight-V100
146+
.Trashes
147+
ehthumbs.db
148+
Thumbs.db
149+
150+
# Modern Python packaging
8151
*.egg
9152
*.egg-info
10153
dist
@@ -16,24 +159,10 @@ var
16159
sdist
17160
develop-eggs
18161
.installed.cfg
19-
.idea
20-
.vscode
21-
22-
# Installer logs
23-
pip-log.txt
24-
25-
# Unit test / coverage reports
26-
.coverage
27-
.tox
28-
29-
#Translations
30-
*.mo
31162

32163
#Mr Developer
33164
.mr.developer.cfg
34165

35-
htmlcov
36-
37166
# generated py extensions
38167
tests/test_files/gil_testing_wrapper.pyx
39168
tests/test_files/libcpp_stl_test.pyx

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
autowrap 0.22.12
1+
autowrap 0.23.0
2+
3+
Support for Cython 3.1! This means the removal of some py2 compatibility code, no more python distinction between long and int, some fixes to multiline comment processing.

HISTORY.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ autowrap 0.22.11
2424
- Fixes some issues with typing support on python side
2525
- Added a real C++ bool converter. C++ bools in a pxd will now be real booleans
2626
on python side. Not "just" ints and will also be typed like that.
27+
28+
autowrap 0.22.12
29+

autowrap/Code.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import string
3838
import re
3939

40+
4041
class Code(object):
4142
def __init__(self):
4243
self.content: List[Union[Code, str]] = []

autowrap/CodeGenerator.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
def namespace_handler(ns):
8585
return ns
8686

87+
8788
def augment_arg_names(method):
8889
"""replaces missing arg_names with "in_%d" % i, where i is the position
8990
number of the arg"""
@@ -93,11 +94,12 @@ def augment_arg_names(method):
9394

9495

9596
def fixed_include_dirs(include_boost: bool) -> List[AnyStr]:
96-
import pkg_resources
97+
from importlib.resources import files
9798

98-
boost = pkg_resources.resource_filename("autowrap", "data_files/boost")
99-
data = pkg_resources.resource_filename("autowrap", "data_files")
100-
autowrap_internal = pkg_resources.resource_filename("autowrap", "data_files/autowrap")
99+
autowrap_files = files("autowrap")
100+
boost = str(autowrap_files.joinpath("data_files/boost"))
101+
data = str(autowrap_files.joinpath("data_files"))
102+
autowrap_internal = str(autowrap_files.joinpath("data_files/autowrap"))
101103

102104
if not include_boost:
103105
return [autowrap_internal]
@@ -1650,7 +1652,7 @@ def create_special_getitem_method(self, mdcl):
16501652

16511653
meth_code.add(
16521654
"""
1653-
| cdef long _idx = $call_arg
1655+
| cdef int _idx = $call_arg
16541656
""",
16551657
locals(),
16561658
)
@@ -1752,7 +1754,7 @@ def create_special_setitem_method(self, mdcl):
17521754
| \"\"\"$docstring\"\"\"
17531755
| assert isinstance(key, int), 'arg index wrong type'
17541756
|
1755-
| cdef long _idx = $call_arg
1757+
| cdef int _idx = $call_arg
17561758
| if _idx < 0:
17571759
| raise IndexError("invalid index %d" % _idx)
17581760
""",

0 commit comments

Comments
 (0)