Skip to content

Commit 5282582

Browse files
authored
Enable python 3.13 (#871)
* bumps to newest pyO3, converts Py into Bound * disables pypi release * linter fixes * fixes linting * fixes release builds * fixes package * adds patchelf * make formats * bump pyo3 * cleansup some rust deprecations * uses install poetry action to get poetry 1.8.5 * correctly skips extensions * removes mimalloc * reverts unwanted pyproject changes * updates release.yml: adds none build without speedups, replaces removed github actions, uses new PyPI deployment workflow * adds todo on rust o3 deprecation * fixes codespeed workflow
1 parent ec1ea54 commit 5282582

File tree

16 files changed

+122
-135
lines changed

16 files changed

+122
-135
lines changed

.github/workflows/codspeed.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-22.04
1515
steps:
1616
- uses: actions/checkout@v3
17-
- uses: actions/setup-python@v3
17+
- uses: actions/setup-python@v4
1818
with:
1919
python-version: "3.9"
2020

@@ -25,28 +25,21 @@ jobs:
2525
2626
- name: Install poetry
2727
run: |
28-
curl -fsS https://install.python-poetry.org | python - -y
29-
30-
- name: Update PATH
31-
if: ${{ matrix.os != 'Windows' }}
32-
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
28+
pipx install poetry>=2
3329
3430
- name: Configure poetry
35-
run: poetry config virtualenvs.create false
31+
run: poetry config virtualenvs.in-project true
3632

3733
- name: Install dependencies
3834
run: poetry install --only test --only benchmark --only build -vvv --no-root
3935

40-
- name: Install project
41-
run: poetry install --only test --only benchmark --only build -vvv --no-root
42-
4336
- name: Install pendulum and check extensions
4437
run: |
4538
poetry run pip install -e . -vvv
46-
python -c 'import pendulum._pendulum'
39+
poetry run python -c 'import pendulum._pendulum'
4740
4841
- name: Run benchmarks
4942
uses: CodSpeedHQ/action@v3
5043
with:
5144
token: ${{ secrets.CODSPEED_TOKEN }}
52-
run: pytest tests/ --codspeed
45+
run: poetry run pytest tests/ --codspeed

.github/workflows/release.yml

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
jobs:
1010
build:
1111
name: Build on ${{ matrix.platform || matrix.os }} (${{ matrix.target }} - ${{ matrix.manylinux || 'auto' }})
12+
environment: release
1213
strategy:
1314
fail-fast: false
1415
matrix:
@@ -31,8 +32,6 @@ jobs:
3132
- os: ubuntu
3233
platform: linux
3334
target: aarch64
34-
# mimalloc not supported on manylinux2014 cross-compile container
35-
extra-build-args: --no-default-features
3635
# musllinux
3736
- os: ubuntu
3837
platform: linux
@@ -46,14 +45,10 @@ jobs:
4645
platform: linux
4746
target: ppc64le
4847
interpreter: 3.9 3.10 3.11 3.12 3.13
49-
# mimalloc not supported on manylinux2014 cross-compile container
50-
extra-build-args: --no-default-features
5148
- os: ubuntu
5249
platform: linux
5350
target: s390x
5451
interpreter: 3.9 3.10 3.11 3.12 3.13
55-
# mimalloc not supported on manylinux2014 cross-compile container
56-
extra-build-args: --no-default-features
5752

5853
runs-on: ${{ matrix.os }}-latest
5954
steps:
@@ -77,13 +72,14 @@ jobs:
7772

7873
- run: ${{ matrix.ls || 'ls -lh' }} dist/
7974

80-
- uses: actions/upload-artifact@v3
75+
- uses: actions/upload-artifact@v4
8176
with:
82-
name: dist
77+
name: dist-${{ matrix.os }}-${{ matrix.target }}-${{ matrix.manylinux }}
8378
path: dist
8479

8580
build_sdist:
8681
runs-on: ubuntu-latest
82+
environment: release
8783
steps:
8884
- uses: actions/checkout@v3
8985
- name: Build sdist
@@ -92,30 +88,49 @@ jobs:
9288
command: sdist
9389
args: --out dist
9490
- name: Upload sdist
95-
uses: actions/upload-artifact@v3
91+
uses: actions/upload-artifact@v4
9692
with:
97-
name: dist
93+
name: dist-sdist
94+
path: dist
95+
96+
build_none:
97+
runs-on: ubuntu-latest
98+
environment: release
99+
steps:
100+
- uses: actions/checkout@v3
101+
- name: Install and configure Poetry
102+
uses: snok/install-poetry@v1
103+
with:
104+
version: 1.8.5
105+
- name: Install dependencies
106+
run: poetry install --only main --only test --only typing --only build
107+
- name: Run poetry build
108+
run: poetry build
109+
- name: Upload sdist
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: dist-any
98113
path: dist
99114

100115

101116
Release:
102-
needs: [ build, build_sdist ]
103-
if: success() && startsWith(github.ref, 'refs/tags/')
117+
needs: [ build, build_sdist, build_none ]
118+
if: success()
104119
runs-on: ubuntu-latest
105-
120+
environment: release
121+
permissions:
122+
id-token: write
123+
contents: write
106124
steps:
107125
- name: Checkout code
108126
uses: actions/checkout@v2
109127

110128
- name: Download artifacts
111-
uses: actions/download-artifact@v3
129+
uses: actions/download-artifact@v4
112130
with:
113-
name: dist
131+
pattern: dist*
114132
path: dist
115-
116-
- name: Install Poetry
117-
run: |
118-
curl -fsS https://install.python-poetry.org | python - -y
133+
merge-multiple: true
119134

120135
- name: Update PATH
121136
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
@@ -134,12 +149,8 @@ jobs:
134149
uses: ncipollo/release-action@v1
135150
with:
136151
artifacts: "dist/*"
137-
token: ${{ secrets.GITHUB_TOKEN }}
138152
draft: false
139153
prerelease: steps.check-version.outputs.prerelease == 'true'
140154

141-
- name: Publish to PyPI
142-
env:
143-
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
144-
run: |
145-
poetry publish
155+
- name: Publish package distributions to PyPI
156+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
strategy:
3434
matrix:
3535
os: [Ubuntu, MacOS, Windows]
36-
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
36+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
3737
defaults:
3838
run:
3939
shell: bash

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,18 @@ lint-rust:
1616
format-rust:
1717
cd rust && cargo fmt --all
1818
cd rust && cargo clippy --tests --fix --allow-dirty -- -D warnings
19+
20+
dev:
21+
poetry install --only main --only test --only typing --only build --only lint
22+
poetry run maturin develop
23+
24+
lint:
25+
poetry run mypy
26+
poetry run pre-commit run --all-files
27+
28+
test:
29+
PENDULUM_EXTENSIONS=0 poetry run pytest -q tests
30+
poetry run pytest -q tests
31+
32+
clean:
33+
rm src/pendulum/*.so

clock

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,11 @@ translations = {{}}
190190
def format_dict(self, d, tab=1):
191191
s = ["{\n"]
192192
for k, v in d.items():
193-
if isinstance(v, (dict, LocaleDataDict)):
194-
v = self.format_dict(v, tab + 1)
195-
else:
196-
v = repr(v)
193+
v = (
194+
self.format_dict(v, tab + 1)
195+
if isinstance(v, (dict, LocaleDataDict))
196+
else repr(v)
197+
)
197198

198199
s.append(f"{' ' * tab}{k!r}: {v},\n")
199200
s.append(f"{' ' * (tab - 1)}}}")

poetry.lock

Lines changed: 22 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ classifiers = [
1414
"Programming Language :: Python :: 3.10",
1515
"Programming Language :: Python :: 3.11",
1616
"Programming Language :: Python :: 3.12",
17+
"Programming Language :: Python :: 3.13",
1718
]
1819

1920
dependencies = [
@@ -65,6 +66,8 @@ maturin = ">=1.0,<2.0"
6566

6667
[tool.maturin]
6768
module-name = "pendulum._pendulum"
69+
features = ["pyo3/extension-module"]
70+
python-packages = ["pendulum"]
6871

6972
[tool.ruff]
7073
fix = true

0 commit comments

Comments
 (0)