Skip to content

Commit c11c45e

Browse files
authored
Merge pull request #68 from mkopec87/feature/switch-to-toml
* Switch from setup.py to pyproject.toml
2 parents f0b9f72 + fb20090 commit c11c45e

File tree

7 files changed

+126
-181
lines changed

7 files changed

+126
-181
lines changed

.github/workflows/test.yml

+31-21
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,37 @@ jobs:
99
test:
1010
strategy:
1111
matrix:
12-
os: [ubuntu-latest]
13-
python: ['3.9', '3.10', '3.11', '3.12']
12+
os: [ ubuntu-latest ]
13+
python: [ "3.9", "3.10", "3.11", "3.12" ]
14+
numpy_version: [ "numpy-latest", "numpy<2" ]
1415
runs-on: ${{ matrix.os }}
1516

1617
steps:
17-
- uses: actions/checkout@v2
18-
- name: Set up Python ${{ matrix.python }}
19-
uses: actions/setup-python@v1
20-
with:
21-
python-version: ${{ matrix.python }}
22-
- uses: actions/cache@v3
23-
with:
24-
path: ~/.cache/pip
25-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/requirements-test.txt') }}
26-
restore-keys: |
27-
${{ runner.os }}-pip-
28-
- name: Install dependencies
29-
run: |
30-
python -m pip install --upgrade pip
31-
pip install -e .
32-
pip install -r requirements-test.txt
33-
- name: Test with pytest
34-
run: |
35-
pytest tests/
18+
- name: Checkout code
19+
uses: actions/checkout@v2
20+
21+
- name: Set up Python ${{ matrix.python }}
22+
uses: actions/setup-python@v1
23+
with:
24+
python-version: ${{ matrix.python }}
25+
26+
- name: Use cache for pip dependencies
27+
uses: actions/cache@v3
28+
with:
29+
path: ~/.cache/pip
30+
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
31+
restore-keys: |
32+
${{ runner.os }}-pip-
33+
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
if [ "${{ matrix.numpy_version }}" = "numpy<2" ]; then
38+
pip install ".[test,pandas,spark,test_numpy_pre2]"
39+
else
40+
pip install ".[test,pandas,spark]"
41+
fi
42+
43+
- name: Test with pytest
44+
run: |
45+
pytest tests

CHANGES.rst

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ Version 1.0.34, Dec 2024
2020
* Remove unused test_gpu.twosigfigs function.
2121
* Refactor tests with Numpy() and Pandas() context managers to use single 'with' statement.
2222

23+
* Switch from setup.py to pyproject.toml
24+
* Add numpy<2,pandas<2 test environment to build pipeline test matrix
25+
2326
Version 1.0.33, Dec 2022
2427
------------------------
2528
* fix of get_sub_hist() when Bin histogram is filled only with nans.

histogrammar/version.py

+14-13
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
"""THIS FILE IS AUTO-GENERATED BY SETUP.PY."""
2-
31
import re
2+
from typing import Tuple
43

5-
name = "histogrammar"
6-
__version__ = "1.0.34"
74
version = "1.0.34"
8-
full_version = "1.0.34"
9-
release = True
105

11-
version_info = tuple(re.split(r"[-\.]", __version__))
12-
specification = ".".join(version_info[:2])
136

7+
def split_version_string(version_string: str) -> Tuple[int, int]:
8+
version_numbers = list(map(int, re.split(r"[-.]", version_string)))
9+
return version_numbers[0], version_numbers[1]
10+
11+
12+
specification = ".".join([str(i) for i in split_version_string(version)[:2]])
13+
14+
15+
def compatible(serialized_version: str) -> bool:
16+
self_major, self_minor = split_version_string(version)
17+
other_major, other_minor = split_version_string(serialized_version)
1418

15-
def compatible(serializedVersion):
16-
selfMajor, selfMinor = map(int, version_info[:2])
17-
otherMajor, otherMinor = map(int, re.split(r"[-\.]", serializedVersion)[:2])
18-
if selfMajor >= otherMajor:
19+
if self_major >= other_major:
1920
return True
20-
elif selfMinor >= otherMinor:
21+
elif self_minor >= other_minor:
2122
return True
2223
else:
2324
return False

pyproject.toml

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
[build-system]
2+
requires = ["setuptools"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "histogrammar"
7+
description = "Composable histogram primitives for distributed data reduction"
8+
keywords = [
9+
"pandas",
10+
"spark",
11+
"data-science",
12+
"data-analysis",
13+
"statistics",
14+
"python",
15+
"jupyter",
16+
"ipython"
17+
]
18+
readme = "README.rst"
19+
requires-python = ">=3.9"
20+
authors = [{ name = "Jim Pivarski (DIANA-HEP)", email = "[email protected]" }, { name = "Max Baak", email = "[email protected]" }]
21+
maintainers = [{ name = "Max Baak", email = "[email protected]" }]
22+
license = { type = "Apache Software License v2", file = "LICENSE" }
23+
dependencies = [
24+
"numpy",
25+
"tqdm",
26+
"joblib>=0.14.0"
27+
]
28+
classifiers = ["Development Status :: 5 - Production/Stable",
29+
"Environment :: Console",
30+
"Intended Audience :: Science/Research",
31+
"License :: OSI Approved :: Apache Software License",
32+
"Topic :: Scientific/Engineering :: Information Analysis",
33+
"Topic :: Scientific/Engineering :: Mathematics",
34+
"Topic :: Scientific/Engineering :: Physics",
35+
]
36+
dynamic = ["version"]
37+
38+
[project.optional-dependencies]
39+
pandas = [
40+
"pandas"
41+
]
42+
spark = [
43+
"pyspark>=3.1; python_version <= '3.11'",
44+
]
45+
test = [
46+
"ipykernel>=5.1.3",
47+
"jupyter_client>=5.2.3",
48+
"matplotlib",
49+
"pandas",
50+
"pre-commit>=2.9.0",
51+
"pytest-notebook>=0.6.1",
52+
"pytest>=4.0.2",
53+
]
54+
test_numpy_pre2 = [
55+
"numpy<2",
56+
"pandas<2",
57+
]
58+
59+
# files to be shipped with the installation, under: histogrammar/test_data and histogrammar/notebooks
60+
# after installation, these can be found with the functions in resources.py
61+
[tool.setuptools.package-data]
62+
histogrammar = [
63+
"test_data/*.csv.gz",
64+
"test_data/*.json*",
65+
"notebooks/*tutorial*.ipynb",
66+
]
67+
68+
[project.urls]
69+
repository = "https://github.com/histogrammar/histogrammar-python"
70+
71+
[tool.semantic_release]
72+
version_variable = [
73+
"histogrammar/version.py:version",
74+
]
75+
build_command = "pip install build && python -m build"
76+
77+
[tool.setuptools.dynamic]
78+
version = { attr = "histogrammar.version.version" }

requirements-test.txt

-7
This file was deleted.

requirements.txt

-3
This file was deleted.

setup.py

-137
This file was deleted.

0 commit comments

Comments
 (0)