diff --git a/.github/workflows/wipac-cicd.yaml b/.github/workflows/wipac-cicd.yaml index f43025e..76c703a 100644 --- a/.github/workflows/wipac-cicd.yaml +++ b/.github/workflows/wipac-cicd.yaml @@ -9,6 +9,26 @@ on: jobs: + ########################################################################### + # PACKAGING + ########################################################################### + + py-setup: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + - uses: WIPACrepo/wipac-dev-py-setup-action@v4.2 + with: + python_min: 3.9 + pypi_name: icecube-simprod-histograms + author: IceCube + author_email: developers@icecube.wisc.edu + keywords: | + "histogram sampling" simulation statistics + + ########################################################################### # LINTERS ########################################################################### @@ -90,7 +110,7 @@ jobs: with: python-version: ${{ matrix.py3 }} - run: | - pip install -r requirements-tests.txt + pip install .[tests] - name: Run unit tests run: | pytest -vvv tests/unit/ @@ -101,14 +121,25 @@ jobs: release: if: github.ref == 'refs/heads/main' - needs: [ flake8, mypy, code-format, unit-tests ] + needs: [ py-setup, flake8, mypy, code-format, unit-tests ] runs-on: ubuntu-latest + concurrency: release # prevent any possible race conditions steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - name: Python Semantic Release - uses: python-semantic-release/python-semantic-release@v7.34.6 + # Python-Package Version Bump + - uses: python-semantic-release/python-semantic-release@v9.8.1 + id: psr-psr + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + # PyPI Release + - uses: pypa/gh-action-pypi-publish@v1.8.14 + if: steps.psr-psr.outputs.released == 'true' + with: + password: ${{ secrets.PYPI_TOKEN }} + # GitHub Release + - uses: python-semantic-release/upload-to-gh-release@v9.8.1 + if: steps.psr-psr.outputs.released == 'true' with: github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 7447e89..2c20cd0 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ + +[![PyPI](https://img.shields.io/pypi/v/icecube-simprod-histograms)](https://pypi.org/project/icecube-simprod-histograms/) [![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/icecube/simprod-histogram?include_prereleases)](https://github.com/icecube/simprod-histogram/) [![Versions](https://img.shields.io/pypi/pyversions/icecube-simprod-histograms.svg)](https://pypi.org/project/icecube-simprod-histograms) [![PyPI - License](https://img.shields.io/pypi/l/icecube-simprod-histograms)](https://github.com/icecube/simprod-histogram/blob/main/LICENSE) [![GitHub issues](https://img.shields.io/github/issues/icecube/simprod-histogram)](https://github.com/icecube/simprod-histogram/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aopen) [![GitHub pull requests](https://img.shields.io/github/issues-pr/icecube/simprod-histogram)](https://github.com/icecube/simprod-histogram/pulls?q=is%3Apr+sort%3Aupdated-desc+is%3Aopen) + # simprod-histogram Utilities for working with histograms created for simprod diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c9d1e74 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,48 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +version = "0.0.0" +dependencies = ["h5py"] +name = "icecube-simprod-histograms" +description = "Utilities for working with histograms created for simprod" +readme = "README.md" +keywords = ["histogram sampling", "simulation", "statistics"] +classifiers = ["Development Status :: 3 - Alpha", "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"] +requires-python = ">=3.9, <3.14" + +[[project.authors]] +name = "IceCube" +email = "developers@icecube.wisc.edu" + +[project.license] +file = "LICENSE" + +[project.optional-dependencies] +tests = ["h5py", "pytest", "matplotlib"] +mypy = ["h5py", "pytest", "matplotlib"] +display = ["h5py", "matplotlib"] + +[project.urls] +Homepage = "https://pypi.org/project/icecube-simprod-histograms/" +Tracker = "https://github.com/icecube/simprod-histogram/issues" +Source = "https://github.com/icecube/simprod-histogram" + +[tool.semantic_release] +version_toml = ["pyproject.toml:project.version"] +version_variables = [] +commit_parser = "emoji" +build_command = "pip install build && python -m build" + +[tool.semantic_release.commit_parser_options] +major_tags = ["[major]"] +minor_tags = ["[minor]", "[feature]"] +patch_tags = ["[patch]", "[fix]", " ", "!", "#", "$", "%", "&", "'", "(", ")", "*", "+", "-", ".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "?", "@", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "[", "]", "^", "_", "`", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "{", "|", "}", "~"] + +[tool.setuptools.package-data] +"*" = ["py.typed"] + +[tool.setuptools.packages.find] +namespaces = false +exclude = ["test", "tests", "doc", "docs", "resource", "resources", "example", "examples"] diff --git a/requirements-display.txt b/requirements-display.txt deleted file mode 100644 index 5a23915..0000000 --- a/requirements-display.txt +++ /dev/null @@ -1,2 +0,0 @@ -h5py -matplotlib diff --git a/requirements-tests.txt b/requirements-tests.txt deleted file mode 100644 index ce32e75..0000000 --- a/requirements-tests.txt +++ /dev/null @@ -1,3 +0,0 @@ -h5py -pytest -matplotlib diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index c5a4eac..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -h5py diff --git a/scripts/py.typed b/scripts/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..d649009 --- /dev/null +++ b/setup.py @@ -0,0 +1,3 @@ +from setuptools import setup # type: ignore[import] + +setup()