Skip to content
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

feat: drop Python 3.8 #976

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.13", "pypy3.10"]
python-version: ["3.11", "3.13", "pypy3.10"]
include:
- python-version: "3.8"
- python-version: "3.9"
cmake-extras: "-DCMAKE_CXX_STANDARD=17"

steps:
Expand Down Expand Up @@ -117,13 +117,13 @@ jobs:
- os: ubuntu-24.04-arm
only: cp313-manylinux_aarch64
- os: windows-latest
only: cp38-win32
only: cp39-win32
- os: windows-latest
only: cp313-win_amd64
- os: macos-13
only: cp39-macosx_x86_64
only: cp310-macosx_x86_64
- os: macos-14
only: cp39-macosx_arm64
only: cp312-macosx_arm64

steps:
- uses: actions/checkout@v4
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ jobs:

- uses: astral-sh/setup-uv@v5

- uses: actions/setup-python@v5
if: matrix.os == 'macos-14'
with:
python-version: 3.8

- uses: pypa/cibuildwheel@v2.22
env:
CIBW_BUILD: ${{ matrix.build }}
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ python3 -m pip install boost-histogram
```

All the normal best-practices for Python apply; Pip should not be very old (Pip
9 is very old), you should be in a virtual environment, etc. Python 3.8+ is
9 is very old), you should be in a virtual environment, etc. Python 3.9+ is
required; for older versions of Python (3.5 and 2.7), `0.13` will be installed
instead, which is API equivalent to 1.0, but will not be gaining new features.
1.3.x was the last series to support Python 3.6. 1.4.x was the last series to
support Python 3.7.
support Python 3.7. 1.5.x was the last series to support Python 3.8.

#### Binaries available:

Expand All @@ -191,15 +191,15 @@ when you run the above command on a supported platform. Wheels are produced usin
[cibuildwheel](https://cibuildwheel.readthedocs.io/en/stable/); all common
platforms have wheels provided in boost-histogram:

| System | Arch | Python versions | PyPy versions |
| ----------------- | ------ | --------------------------------------- | ------------- |
| manylinux2014 | 64-bit | 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, 3.13t | 3.9, 3.10 |
| manylinux2014 | ARM64 | 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, 3.13t | 3.9, 3.10 |
| musllinux_1_1 | 64-bit | 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, 3.13t | |
| macOS 10.9+ Intel | 64-bit | 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, 3.13t | 3.9, 3.10 |
| macOS 11+ AS | Arm64 | 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, 3.13t | 3.9, 3.10 |
| Windows | 32-bit | 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, 3.13t | |
| Windows | 64-bit | 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, 3.13t | 3.9, 3.10 |
| System | Arch | Python versions | PyPy versions |
| ------------- | ------ | ---------------------------------- | ------------- |
| manylinux2014 | 64-bit | 3.9, 3.10, 3.11, 3.12, 3.13, 3.13t | 3.9, 3.10 |
| manylinux2014 | ARM64 | 3.9, 3.10, 3.11, 3.12, 3.13, 3.13t | 3.9, 3.10 |
| musllinux_1_1 | 64-bit | 3.9, 3.10, 3.11, 3.12, 3.13, 3.13t | |
| macOS | 64-bit | 3.9, 3.10, 3.11, 3.12, 3.13, 3.13t | 3.9, 3.10 |
| macOS | Arm64 | 3.9, 3.10, 3.11, 3.12, 3.13, 3.13t | 3.9, 3.10 |
| Windows | 32-bit | 3.9, 3.10, 3.11, 3.12, 3.13, 3.13t | |
| Windows | 64-bit | 3.9, 3.10, 3.11, 3.12, 3.13, 3.13t | 3.9, 3.10 |

PowerPC or IBM-Z wheels are not provided but are available on request.

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# -- Path setup --------------------------------------------------------------


DIR = Path(__file__).parent.resolve()
DIR = Path(__file__).parent
BASEDIR = DIR.parent

sys.path.append(str(BASEDIR / "src"))
Expand Down
4 changes: 2 additions & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Boost Histogram examples

The examples require Python 3.8. It is left as an exercise for the reader to
The examples require Python 3.9. It is left as an exercise for the reader to
convert back to older versions if they so desire.

### Setup
Expand All @@ -10,6 +10,6 @@ You can run these examples in a virtual environment using:
#### Conda

```bash
conda create -p .env python=3.8 boost-histogram matplotlib numpy -c conda-forge
conda create -p .env python=3.9 boost-histogram matplotlib numpy -c conda-forge
conda activate ./.env
```
7 changes: 1 addition & 6 deletions notebooks/BoostHistogramHandsOn.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -879,12 +879,7 @@
}
],
"source": [
"print(\n",
" f\"mean.count={mean.count} mean.value={mean.value:g} mean.variance={mean.variance:g}\"\n",
")\n",
"\n",
"# Python 3.8:\n",
"# print(f\"{mean.count=} {mean.value=} {mean.variance=}\")"
"print(f\"{mean.count=} {mean.value=} {mean.variance=}\")"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/xarray.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"channels:\n",
" - conda-forge\n",
"dependencies:\n",
" - python==3.8\n",
" - python==3.9\n",
" - boost-histogram\n",
" - xhistogram\n",
" - matplotlib\n",
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "boost-histogram"
dynamic = ["version"]
description = "The Boost::Histogram Python wrapper."
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.9"
authors = [
{ name = "Hans Dembinski", email = "hans.dembinski@gmail.com" },
{ name = "Henry Schreiner", email = "hschrein@cern.ch" },
Expand All @@ -29,7 +29,6 @@ classifiers = [
"Programming Language :: C++",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down Expand Up @@ -143,7 +142,7 @@ required_plugins = ["pytest-benchmark"]
log_cli_level = "DEBUG"

[tool.mypy]
python_version = "3.8"
python_version = "3.9"
files = ["src"]
strict = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
Expand Down Expand Up @@ -186,7 +185,7 @@ environment.MACOSX_DEPLOYMENT_TARGET = "14.0"


[tool.pylint]
py-version = "3.8"
py-version = "3.9"
ignore-patterns = ['.*\.pyi']
extension-pkg-allow-list = ["boost_histogram._core"]
reports.output-format = "colorized"
Expand Down
3 changes: 2 additions & 1 deletion src/boost_histogram/_core/axis/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Iterable, Iterator, Tuple, TypeVar
from collections.abc import Iterable, Iterator
from typing import Any

import numpy as np
from numpy.typing import ArrayLike
Expand Down
3 changes: 2 additions & 1 deletion src/boost_histogram/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import itertools
import sys
import typing
from typing import Any, Callable, ClassVar, Iterator, Protocol, TypeVar
from collections.abc import Iterator
from typing import Any, Callable, ClassVar, Protocol, TypeVar

import boost_histogram

Expand Down
15 changes: 7 additions & 8 deletions src/boost_histogram/axis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from __future__ import annotations

import copy
from collections.abc import Iterable, Iterator
from dataclasses import dataclass
from functools import partial
from typing import (
Any,
Callable,
ClassVar,
Iterable,
Iterator,
Literal,
TypedDict,
TypeVar,
Expand Down Expand Up @@ -350,7 +349,7 @@ def __init__(
Filling wraps around.
transform : Optional[AxisTransform] = None
Transform the regular bins (Log, Sqrt, and Pow(v))
__dict__: Optional[Dict[str, Any]] = None
__dict__: Optional[dict[str, Any]] = None
The full metadata dictionary
"""

Expand Down Expand Up @@ -466,7 +465,7 @@ def __init__(
growth : bool = False
Allow the axis to grow if a value is encountered out of range.
Be careful, the axis will grow as large as needed.
__dict__: Optional[Dict[str, Any]] = None
__dict__: Optional[dict[str, Any]] = None
The full metadata dictionary
"""

Expand Down Expand Up @@ -565,7 +564,7 @@ def __init__(
growth : bool = False
Allow the axis to grow if a value is encountered out of range.
Be careful, the axis will grow as large as needed.
__dict__: Optional[Dict[str, Any]] = None
__dict__: Optional[dict[str, Any]] = None
The full metadata dictionary
"""

Expand Down Expand Up @@ -661,7 +660,7 @@ def __init__(
Be careful, the axis will grow as large as needed.
overflow : bool = True
Include an overflow bin for "missed" hits. Ignored if growth=True.
__dict__: Optional[Dict[str, Any]] = None
__dict__: Optional[dict[str, Any]] = None
The full metadata dictionary
"""

Expand Down Expand Up @@ -733,7 +732,7 @@ def __init__(
Be careful, the axis will grow as large as needed.
overflow : bool = True
Include an overflow bin for "missed" hits. Ignored if growth=True.
__dict__: Optional[Dict[str, Any]] = None
__dict__: Optional[dict[str, Any]] = None
The full metadata dictionary
"""

Expand Down Expand Up @@ -773,7 +772,7 @@ def __init__(self, *, metadata: Any = None, __dict__: dict[str, Any] | None = No
----------
metadata : object
Any Python object to attach to the axis, like a label.
__dict__: Optional[Dict[str, Any]] = None
__dict__: Optional[dict[str, Any]] = None
The full metadata dictionary
"""

Expand Down
13 changes: 5 additions & 8 deletions src/boost_histogram/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@
import threading
import typing
import warnings
from collections.abc import Iterable, Mapping
from enum import Enum
from os import cpu_count
from typing import (
TYPE_CHECKING,
Any,
Callable,
ClassVar,
Iterable,
List,
Mapping,
NewType,
SupportsIndex,
Tuple,
TypeVar,
Union,
)
Expand Down Expand Up @@ -110,9 +107,9 @@ def __dir__() -> list[str]:

SimpleIndexing = Union[SupportsIndex, slice]
InnerIndexing = Union[SimpleIndexing, Callable[[Axis], int]]
FullInnerIndexing = Union[InnerIndexing, List[InnerIndexing]]
FullInnerIndexing = Union[InnerIndexing, list[InnerIndexing]]
IndexingWithMapping = Union[FullInnerIndexing, Mapping[int, FullInnerIndexing]]
IndexingExpr = Union[IndexingWithMapping, Tuple[IndexingWithMapping, ...], "ellipsis"]
IndexingExpr = Union[IndexingWithMapping, tuple[IndexingWithMapping, ...], "ellipsis"]

T = TypeVar("T")

Expand Down Expand Up @@ -526,9 +523,9 @@ def fill(
----------
*args : Union[Array[float], Array[int], Array[str], float, int, str]
Provide one value or array per dimension.
weight : List[Union[Array[float], Array[int], float, int, str]]]
weight : list[Union[Array[float], Array[int], float, int, str]]]
Provide weights (only if the histogram storage supports it)
sample : List[Union[Array[float], Array[int], Array[str], float, int, str]]]
sample : list[Union[Array[float], Array[int], Array[str], float, int, str]]]
Provide samples (only if the histogram storage supports it)
threads : Optional[int]
Fill with threads. Defaults to None, which does not activate
Expand Down
3 changes: 2 additions & 1 deletion src/boost_histogram/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import contextlib
import typing
from collections.abc import Sequence
from functools import reduce
from operator import mul
from typing import Any, Sequence
from typing import Any

if typing.TYPE_CHECKING:
from numpy.typing import ArrayLike
Expand Down
3 changes: 2 additions & 1 deletion src/boost_histogram/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

import copy
from builtins import sum
from typing import TYPE_CHECKING, Sequence, TypeVar
from collections.abc import Sequence
from typing import TYPE_CHECKING, TypeVar

if TYPE_CHECKING:
from uhi.typing.plottable import PlottableAxis
Expand Down
6 changes: 3 additions & 3 deletions src/boost_histogram/typing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import TYPE_CHECKING, Any, Protocol, Tuple, Union
from typing import TYPE_CHECKING, Any, Protocol, Union

if TYPE_CHECKING:
from builtins import ellipsis
Expand Down Expand Up @@ -35,7 +35,7 @@ def index(self, value: float | str) -> int: ...
def __len__(self) -> int: ...


StdIndex = Union[int, slice, "ellipsis", Tuple[Union[slice, int, "ellipsis"], ...]]
StdIndex = Union[int, slice, "ellipsis", tuple[Union[slice, int, "ellipsis"], ...]]
StrIndex = Union[
int, slice, str, "ellipsis", Tuple[Union[slice, int, str, "ellipsis"], ...]
int, slice, str, "ellipsis", tuple[Union[slice, int, str, "ellipsis"], ...]
]
3 changes: 2 additions & 1 deletion src/boost_histogram/view.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

from typing import Any, Callable, ClassVar, Literal, Mapping, MutableMapping
from collections.abc import Mapping, MutableMapping
from typing import Any, Callable, ClassVar, Literal

import numpy as np

Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import boost_histogram as bh

DIR = Path(__file__).parent.resolve()
DIR = Path(__file__).parent
BASE = DIR.parent


Expand Down
2 changes: 1 addition & 1 deletion tests/pickles/make_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import boost_histogram as bh

DIR = Path(__file__).parent.resolve()
DIR = Path(__file__).parent


def make_pickle(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pickles.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import boost_histogram as bh

DIR = Path(__file__).parent.resolve()
DIR = Path(__file__).parent


@pytest.mark.parametrize("version", ["0.10.2", "0.6.2", "0.11.1", "1.1.0"])
Expand Down
Loading