Skip to content

Commit 5991986

Browse files
authored
Merge pull request #169 from scikit-hep/py313
Python 3.13 support
2 parents 417fd96 + 3965330 commit 5991986

15 files changed

+47
-71
lines changed

.github/workflows/main.yml

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,49 +32,35 @@ jobs:
3232
- ubuntu-latest
3333
python-version:
3434
- "3.9"
35-
- "3.10"
36-
- "3.11"
3735
- "3.12"
36+
- "3.13"
3837
include:
3938
- os: windows-latest
4039
python-version: "3.9"
4140
- os: macos-13
4241
python-version: "3.9"
43-
- os: macos-14
42+
- os: macos-latest
4443
python-version: "3.12" # old versions not supported
4544
name: Check Python ${{ matrix.python-version }} ${{ matrix.os }}
4645
steps:
4746
- uses: actions/checkout@v4
4847
with:
4948
fetch-depth: 0
50-
5149
- name: Setup Python ${{ matrix.python-version }}
5250
uses: actions/setup-python@v5
5351
with:
5452
python-version: ${{ matrix.python-version }}
5553

56-
- name: Get pip cache dir
57-
id: pip-cache
58-
run: |
59-
echo "::set-output name=dir::$(pip cache dir)"
60-
- name: pip cache
61-
uses: actions/cache@v4.1.2
62-
with:
63-
path: ${{ steps.pip-cache.outputs.dir }}
64-
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.cfg') }}-pip-${{ hashFiles('**/setup.py') }}-pip-${{ hashFiles('**/pyproject.toml') }}
65-
restore-keys: |
66-
${{ runner.os }}-pip-
67-
6854
- name: Install package
6955
run: |
70-
python -m pip install --upgrade pip
71-
python -m pip install -e .[test] pytest-xdist # for multiprocessing
56+
pip install uv
57+
uv pip install --system -e .[test] pytest-xdist # for multiprocessing, -e needed for pathes etc.
7258
7359
- name: Test package
7460
run: python -m pytest --doctest-modules --cov=hepstats --cov-report=xml -n auto
7561

7662
- name: Upload coverage to Codecov
77-
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'
63+
if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'
7864
uses: codecov/codecov-action@v4
7965
with:
8066
token: ${{ secrets.CODECOV_TOKEN }} # technically not needed, but prevents failures: https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954
@@ -106,13 +92,16 @@ jobs:
10692
- uses: actions/checkout@v4
10793
with:
10894
fetch-depth: 0
109-
- uses: actions/setup-python@v5
95+
96+
- name: Setup Python 3.9
97+
uses: actions/setup-python@v5
11098
with:
111-
python-version: "3.11"
99+
python-version: 3.9
100+
112101
- name: Install dependencies
113102
run: |
114-
pip install -U -q -e .[docs]
115-
pip list
103+
pip install uv
104+
uv pip install --system -e .[docs]
116105
- name: build docs
117106
run: |
118107
sphinx-build -b html docs docs/_build/html

.pre-commit-config.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ repos:
1919
- id: requirements-txt-fixer
2020
- id: debug-statements
2121
- id: end-of-file-fixer
22-
- repo: https://github.com/mgedmin/check-manifest
23-
rev: "0.50"
24-
hooks:
25-
- id: check-manifest
26-
args:
27-
- --update
28-
- --no-build-isolation
29-
additional_dependencies:
30-
- hatchling
31-
- hatch-vcs
22+
# - repo: https://github.com/mgedmin/check-manifest
23+
# rev: "0.50"
24+
# hooks:
25+
# - id: check-manifest
26+
# args:
27+
# - --update
28+
# - --no-build-isolation
29+
# additional_dependencies:
30+
# - hatchling
31+
# - hatch-vcs
3232

3333
- repo: https://github.com/pre-commit/mirrors-mypy
3434
rev: v1.12.0
@@ -60,7 +60,7 @@ repos:
6060
rev: v2.7.0
6161
hooks:
6262
- id: setup-cfg-fmt
63-
args: [ --max-py-version=3.12, --include-version-classifiers ]
63+
args: [ --max-py-version=3.13, --include-version-classifiers ]
6464

6565
# Notebook formatting
6666
- repo: https://github.com/nbQA-dev/nbQA

CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Changelog
44
main
55
**************
66

7+
* Add support for Python 3.13
8+
79
Version 0.8.1
810
**************
911

MANIFEST.in

Lines changed: 0 additions & 24 deletions
This file was deleted.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ test = [
6868
"pytest",
6969
"pytest-cov",
7070
"pytest-runner",
71-
"zfit>=0.20.0",
71+
"zfit>=0.20.0;python_version<'3.13'",
72+
# 'hepstats[zfit];python_version<"3.13"', # not working, why?
7273
]
7374
zfit = ["zfit>=0.20.0"]
7475

tests/conftest.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ def data_gen():
3232
# TODO: manually ported, use pre-made: https://github.com/zfit/zfit-development/issues/73
3333
@pytest.fixture(autouse=True)
3434
def _setup_teardown():
35-
import zfit
35+
try:
36+
import zfit
37+
except ImportError:
38+
yield
39+
return
3640

3741
old_chunksize = zfit.run.chunking.max_n_points
3842
old_active = zfit.run.chunking.active

tests/hypotests/test_basetest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22
import numpy as np
3-
import zfit
3+
zfit = pytest.importorskip("zfit")
44
from zfit.loss import UnbinnedNLL
55
from zfit.minimize import Minuit
66

@@ -9,6 +9,7 @@
99
from hepstats.hypotests.parameters import POI, POIarray
1010

1111

12+
1213
def create_loss():
1314
obs = zfit.Space("x", limits=(0.1, 2.0))
1415
data = zfit.data.Data.from_numpy(obs=obs, array=np.random.normal(1.2, 0.1, 10000))

tests/hypotests/test_calculators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import numpy as np
44
import pytest
5-
import zfit
5+
zfit = pytest.importorskip("zfit")
66
from zfit.loss import UnbinnedNLL
77
from zfit.minimize import Minuit
88

tests/hypotests/test_confidence_intervals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22
import numpy as np
3-
import zfit
3+
zfit = pytest.importorskip("zfit")
44
import os
55
from zfit.loss import UnbinnedNLL
66
from zfit.minimize import Minuit

tests/hypotests/test_discovery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import numpy as np
44
import pytest
5-
import zfit
5+
zfit = pytest.importorskip("zfit")
66
from zfit.loss import UnbinnedNLL
77
from zfit.minimize import Minuit
88

0 commit comments

Comments
 (0)