From 6842576f1808c877994a69a9fd0a94176ad2ea9a Mon Sep 17 00:00:00 2001 From: Maximilian Linhoff Date: Tue, 21 Nov 2023 11:29:47 +0100 Subject: [PATCH 1/3] Move most options to pyproject.toml, fix MANIFEST --- MANIFEST.in | 3 ++- pyproject.toml | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 47 ------------------------------------- setup.py | 20 ---------------- 4 files changed, 65 insertions(+), 68 deletions(-) delete mode 100644 setup.cfg diff --git a/MANIFEST.in b/MANIFEST.in index 545f7c3..6a23547 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,2 @@ -prune eventio/_dev_version +prune src/eventio/_dev_version +prune tests diff --git a/pyproject.toml b/pyproject.toml index 3660e81..3b71d04 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,66 @@ [build-system] requires = ["setuptools>=64", "Cython", "numpy>=1.25", 'setuptools_scm[toml]>=8'] build-backend = "setuptools.build_meta" + +[project] +name = "eventio" +description = "Python read-only implementation of the EventIO file format" + +requires-python = '>=3.9' +dependencies = [ + 'numpy >= 1.21', + 'corsikaio ~= 0.3.3', + 'zstandard > 0.11.1', # memory leak in zstandard 0.11.1 + 'setuptools_scm', +] + +authors = [ + {name = "Maximilian Linhoff", email = "maximilian.linhoff@tu-dortmund.de"}, + {name = "Dominik Neise", email = "dominik.neise@cta-observatory.org"}, + {name = "Orel Gueta", email = "orel.gueta@desy.de"}, +] +license = {text = "MIT"} +readme = "README.rst" + +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3 :: Only", + "Topic :: Scientific/Engineering :: Astronomy", + "Topic :: Scientific/Engineering :: Physics", +] + +dynamic = ["version"] + +[project.urls] +repository = "https://github.com/cta-observatory/pyeventio" +issues = "https://github.com/cta-observatory/pyeventio/issues" +conda-forge = "https://anaconda.org/conda-forge/eventio" + +[project.scripts] +eventio_print_structure = 'eventio.scripts.print_structure:main' +eventio_print_simtel_history = 'eventio.scripts.print_simtel_history:main' +eventio_print_simtel_metaparams = 'eventio.scripts.print_simtel_metaparams:main' +eventio_plot_histograms = 'eventio.scripts.plot_hists:main' +eventio_print_object_information = 'eventio.scripts.print_object_information:main' +eventio_cut_file = 'eventio.scripts.cut_eventio_file:main' + +[tool.setuptools.packages.find] +where = ["src"] +exclude = ["eventio._dev_version"] + +[tool.setuptools_scm] +version_file = "src/eventio/_version.py" + + +[tool.pytest] +addopts = "-v --durations=10" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index bd67cc0..0000000 --- a/setup.cfg +++ /dev/null @@ -1,47 +0,0 @@ -[metadata] - -name = eventio -description = Python read-only implementation of the EventIO file format -author = Dominik Neise, Maximilian Noethe -author_email = maximilian.noethe@tu-dortmund.de -license = MIT - -long_description = file: README.rst -long_description_content_type = text/x-rst - -url = https://github.com/cta-observatory/pyeventio -project_urls = - Source = https://github.com/cta-observatory/pyeventio - Tracker = https://github.com/cta-observatory/pyeventio/issues - Download = https://pypi.org/project/eventio/#files - Conda-Forge = https://anaconda.org/conda-forge/eventio - -classifiers = - Development Status :: 5 - Production/Stable - Intended Audience :: Science/Research - License :: OSI Approved :: MIT License - Natural Language :: English - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.12 - Programming Language :: Python :: 3 :: Only - Topic :: Scientific/Engineering :: Astronomy - Topic :: Scientific/Engineering :: Physics -addopts = -v --durations=10 - -[options] -packages = find: - -[options.packages.find] -where = src -exclude = eventio._dev_version - - -[aliases] -test=pytest - -[tool:pytest] diff --git a/setup.py b/setup.py index 281c623..830caf0 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ from setuptools import setup, Extension -import os from Cython.Build import cythonize import numpy as np @@ -33,24 +32,5 @@ ] setup( - use_scm_version={"write_to": os.path.join("src", "eventio", "_version.py")}, ext_modules=cythonize(extensions), - python_requires='>=3.9', - install_requires=[ - 'numpy >= 1.21', - 'corsikaio ~= 0.3.3', - 'zstandard > 0.11.1', # memory leak in zstandard 0.11.1 - 'setuptools_scm', - ], - entry_points={ - 'console_scripts': [ - 'eventio_print_structure = eventio.scripts.print_structure:main', - 'eventio_print_simtel_history = eventio.scripts.print_simtel_history:main', - 'eventio_print_simtel_metaparams = eventio.scripts.print_simtel_metaparams:main', - 'eventio_plot_histograms = eventio.scripts.plot_hists:main', - 'eventio_print_object_information = eventio.scripts.print_object_information:main', - 'eventio_cut_file = eventio.scripts.cut_eventio_file:main', - ] - }, - tests_require=['pytest>=3.0.0'], ) From e9b34b5ba02c24193348d57f18d1e8631d3acd25 Mon Sep 17 00:00:00 2001 From: Maximilian Linhoff Date: Fri, 17 Nov 2023 10:35:39 +0100 Subject: [PATCH 2/3] Add cibuildwheel config --- .github/workflows/deploy.yml | 71 +++++++++++++++++++++++++++++++----- 1 file changed, 62 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a44266d..aa69a75 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -6,27 +6,80 @@ on: - 'v*' jobs: - deploy: - runs-on: ubuntu-latest + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04, windows-2019, macOS-11] + steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + + - uses: actions/setup-python@v4 + + - name: Install cibuildwheel + run: python -m pip install cibuildwheel - # make sure we have version info - - run: git fetch --tags + - name: Build wheels + run: python -m cibuildwheel --output-dir dist/ + env: + # only build cpython + CIBW_BUILD: "cp*" + # exclude 32 bit and musl architectures to reduce build time + # these shouldn't be needed + CIBW_SKIP: "*-win32 *-manylinux_i686 *musllinux*" + + - uses: actions/upload-artifact@v3 + with: + path: ./dist/*.whl + name: wheels + + build_sdist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: 3.9 - - name: Install dependencies + - name: Build sdist run: | python --version pip install -U build python -m build --sdist + - uses: actions/upload-artifact@v3 + with: + path: ./dist/*.tar.gz + name: sdist + + pypi_upload: + runs-on: ubuntu-latest + needs: + - build_wheels + - build_sdist + steps: + - name: Download artifacts + uses: actions/download-artifact@v3 + + - name: preparing upload + run: | + ls -l wheels sdist + mkdir dist + cp wheels/* sdist/* dist/ + - name: Publish package - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1 + with: user: __token__ password: ${{ secrets.pypi_password }} From 31a2692c92f1ea832683ac5a7e012fd71050efee Mon Sep 17 00:00:00 2001 From: Maximilian Linhoff Date: Tue, 21 Nov 2023 10:37:55 +0100 Subject: [PATCH 3/3] Update action versions in CI config --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76a740a..4be1bd2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,12 +21,12 @@ jobs: matrix: python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} @@ -44,4 +44,4 @@ jobs: run: | pytest --cov=eventio --cov-report=xml - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v3