Skip to content

Enables python 3.13 #871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Apr 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/setup-python@v4
with:
python-version: "3.9"

Expand All @@ -25,28 +25,21 @@ jobs:

- name: Install poetry
run: |
curl -fsS https://install.python-poetry.org | python - -y

- name: Update PATH
if: ${{ matrix.os != 'Windows' }}
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
pipx install poetry>=2

- name: Configure poetry
run: poetry config virtualenvs.create false
run: poetry config virtualenvs.in-project true

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

- name: Install project
run: poetry install --only test --only benchmark --only build -vvv --no-root

- name: Install pendulum and check extensions
run: |
poetry run pip install -e . -vvv
python -c 'import pendulum._pendulum'
poetry run python -c 'import pendulum._pendulum'

- name: Run benchmarks
uses: CodSpeedHQ/action@v3
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: pytest tests/ --codspeed
run: poetry run pytest tests/ --codspeed
61 changes: 36 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
jobs:
build:
name: Build on ${{ matrix.platform || matrix.os }} (${{ matrix.target }} - ${{ matrix.manylinux || 'auto' }})
environment: release
strategy:
fail-fast: false
matrix:
Expand All @@ -31,8 +32,6 @@ jobs:
- os: ubuntu
platform: linux
target: aarch64
# mimalloc not supported on manylinux2014 cross-compile container
extra-build-args: --no-default-features
# musllinux
- os: ubuntu
platform: linux
Expand All @@ -46,14 +45,10 @@ jobs:
platform: linux
target: ppc64le
interpreter: 3.9 3.10 3.11 3.12 3.13
# mimalloc not supported on manylinux2014 cross-compile container
extra-build-args: --no-default-features
- os: ubuntu
platform: linux
target: s390x
interpreter: 3.9 3.10 3.11 3.12 3.13
# mimalloc not supported on manylinux2014 cross-compile container
extra-build-args: --no-default-features

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

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

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: dist
name: dist-${{ matrix.os }}-${{ matrix.target }}-${{ matrix.manylinux }}
path: dist

build_sdist:
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v3
- name: Build sdist
Expand All @@ -92,30 +88,49 @@ jobs:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dist
name: dist-sdist
path: dist

build_none:
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v3
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.5
- name: Install dependencies
run: poetry install --only main --only test --only typing --only build
- name: Run poetry build
run: poetry build
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: dist-any
path: dist


Release:
needs: [ build, build_sdist ]
if: success() && startsWith(github.ref, 'refs/tags/')
needs: [ build, build_sdist, build_none ]
if: success()
runs-on: ubuntu-latest

environment: release
permissions:
id-token: write
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: dist
pattern: dist*
path: dist

- name: Install Poetry
run: |
curl -fsS https://install.python-poetry.org | python - -y
merge-multiple: true

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

- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: |
poetry publish
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
strategy:
matrix:
os: [Ubuntu, MacOS, Windows]
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
defaults:
run:
shell: bash
Expand Down
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,18 @@ lint-rust:
format-rust:
cd rust && cargo fmt --all
cd rust && cargo clippy --tests --fix --allow-dirty -- -D warnings

dev:
poetry install --only main --only test --only typing --only build --only lint
poetry run maturin develop

lint:
poetry run mypy
poetry run pre-commit run --all-files

test:
PENDULUM_EXTENSIONS=0 poetry run pytest -q tests
poetry run pytest -q tests

clean:
rm src/pendulum/*.so
9 changes: 5 additions & 4 deletions clock
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,11 @@ translations = {{}}
def format_dict(self, d, tab=1):
s = ["{\n"]
for k, v in d.items():
if isinstance(v, (dict, LocaleDataDict)):
v = self.format_dict(v, tab + 1)
else:
v = repr(v)
v = (
self.format_dict(v, tab + 1)
if isinstance(v, (dict, LocaleDataDict))
else repr(v)
)

s.append(f"{' ' * tab}{k!r}: {v},\n")
s.append(f"{' ' * (tab - 1)}}}")
Expand Down
59 changes: 22 additions & 37 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]

dependencies = [
Expand Down Expand Up @@ -65,6 +66,8 @@ maturin = ">=1.0,<2.0"

[tool.maturin]
module-name = "pendulum._pendulum"
features = ["pyo3/extension-module"]
python-packages = ["pendulum"]

[tool.ruff]
fix = true
Expand Down
Loading