Skip to content

Commit

Permalink
feat: Python 3.8+, boost-histogram 1.5
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Aug 24, 2024
1 parent 814d183 commit 452e3db
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ jobs:
strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"

name: Check Python ${{ matrix.python-version }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.6
rev: v0.6.2
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

Hist is an analyst-friendly front-end for
[boost-histogram](https://github.com/scikit-hep/boost-histogram), designed for
Python 3.7+ (3.6 users get version 2.4). See [what's new](https://hist.readthedocs.io/en/latest/changelog.html).
Python 3.8+ (3.6-3.7 users get older versions). See [what's new](https://hist.readthedocs.io/en/latest/changelog.html).

![Slideshow of features. See docs/banner_slides.md for text if the image is not readable.](https://github.com/scikit-hep/hist/raw/main/docs/_images/banner.gif)

Expand Down
3 changes: 1 addition & 2 deletions docs/user-guide/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ You can also install it with Conda from conda-forge.
Supported platforms are identical to
`boost-histogram <https://boost-histogram.readthedocs.io/en/latest/usage/installation.html>`_,
though for the latest version of Hist you need Python 3.7+.
`boost-histogram <https://boost-histogram.readthedocs.io/en/latest/usage/installation.html>`_.
24 changes: 12 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ 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",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Scientific/Engineering :: Mathematics",
Expand All @@ -34,9 +34,9 @@ keywords = [
"boost-histogram",
"dask-histogram",
]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [
"boost-histogram>=1.3.1,<1.5",
"boost-histogram>=1.3.1,<1.6",
"histoprint>=2.2.0",
'numpy>=1.14.5',
'typing-extensions>=4;python_version<"3.11"',
Expand Down Expand Up @@ -67,14 +67,14 @@ fit = [
"iminuit >=2",
]
dask = [
"dask[dataframe] >=2022; python_version>='3.8'",
"dask_histogram >=2023.1; python_version>='3.8'"
"dask[dataframe] >=2022",
"dask_histogram >=2023.1",
]
test = [
"pytest >=6",
"pytest-mpl >=0.12",
"dask[dataframe] >=2022; python_version>='3.8' and python_version<'3.12'",
"dask_histogram >=2023.1; python_version>='3.8' and python_version<'3.12'",
"dask[dataframe] >=2022; python_version<'3.13'",
"dask_histogram >=2023.1; python_version<'3.13'",
]
dev = [
"pytest >=6",
Expand All @@ -84,8 +84,8 @@ dev = [
"scipy >=1.4",
"iminuit >=2; python_version<'3.11'",
"ipykernel",
"dask[dataframe] >=2022; python_version>='3.8'",
"dask_histogram >=2023.1; python_version>='3.8'",
"dask[dataframe] >=2022",
"dask_histogram >=2023.1",
]
docs = [
"pytest >=6",
Expand All @@ -96,8 +96,8 @@ docs = [
"iminuit >=2",
"ipython_genutils",
"graphviz >=0.20.1",
"dask[dataframe] >=2022; python_version>='3.8'",
"dask_histogram >=2023.1; python_version>='3.8'",
"dask[dataframe] >=2022",
"dask_histogram >=2023.1",
"nbsphinx",
"sphinx >=3.0.0",
"sphinx_copybutton",
Expand Down Expand Up @@ -150,7 +150,7 @@ ignore_missing_imports = true


[tool.pylint]
py-version = "3.7"
py-version = "3.8"
extension-pkg-allow-list = ["boost_histogram._core"]
reports.output-format = "colorized"
similarities.ignore-imports = "yes"
Expand Down
7 changes: 1 addition & 6 deletions src/hist/_compat/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
import sys
from typing import TYPE_CHECKING, Any

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

if sys.version_info < (3, 11):
from typing_extensions import Self
else:
Expand All @@ -21,7 +16,7 @@
Ufunc = Any


__all__ = ["Literal", "Protocol", "SupportsIndex", "Ufunc", "ArrayLike", "Self"]
__all__ = ["Ufunc", "ArrayLike", "Self"]


def __dir__() -> list[str]:
Expand Down
3 changes: 1 addition & 2 deletions src/hist/axis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

import typing
from collections.abc import Iterable
from typing import Any
from typing import Any, Protocol

import boost_histogram as bh
import boost_histogram.axis as bha

import hist

from .._compat.typing import Protocol
from ..axestuple import ArrayTuple, NamedAxesTuple
from . import transform

Expand Down
15 changes: 13 additions & 2 deletions src/hist/basehist.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@
import operator
import typing
import warnings
from typing import Any, Callable, Generator, Iterator, Mapping, Sequence, Tuple, Union
from typing import (
Any,
Callable,
Generator,
Iterator,
Mapping,
Protocol,
Sequence,
SupportsIndex,
Tuple,
Union,
)

import boost_histogram as bh
import histoprint
Expand All @@ -13,7 +24,7 @@
import hist

from . import interop
from ._compat.typing import ArrayLike, Protocol, Self, SupportsIndex
from ._compat.typing import ArrayLike, Self
from .axestuple import NamedAxesTuple
from .axis import AxisProtocol
from .quick_construct import MetaConstructor
Expand Down
4 changes: 2 additions & 2 deletions src/hist/interop.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from __future__ import annotations

from collections.abc import Sequence
from typing import Any, Callable, Iterator, TypeVar, cast
from typing import Any, Callable, Iterator, Protocol, TypeVar, cast

import numpy as np

from ._compat.typing import ArrayLike, Protocol
from ._compat.typing import ArrayLike

T_contra = TypeVar("T_contra", contravariant=True)
U = TypeVar("U")
Expand Down
4 changes: 1 addition & 3 deletions src/hist/intervals.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from __future__ import annotations

from typing import Any
from typing import Any, Literal

import numpy as np

from ._compat.typing import Literal

try:
from scipy import stats
except ModuleNotFoundError:
Expand Down
4 changes: 1 addition & 3 deletions src/hist/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

import inspect
import sys
from typing import Any, Callable, Iterable, NamedTuple, Union
from typing import Any, Callable, Iterable, Literal, NamedTuple, Union

import numpy as np

import hist

from ._compat.typing import Literal

try:
import matplotlib.axes
import matplotlib.pyplot as plt
Expand Down
4 changes: 3 additions & 1 deletion src/hist/svgutils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from __future__ import annotations

from ._compat.typing import Protocol, Self
from typing import Protocol

from ._compat.typing import Self


class SupportsStr(Protocol):
Expand Down

0 comments on commit 452e3db

Please sign in to comment.