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

* Switch from setup.py to pyproject.toml #68

Merged
merged 5 commits into from
Dec 16, 2024
Merged
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
52 changes: 31 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,37 @@ jobs:
test:
strategy:
matrix:
os: [ubuntu-latest]
python: ['3.9', '3.10', '3.11', '3.12']
os: [ ubuntu-latest ]
python: [ "3.9", "3.10", "3.11", "3.12" ]
numpy_version: [ "numpy-latest", "numpy<2" ]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/requirements-test.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -r requirements-test.txt
- name: Test with pytest
run: |
pytest tests/
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}

- name: Use cache for pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ "${{ matrix.numpy_version }}" = "numpy<2" ]; then
pip install ".[test,pandas,spark,test_numpy_pre2]"
else
pip install ".[test,pandas,spark]"
fi

- name: Test with pytest
run: |
pytest tests
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Version 1.0.34, Dec 2024
* Remove unused test_gpu.twosigfigs function.
* Refactor tests with Numpy() and Pandas() context managers to use single 'with' statement.

* Switch from setup.py to pyproject.toml
* Add numpy<2,pandas<2 test environment to build pipeline test matrix

Version 1.0.33, Dec 2022
------------------------
* fix of get_sub_hist() when Bin histogram is filled only with nans.
Expand Down
27 changes: 14 additions & 13 deletions histogrammar/version.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
"""THIS FILE IS AUTO-GENERATED BY SETUP.PY."""

import re
from typing import Tuple

name = "histogrammar"
__version__ = "1.0.34"
version = "1.0.34"
full_version = "1.0.34"
release = True

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

def split_version_string(version_string: str) -> Tuple[int, int]:
version_numbers = list(map(int, re.split(r"[-.]", version_string)))
return version_numbers[0], version_numbers[1]


specification = ".".join([str(i) for i in split_version_string(version)[:2]])


def compatible(serialized_version: str) -> bool:
self_major, self_minor = split_version_string(version)
other_major, other_minor = split_version_string(serialized_version)

def compatible(serializedVersion):
selfMajor, selfMinor = map(int, version_info[:2])
otherMajor, otherMinor = map(int, re.split(r"[-\.]", serializedVersion)[:2])
if selfMajor >= otherMajor:
if self_major >= other_major:
return True
elif selfMinor >= otherMinor:
elif self_minor >= other_minor:
return True
else:
return False
78 changes: 78 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "histogrammar"
description = "Composable histogram primitives for distributed data reduction"
keywords = [
"pandas",
"spark",
"data-science",
"data-analysis",
"statistics",
"python",
"jupyter",
"ipython"
]
readme = "README.rst"
requires-python = ">=3.9"
authors = [{ name = "Jim Pivarski (DIANA-HEP)", email = "[email protected]" }, { name = "Max Baak", email = "[email protected]" }]
maintainers = [{ name = "Max Baak", email = "[email protected]" }]
license = { type = "Apache Software License v2", file = "LICENSE" }
dependencies = [
"numpy",
"tqdm",
"joblib>=0.14.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that joblib is no longer used. Can you remove it?

]
classifiers = ["Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Physics",
]
dynamic = ["version"]

[project.optional-dependencies]
pandas = [
"pandas"
]
spark = [
"pyspark>=3.1; python_version <= '3.11'",
]
test = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the optional dependencies:
`pandas = [
"pandas"
]

spark = [
"pyspark>=3.1; python_version <= '3.11'",
]
`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

"ipykernel>=5.1.3",
"jupyter_client>=5.2.3",
"matplotlib",
"pandas",
"pre-commit>=2.9.0",
"pytest-notebook>=0.6.1",
"pytest>=4.0.2",
]
test_numpy_pre2 = [
"numpy<2",
"pandas<2",
]

# files to be shipped with the installation, under: histogrammar/test_data and histogrammar/notebooks
# after installation, these can be found with the functions in resources.py
[tool.setuptools.package-data]
histogrammar = [
"test_data/*.csv.gz",
"test_data/*.json*",
"notebooks/*tutorial*.ipynb",
]

[project.urls]
repository = "https://github.com/histogrammar/histogrammar-python"

[tool.semantic_release]
version_variable = [
"histogrammar/version.py:version",
]
build_command = "pip install build && python -m build"

[tool.setuptools.dynamic]
version = { attr = "histogrammar.version.version" }
7 changes: 0 additions & 7 deletions requirements-test.txt

This file was deleted.

3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

137 changes: 0 additions & 137 deletions setup.py

This file was deleted.

Loading