From a0085207d2a6965841810292b56ca9137eba4dc2 Mon Sep 17 00:00:00 2001 From: Luigi Pertoldi Date: Wed, 28 Feb 2024 11:20:38 +0100 Subject: [PATCH 1/4] Update citation-related docs --- CITATION.cff | 4 ++-- README.md | 14 +++++++++++--- docs/source/index.rst | 1 + 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 9782d1ac8..90524f881 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,7 +1,7 @@ cff-version: 1.2.0 title: pygama -doi: FILLME -date-released: 2024-02-01 +doi: https://doi.org/10.5281/zenodo.10614246 +date-released: 2024-02-03 url: https://github.com/github-linguist/linguist message: "If you use this software, please cite it as below." authors: diff --git a/README.md b/README.md index 54fecb59d..8abf4f7e5 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ [![GitHub pull requests](https://img.shields.io/github/issues-pr/legend-exp/pygama?logo=github)](https://github.com/legend-exp/pygama/pulls) [![License](https://img.shields.io/github/license/legend-exp/pygama)](https://github.com/legend-exp/pygama/blob/main/LICENSE) [![Read the Docs](https://img.shields.io/readthedocs/pygama?logo=readthedocs)](https://pygama.readthedocs.io) +[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10614246.svg)](https://zenodo.org/doi/10.5281/zenodo.10614246) *pygama* is a Python package for: @@ -28,7 +29,14 @@ Check out the [online documentation](https://pygama.readthedocs.io). +If you are using this software, consider +[citing](https://zenodo.org/doi/10.5281/zenodo.10614246)! + ## Related repositories -- [legend-exp/legend-pydataobj](https://github.com/legend-exp/legend-pydataobj) → LEGEND Python Data Objects -- [legend-exp/legend-daq2lh5](https://github.com/legend-exp/legend-daq2lh5) → Convert digitizer data to LEGEND HDF5 -- [legend-exp/dspeed](https://github.com/legend-exp/dspeed) → Fast Digital Signal Processing for particle detector signals in Python + +- [legend-exp/legend-pydataobj](https://github.com/legend-exp/legend-pydataobj) + → LEGEND Python Data Objects +- [legend-exp/legend-daq2lh5](https://github.com/legend-exp/legend-daq2lh5) + → Convert digitizer data to LEGEND HDF5 +- [legend-exp/dspeed](https://github.com/legend-exp/dspeed) + → Fast Digital Signal Processing for particle detector signals in Python diff --git a/docs/source/index.rst b/docs/source/index.rst index e3972f81f..cf78de997 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -65,5 +65,6 @@ Next steps Source Code License + Citation Changelog developer From db324ffb8e5181d8f67dc39d2231e596ff2b7990 Mon Sep 17 00:00:00 2001 From: Luigi Pertoldi Date: Wed, 28 Feb 2024 11:22:08 +0100 Subject: [PATCH 2/4] [ci] update workflow files --- .github/workflows/distribution.yml | 49 ++++++++++++++++-------------- .github/workflows/main.yml | 7 +++-- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/.github/workflows/distribution.yml b/.github/workflows/distribution.yml index 63e9c51e7..61aa724a4 100644 --- a/.github/workflows/distribution.yml +++ b/.github/workflows/distribution.yml @@ -2,42 +2,47 @@ name: distribute on: workflow_dispatch: + pull_request: push: - tags: "v*" + branches: + - main release: types: - published -jobs: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + FORCE_COLOR: 3 +jobs: dist: + name: Distribution build runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Build SDist and wheel - run: pipx run build - - - uses: actions/upload-artifact@v4 - with: - path: dist/* + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - - name: Check metadata - run: pipx run twine check dist/* + - uses: hynek/build-and-inspect-python-package@v2 publish: needs: [dist] + name: Publish to PyPI + environment: pypi + permissions: + id-token: write runs-on: ubuntu-latest if: github.event_name == 'release' && github.event.action == 'published' steps: - - uses: actions/download-artifact@v4 - with: - name: artifact - path: dist - - - uses: pypa/gh-action-pypi-publish@v1.8.11 - with: - password: ${{ secrets.pypi_password }} + - uses: actions/download-artifact@v4 + with: + name: Packages + path: dist + + - uses: pypa/gh-action-pypi-publish@release/v1 + if: github.event_name == 'release' && github.event.action == 'published' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 24b9bfbd8..76eb5c78b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,18 +1,19 @@ name: pygama on: + workflow_dispatch: + pull_request: push: branches: - main - - 'releases/**' - pull_request: - release: + - "releases/**" concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true env: + FORCE_COLOR: 3 TQDM_MININTERVAL: 100 jobs: From 3dccd974764e976e0c1decbdfa2db853e135c431 Mon Sep 17 00:00:00 2001 From: Luigi Pertoldi Date: Wed, 28 Feb 2024 11:26:37 +0100 Subject: [PATCH 3/4] Update subpackage descriptions to silence wheel checking failure in CI --- src/pygama/math/__init__.py | 2 +- src/pygama/pargen/__init__.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pygama/math/__init__.py b/src/pygama/math/__init__.py index cca7a6038..93b88f477 100644 --- a/src/pygama/math/__init__.py +++ b/src/pygama/math/__init__.py @@ -1,3 +1,3 @@ """ -Subpackage description +Statistical and mathematical utilities. """ diff --git a/src/pygama/pargen/__init__.py b/src/pygama/pargen/__init__.py index cca7a6038..3dcede5b7 100644 --- a/src/pygama/pargen/__init__.py +++ b/src/pygama/pargen/__init__.py @@ -1,3 +1,4 @@ """ -Subpackage description +Utilities to generate and optimize parameters of interest from data (e.g. +calibration routines) """ From d7d3c8183faf9294440173dd010703e1f51cde82 Mon Sep 17 00:00:00 2001 From: Luigi Pertoldi Date: Wed, 28 Feb 2024 11:44:00 +0100 Subject: [PATCH 4/4] [setup] transition to pure pyproject.toml --- .pre-commit-config.yaml | 1 + pyproject.toml | 113 ++++++++++++++++++++++++++++++++++++++-- setup.cfg | 86 ------------------------------ setup.py | 4 -- 4 files changed, 111 insertions(+), 93 deletions(-) delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f0bc4718d..02ffb3e94 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -70,6 +70,7 @@ repos: flake8-print, pep8-naming ] + args: ["--extend-ignore", "E203,E501"] - repo: https://github.com/kynan/nbstripout rev: "0.6.1" diff --git a/pyproject.toml b/pyproject.toml index 1dcd76af8..8f759a09d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,14 +1,121 @@ [build-system] requires = [ - "setuptools>=42.0.0", - "setuptools_scm[toml]>=3.4", + "setuptools>=61.2", + "setuptools_scm[toml]>=7", ] - build-backend = "setuptools.build_meta" +[project] +name = "pygama" +description = "Python package for data processing and analysis" +authors = [ + { name = "The LEGEND collaboration" }, +] +maintainers = [ + { name = "The LEGEND collaboration" }, +] +readme = "README.md" +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Operating System :: MacOS", + "Operating System :: POSIX", + "Operating System :: Unix", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Topic :: Scientific/Engineering", +] +requires-python = ">=3.9" +dependencies = [ + "colorlog", + "dspeed>=1.3.0a4", + "h5py>=3.2", + "iminuit", + "legend-daq2lh5>=1.2.0a1", + "legend-pydataobj>=1.5.0a5", + "matplotlib", + "numba!=0.53.*,!=0.54.*,!=0.57", + "numpy>=1.21", + "pandas>=1.4.4", + "pint", + "scikit-learn", + "scipy>=1.0.1", + "tables", + "tqdm>=4.27", +] +dynamic = [ + "version", +] + +[project.urls] +Homepage = "https://github.com/legend-exp/pygama" +"Bug Tracker" = "https://github.com/legend-exp/pygama/issues" +Discussions = "https://github.com/legend-exp/pygama/discussions" +Changelog = "https://github.com/legend-exp/pygama/releases" + [tool.setuptools_scm] write_to = "src/pygama/_version.py" +[project.optional-dependencies] +all = [ + "pygama[docs,test]", +] +docs = [ + "furo", + "jupyter", + "myst-parser", + "nbsphinx", + "sphinx", + "sphinx-copybutton", + "sphinx-inline-tabs", +] +test = [ + "pre-commit", + "pylegendtestdata", + "pytest>=6.0", + "pytest-cov", +] + +[project.scripts] +pygama = "pygama.cli:pygama_cli" + +[tool.setuptools] +include-package-data = true +zip-safe = false +license-files = [ + "LICENSE", +] + +[tool.setuptools.package-dir] +"" = "src" + +[tool.setuptools.packages.find] +where = [ + "src", +] +namespaces = false + +[tool.setuptools.package-data] +"*" = [ + "*.json", +] + +[tool.coverage] +run.source = ["pygama"] +report.exclude_also = [ + '\.\.\.', + 'if typing.TYPE_CHECKING:', +] + +[tool.flake8] +extend-ignore = "E203, E501" + +[tool.codespell] +ignore-words-list = "hist, gaus, nd, ans, crate, nin, puls, spms, fom" + [tool.pytest.ini_options] minversion = "6.0" addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 9d3080bbc..000000000 --- a/setup.cfg +++ /dev/null @@ -1,86 +0,0 @@ -[metadata] -name = pygama -description = Python package for decoding and processing digitizer data -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/legend-exp/pygama -author = The LEGEND collaboration -maintainer = The LEGEND collaboration -license = GPL-3.0 -license_files = LICENSE -classifiers = - Development Status :: 4 - Beta - Intended Audience :: Developers - Intended Audience :: Information Technology - Intended Audience :: Science/Research - License :: OSI Approved :: GNU General Public License v3 (GPLv3) - Operating System :: MacOS - Operating System :: POSIX - Operating System :: Unix - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Topic :: Scientific/Engineering - Topic :: Scientific/Engineering :: Information Analysis - Topic :: Scientific/Engineering :: Mathematics - Topic :: Scientific/Engineering :: Physics - Topic :: Software Development -project_urls = - Documentation = https://pygama.readthedocs.io - -[options] -packages = find: -install_requires = - colorlog - dspeed>=1.3.0a4 - h5py>=3.2 - iminuit - legend-daq2lh5>=1.2.0a1 - legend-pydataobj>=1.5.0a5 - matplotlib - numba!=0.53.*,!=0.54.*,!=0.57 - numpy>=1.21 - pandas>=1.4.4 - pint - scikit-learn - scipy>=1.0.1 - tables - tqdm>=4.27 -python_requires = >=3.9 -include_package_data = True -package_dir = - = src -zip_safe = False - -[options.packages.find] -where = src - -[options.entry_points] -console_scripts = - pygama = pygama.cli:pygama_cli - -[options.extras_require] -all = - pygama[docs,test] -docs = - furo - jupyter - myst-parser - nbsphinx - sphinx - sphinx-copybutton - sphinx-inline-tabs -test = - pre-commit - pylegendtestdata - pytest>=6.0 - pytest-cov - -[options.package_data] -* = *.json - -[flake8] -extend-ignore = E203, E501 - -[codespell] -ignore-words-list = hist, gaus, nd, ans, crate, nin, puls, spms, fom diff --git a/setup.py b/setup.py deleted file mode 100644 index f6844919c..000000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -import setuptools_scm # noqa: F401 -from setuptools import setup - -setup()