Skip to content

Commit

Permalink
chore: require Python 3.8+ (#581)
Browse files Browse the repository at this point in the history
* chore: drop Python 3.7, add Python 3.12

Signed-off-by: Henry Schreiner <[email protected]>

* ci: speed up with uv

Signed-off-by: Henry Schreiner <[email protected]>

* Revert "ci: speed up with uv"

This reverts commit c2fbd07.

---------

Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Apr 2, 2024
1 parent 7ec4d9a commit b2e66bd
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

- uses: wntrblm/[email protected]
with:
python-versions: "3.7"
python-versions: "3.8"

- name: Make ZipApp
run: nox -s zipapp
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- {os: macos-latest, python-version: '3.7'}
- {os: macos-latest, python-version: '3.11'}
- {os: windows-latest, python-version: '3.7'}
- {os: windows-latest, python-version: '3.11'}
- {os: macos-latest, python-version: '3.8'}
- {os: macos-latest, python-version: '3.12'}
- {os: windows-latest, python-version: '3.8'}
- {os: windows-latest, python-version: '3.12'}

steps:
- uses: actions/checkout@v4
Expand All @@ -62,11 +62,10 @@ jobs:
run: python -m pytest ./tests --cov=src/particle --cov-report=xml

- name: Test coverage with Codecov
if: "runner.os != 'Windows' && matrix.python-version != 3.7"
uses: codecov/codecov-action@v4

- name: Test docstrings with doctest
if: "runner.os == 'Linux' && matrix.python-version == 3.11"
if: "runner.os == 'Linux' && matrix.python-version == 3.12"
run: python -m pytest --doctest-modules src/particle --ignore=src/particle/particle/convert.py

notebooks:
Expand Down Expand Up @@ -101,7 +100,7 @@ jobs:

- uses: wntrblm/[email protected]
with:
python-versions: 3.7
python-versions: "3.8"

- name: Make ZipApp
run: nox -s zipapp
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ or similar (use `--user`, `virtualenv`, etc. if you wish).

## Strict dependencies

- [Python](http://docs.python-guide.org/en/latest/starting/installation/) (3.7+)
- [Python](http://docs.python-guide.org/en/latest/starting/installation/) (3.8+)
- [importlib_resources backport](http://importlib-resources.readthedocs.io/en/latest/) if using Python < 3.9
- [attrs](http://www.attrs.org/en/stable/) provides classes without boilerplate (similar to DataClasses in Python 3.7)
- [hepunits](https://github.com/scikit-hep/hepunits)\_ provides units for the Scikit-HEP packages
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: particle_demo
channels:
- conda-forge
dependencies:
- python>=3.7
- python>=3.8
# Setting recent versions to make the conda solve faster
- numpy>=1.16
- pandas>=0.24
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def build(session: nox.Session) -> None:
)


@nox.session(python="3.7")
@nox.session(python="3.8")
def zipapp(session: nox.Session) -> None:
tmpdir = session.create_tmp()

Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "particle"
description = "Extended PDG particle data and MC identification codes"
readme = "README.md"
requires-python = ">=3.7"
requires-python = ">=3.8"
authors = [
{ name = "Eduardo Rodrigues", email = "[email protected]" },
{ name = "Henry Schreiner", email = "[email protected]" },
Expand All @@ -32,11 +32,11 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
]
dependencies = [
Expand Down Expand Up @@ -111,7 +111,7 @@ filterwarnings = [
]

[tool.pylint]
master.py-version = "3.7"
master.py-version = "3.8"
reports.output-format = "colorized"
similarities.ignore-imports = "yes"
master.jobs = "0"
Expand Down
11 changes: 1 addition & 10 deletions src/particle/_compat/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@

import sys

if sys.version_info < (3, 8):
from typing_extensions import Protocol, runtime_checkable
else:
from typing import Protocol, runtime_checkable

if sys.version_info < (3, 9):
from importlib_resources.abc import Traversable
elif sys.version_info < (3, 11):
Expand All @@ -21,8 +16,4 @@
from importlib.resources.abc import Traversable


__all__ = (
"Protocol",
"runtime_checkable",
"Traversable",
)
__all__ = ("Traversable",)
4 changes: 2 additions & 2 deletions src/particle/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

from __future__ import annotations

from typing import IO, Any, Union
from typing import IO, Any, Protocol, Union, runtime_checkable

from ._compat.typing import Protocol, Traversable, runtime_checkable
from ._compat.typing import Traversable

__all__ = (
"StringOrIO",
Expand Down
18 changes: 0 additions & 18 deletions tests/test_module_apis.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
from __future__ import annotations

from sys import version_info

import pytest

import particle

python37plus_only = pytest.mark.skipif(
version_info < (3, 7), reason="requires Python3.7+"
)


@python37plus_only
def test_top_level_api():
assert dir(particle) == [
"Charge",
Expand All @@ -33,7 +24,6 @@ def test_top_level_api():
]


@python37plus_only
def test_api_converters():
assert dir(particle.converters) == [
"Corsika72PDGIDBiMap",
Expand All @@ -45,22 +35,18 @@ def test_api_converters():
]


@python37plus_only
def test_api_corsika():
assert dir(particle.corsika) == ["Corsika7ID"]


@python37plus_only
def test_api_data():
assert dir(particle.data) == ["basepath"]


@python37plus_only
def test_api_geant():
assert dir(particle.geant) == ["Geant3ID"]


@python37plus_only
def test_api_lhcb():
assert dir(particle.lhcb) == [
"LHCbName2PDGIDBiMap",
Expand All @@ -69,12 +55,10 @@ def test_api_lhcb():
]


@python37plus_only
def test_api_lhcb_data():
assert dir(particle.lhcb.data) == ["basepath"]


@python37plus_only
def test_api_particle():
assert dir(particle.particle) == [
"Charge",
Expand All @@ -93,7 +77,6 @@ def test_api_particle():
]


@python37plus_only
def test_api_pdgid():
assert dir(particle.pdgid) == sorted(
[
Expand Down Expand Up @@ -145,6 +128,5 @@ def test_api_pdgid():
)


@python37plus_only
def test_api_pythia():
assert dir(particle.pythia) == ["PythiaID"]

0 comments on commit b2e66bd

Please sign in to comment.