Skip to content

Commit ffcf91a

Browse files
Merge branch 'master' into feature/arbitrTypeGetSetItem
2 parents ab6d4d3 + cbb74c1 commit ffcf91a

File tree

18 files changed

+489
-303
lines changed

18 files changed

+489
-303
lines changed

.github/workflows/ci-autowrap.yaml

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,40 +15,53 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
include:
18-
# - CYTHON: "<=0.29.21"
19-
# python-version: "2.7"
20-
- CYTHON: "<=0.29.21"
21-
python-version: "3.7"
2218
- CYTHON: "<=0.29.21"
2319
python-version: "3.9" # Cython < 0.29.21 not compatible with 3.10, so neither are we
24-
# - CYTHON: ">0.29.21"
25-
# python-version: "2.7"
26-
- CYTHON: ">0.29.21"
27-
python-version: "3.7"
2820
- CYTHON: ">0.29.21"
2921
python-version: "3.10"
30-
- CYTHON: "==3.0.0a10"
31-
python-version: "3.7"
32-
- CYTHON: "==3.0.0a10"
22+
- CYTHON: "==3.0.0"
23+
python-version: "3.10"
24+
- CYTHON: "==3.0.0"
25+
python-version: "3.11"
26+
- CYTHON: "==3.0.0"
27+
python-version: "3.12"
28+
- CYTHON: "==3.1.0"
3329
python-version: "3.10"
30+
- CYTHON: "==3.1.0"
31+
python-version: "3.11"
32+
- CYTHON: "==3.1.0"
33+
python-version: "3.12"
34+
- CYTHON: "==3.1.0"
35+
python-version: "3.13"
3436
steps:
35-
- uses: actions/checkout@v3
37+
- 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
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
4654
run: |
47-
python -m pip install pytest
48-
- name: Upgrade cython version
55+
python -m pip install -U pip build setuptools wheel
56+
57+
- name: Install Cython
4958
run: |
5059
python -m pip install "Cython${{ matrix.CYTHON }}"
51-
- 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
5266
run: |
53-
python setup.py develop
54-
py.test tests/
67+
python -m pytest tests/ -v

.github/workflows/release-autowrap.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,20 @@ jobs:
1515
build_publish:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v3
18+
- 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.9
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
27+
python -m pip install -U pip build
3228
3329
- name: Build wheel and source distribution
3430
run: |
35-
python setup.py bdist_wheel sdist
31+
python -m build
3632
3733
- name: Publish package to PyPI
3834
uses: pypa/gh-action-pypi-publish@master
@@ -42,16 +38,16 @@ jobs:
4238
packages_dir: ${{ github.workspace }}/dist
4339

4440
- name: Parse version
45-
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
4642
id: version
4743

4844
- name: Create github release
49-
uses: softprops/action-gh-release@v1
45+
uses: softprops/action-gh-release@v2
5046
id: create_release
5147
with:
5248
draft: false
5349
prerelease: false
54-
release_name: ${{ steps.version.outputs.version }}
50+
name: ${{ steps.version.outputs.version }}
5551
tag_name: release/${{ steps.version.outputs.version }}
5652
body_path: CHANGELOG.md
5753
env:
@@ -67,7 +63,11 @@ jobs:
6763
cat CHANGELOG.md >> HISTORY.md
6864
echo >> HISTORY.md
6965
rm CHANGELOG.md && echo "autowrap $NEXT_VER" > CHANGELOG.md
70-
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
7171
7272
- uses: stefanzweifel/git-auto-commit-action@v4.15.2
7373
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: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,6 @@
3737
import string
3838
import re
3939

40-
try:
41-
unicode = unicode
42-
except NameError:
43-
# 'unicode' is undefined, must be Python 3
44-
str = str
45-
unicode = str
46-
bytes = bytes
47-
basestring = (str, bytes)
48-
else:
49-
# 'unicode' exists, must be Python 2
50-
str = str
51-
unicode = unicode
52-
bytes = str
53-
basestring = basestring
54-
5540

5641
class Code(object):
5742
def __init__(self):
@@ -74,7 +59,7 @@ def add(self, what: Union[str, bytes, Code], *a, **kw) -> Code:
7459
kw.update(a[0])
7560
if "self" in kw:
7661
del kw["self"] # self causes problems in substitute call below
77-
if isinstance(what, basestring):
62+
if isinstance(what, (str, bytes)):
7863
try:
7964
res = string.Template(what).substitute(**kw)
8065
except ValueError:
@@ -92,7 +77,7 @@ def add(self, what: Union[str, bytes, Code], *a, **kw) -> Code:
9277
def _render(self, _indent="") -> List[str]:
9378
result = []
9479
for content in self.content:
95-
if isinstance(content, basestring):
80+
if isinstance(content, (str, bytes)):
9681
result.append(_indent + content)
9782
else:
9883
newindent = _indent + " " * 4

0 commit comments

Comments
 (0)