diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index e53330e..e1cca34 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -8,48 +8,180 @@ on: types: - published +concurrency: + group: "${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}" + cancel-in-progress: false + +defaults: + run: + shell: bash -l {0} + + jobs: - testpypi_push: - environment: - name: deploy - url: https://test.pypi.org/p/GridDataFormats - permissions: - id-token: write - if: | - github.repository == 'MDAnalysis/GridDataFormats' && - (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) - name: Build, upload and test pure Python wheels to TestPypi + build: + name: Build package runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.14" + + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + pip install build twine + + - name: Build package (binary wheel and source distribution package) + run: | + python -m build + + - name: Check package + run: | + twine check dist/* + - name: Upload dist files + uses: actions/upload-artifact@v4 + with: + name: dist-files + path: dist/ + retention-days: 1 + + test-pytest: + name: Run tests + runs-on: ubuntu-latest + needs: build steps: - - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.14" - - name: testpypi_deploy - uses: MDAnalysis/pypi-deployment@main - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + - name: Download dist files + uses: actions/download-artifact@v4 with: - test_submission: true - package_name: GridDataFormats - module_name: 'gridData' + name: dist-files + path: dist/ - pypi_push: + - name: Install package with test dependencies and tests + run: | + python -m pip install --upgrade pip + WHEEL_FILE=$(ls dist/*.whl) + pip install "$WHEEL_FILE"[test] + + - name: Test import + run: | + python -c "import gridData; print(f'Package {gridData.__version__} imported successfully')" + + - name: Run basic tests + run: | + pytest --verbose --pyargs gridData + + deploy-testpypi: + name: Deploy to TestPyPI + runs-on: ubuntu-latest + needs: [build, test-pytest] + if: | + github.repository == 'MDAnalysis/GridDataFormats' && + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) environment: - name: deploy - url: https://pypi.org/p/GridDataFormats + name: testpypi + url: https://test.pypi.org/p/GridDataFormats permissions: - id-token: write + id-token: write # IMPORTANT: mandatory for trusted publishing + steps: + - name: Download dist files + uses: actions/download-artifact@v4 + with: + name: dist-files + path: dist/ + + - name: Publish to TestPyPI + uses: pypa/gh-action-pypi-publish@v1.13.0 + with: + repository-url: https://test.pypi.org/legacy/ + + deploy-pypi: + name: Deploy to PyPI + runs-on: ubuntu-latest + needs: [build, test-pytest] if: | github.repository == 'MDAnalysis/GridDataFormats' && (github.event_name == 'release' && github.event.action == 'published') - name: Build, upload and test pure Python wheels to PyPi - runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/GridDataFormats + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + steps: + - name: Download dist files + uses: actions/download-artifact@v4 + with: + name: dist-files + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@v1.13.0 + test-deployed-testpypi: + name: Test deployed package (TestPyPI) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + needs: deploy-testpypi + if: | + github.repository == 'MDAnalysis/GridDataFormats' && + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) steps: - - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.14" + + - name: Install from TestPyPI + run: | + python -m pip install --upgrade pip + pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ GridDataFormats[test] - - name: pypi_deploy - uses: MDAnalysis/pypi-deployment@main - if: github.event_name == 'release' && github.event.action == 'published' + - name: Test import + run: | + python -c "import gridData; print(f'Package {gridData.__version__} imported successfully from TestPyPi')" + + - name: Run basic tests + run: | + pytest --verbose --pyargs gridData + + test-deployed-pypi: + name: Test deployed package (PyPI) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + needs: deploy-pypi + if: | + github.repository == 'MDAnalysis/GridDataFormats' && + (github.event_name == 'release' && github.event.action == 'published') + steps: + - name: Set up Python + uses: actions/setup-python@v5 with: - package_name: GridDataFormats - module_name: 'gridData' + python-version: "3.14" + + - name: Install from PyPI + run: | + python -m pip install --upgrade pip + pip install GridDataFormats[test] + + - name: Test import + run: | + python -c "import gridData; print(f'Package {gridData.__version__} imported successfully from PyPi')" + + - name: Run basic tests + run: | + pytest --verbose --pyargs gridData diff --git a/CHANGELOG b/CHANGELOG index d193c8f..f3b2700 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -13,7 +13,7 @@ The rules for this file: * accompany each entry with github issue/PR number (Issue #xyz) ------------------------------------------------------------------------------- -01/16/2026 IAlibay, ollyfutur, conradolandia, orbeckst, PlethoraChutney, +01/22/2026 IAlibay, ollyfutur, conradolandia, orbeckst, PlethoraChutney, Pradyumn-cloud * 1.1.0 @@ -24,10 +24,11 @@ The rules for this file: (issue #143) * Python 3.13 and 3.14 are now supported (PR #140) * Support for Python 3.9 and 3.10 is now dropped as per SPEC0 (PR #140) + * all tests and data files are now included in the distribution (#156) Enhancements - * `Grid` now accepts binary operations with any operand that can be + * `Grid` now accepts binary operations with any operand that can be broadcasted to the grid's shape according to `numpy` broadcasting rules (PR #142) * `Grid` now allows forcing MRC/CCP4 maps to be read as volumes even when @@ -38,6 +39,7 @@ The rules for this file: * Attempting binary operations on grids with different edges now raises an exception (PR #142) + * updated metadata license identifier (#155) 10/21/2023 IAlibay, orbeckst, lilyminium diff --git a/MANIFEST.in b/MANIFEST.in index f17a4a7..1ddb7ab 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ include README.rst INSTALL CHANGELOG COPYING COPYING.LESSER AUTHORS -include setup.py + diff --git a/pyproject.toml b/pyproject.toml index 60dbce0..4f9bcf0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,8 @@ build-backend = "setuptools.build_meta" [project] name = "GridDataFormats" description = "Reading and writing of data on regular grids in Python" -license = {file = "COPYING.LESSER" } +license = "LGPL-3.0-or-later" +license-files = ["COPYING", "COPYING.LESSER", "AUTHORS"] authors = [ {name = "Oliver Beckstein", email = "orbeckst@gmail.com"}, ] @@ -19,7 +20,6 @@ classifiers = [ "Development Status :: 6 - Mature", "Environment :: Console", "Intended Audience :: Science/Research", - "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", "Operating System :: POSIX", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", @@ -60,18 +60,18 @@ documentation = "https://www.mdanalysis.org/GridDataFormats/" [tool.setuptools] zip-safe = true -include-package-data = true [tool.setuptools.packages.find] namespaces = false -include=["gridData"] -exclude=["devtools", "doc", "ci", "examples"] +include = ["gridData", "gridData.tests", "gridData.tests.datafiles"] +exclude = ["devtools", "doc", "ci", "examples"] [tool.setuptools.package-data] gridData = [ "tests/datafiles/*.dx", "tests/datafiles/*.dx.gz", "tests/datafiles/*.ccp4", + "tests/datafiles/*.mrc", "tests/datafiles/*.plt", "tests/datafiles/*.bz2", ]