From 3955f7d551fe11432e061a2c98a83adaad0ed0ed Mon Sep 17 00:00:00 2001 From: Rutger van Haasteren Date: Wed, 8 Nov 2023 17:05:04 +0100 Subject: [PATCH 01/13] Included a macro to avoid the NUMPY deprecation warnings --- fastshermanmorrison/cython_fastshermanmorrison.pyx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fastshermanmorrison/cython_fastshermanmorrison.pyx b/fastshermanmorrison/cython_fastshermanmorrison.pyx index dc8095b..84a6317 100644 --- a/fastshermanmorrison/cython_fastshermanmorrison.pyx +++ b/fastshermanmorrison/cython_fastshermanmorrison.pyx @@ -1,3 +1,10 @@ +# cython: language_level=3 + +# Define this before importing from numpy +cdef extern from "numpy/arrayobject.h": + #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION + pass + cimport numpy as np import numpy as np np.import_array() From 4da91df0b35f47df407d27fc5055a3cf3649e654 Mon Sep 17 00:00:00 2001 From: Rutger van Haasteren Date: Wed, 8 Nov 2023 17:07:01 +0100 Subject: [PATCH 02/13] Changed the dist directory in ci_test.yml --- .github/workflows/ci_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml index 4881049..de7618e 100644 --- a/.github/workflows/ci_test.yml +++ b/.github/workflows/ci_test.yml @@ -98,7 +98,7 @@ jobs: uses: actions/download-artifact@v3 with: name: dist - path: ./ + path: ./dist/ - name: List files in dist run: echo "Content of dist:" && ls -lah dist/ && echo "Content of ./:" && ls -lah ./ - name: Publish to PyPI From c8c84704d7b326804ac13a5a05f83a126fbbc4eb Mon Sep 17 00:00:00 2001 From: Rutger van Haasteren Date: Wed, 8 Nov 2023 17:14:09 +0100 Subject: [PATCH 03/13] Changed the fix for the numpy api deprecation warnings --- fastshermanmorrison/cython_fastshermanmorrison.pyx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fastshermanmorrison/cython_fastshermanmorrison.pyx b/fastshermanmorrison/cython_fastshermanmorrison.pyx index 84a6317..95fdcf2 100644 --- a/fastshermanmorrison/cython_fastshermanmorrison.pyx +++ b/fastshermanmorrison/cython_fastshermanmorrison.pyx @@ -1,9 +1,7 @@ # cython: language_level=3 # Define this before importing from numpy -cdef extern from "numpy/arrayobject.h": - #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION - pass +# distutils: define_macros = [('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION')] cimport numpy as np import numpy as np From 4d77f9ea3c55c191dc424f3d3da9f0ea25605942 Mon Sep 17 00:00:00 2001 From: Rutger van Haasteren Date: Wed, 8 Nov 2023 17:28:33 +0100 Subject: [PATCH 04/13] Updated version --- .github/workflows/ci_test.yml | 9 +++++++-- fastshermanmorrison/version.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml index de7618e..934955f 100644 --- a/.github/workflows/ci_test.yml +++ b/.github/workflows/ci_test.yml @@ -59,6 +59,13 @@ jobs: uses: actions/setup-python@v3 with: python-version: '3.x' + # - name: Extract version from git tag + # id: get_version + # run: echo "::set-output name=VERSION::$(git describe --tags --abbrev=0)" + # shell: bash + # - name: Set package version + # run: | + # echo "__version__ = '${{ steps.get_version.outputs.VERSION }}'" > fastshermanmorrison/version.py - name: Install build dependencies run: | python -m pip install --upgrade pip setuptools wheel cython cibuildwheel==2.3.1 @@ -99,8 +106,6 @@ jobs: with: name: dist path: ./dist/ - - name: List files in dist - run: echo "Content of dist:" && ls -lah dist/ && echo "Content of ./:" && ls -lah ./ - name: Publish to PyPI run: | python -m pip install --upgrade twine diff --git a/fastshermanmorrison/version.py b/fastshermanmorrison/version.py index 3dc1f76..91c67cc 100644 --- a/fastshermanmorrison/version.py +++ b/fastshermanmorrison/version.py @@ -1 +1 @@ -__version__ = "0.1.0" +__version__ = "0.3.11" From cfd01405ffe9a5fc6813179901524fe1a662520c Mon Sep 17 00:00:00 2001 From: Rutger van Haasteren Date: Wed, 8 Nov 2023 17:33:26 +0100 Subject: [PATCH 05/13] Updating version, and changing the commenting --- .github/workflows/ci_test.yml | 14 +++++++------- fastshermanmorrison/version.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml index 934955f..7d1bcea 100644 --- a/.github/workflows/ci_test.yml +++ b/.github/workflows/ci_test.yml @@ -59,13 +59,13 @@ jobs: uses: actions/setup-python@v3 with: python-version: '3.x' - # - name: Extract version from git tag - # id: get_version - # run: echo "::set-output name=VERSION::$(git describe --tags --abbrev=0)" - # shell: bash - # - name: Set package version - # run: | - # echo "__version__ = '${{ steps.get_version.outputs.VERSION }}'" > fastshermanmorrison/version.py +# - name: Extract version from git tag +# id: get_version +# run: echo "::set-output name=VERSION::$(git describe --tags --abbrev=0)" +# shell: bash +# - name: Set package version +# run: | +# echo "__version__ = '${{ steps.get_version.outputs.VERSION }}'" > fastshermanmorrison/version.py - name: Install build dependencies run: | python -m pip install --upgrade pip setuptools wheel cython cibuildwheel==2.3.1 diff --git a/fastshermanmorrison/version.py b/fastshermanmorrison/version.py index 91c67cc..8a3be2e 100644 --- a/fastshermanmorrison/version.py +++ b/fastshermanmorrison/version.py @@ -1 +1 @@ -__version__ = "0.3.11" +__version__ = "0.3.13" From b22b85f21c5368827549e6aeedd0d0b6e8e75dab Mon Sep 17 00:00:00 2001 From: Rutger van Haasteren Date: Wed, 8 Nov 2023 17:35:00 +0100 Subject: [PATCH 06/13] Removed deprecation warning stuff --- fastshermanmorrison/cython_fastshermanmorrison.pyx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/fastshermanmorrison/cython_fastshermanmorrison.pyx b/fastshermanmorrison/cython_fastshermanmorrison.pyx index 95fdcf2..dc8095b 100644 --- a/fastshermanmorrison/cython_fastshermanmorrison.pyx +++ b/fastshermanmorrison/cython_fastshermanmorrison.pyx @@ -1,8 +1,3 @@ -# cython: language_level=3 - -# Define this before importing from numpy -# distutils: define_macros = [('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION')] - cimport numpy as np import numpy as np np.import_array() From 592567d24dfbe51283db23a91387b1259c7518ae Mon Sep 17 00:00:00 2001 From: Rutger van Haasteren Date: Wed, 8 Nov 2023 17:51:14 +0100 Subject: [PATCH 07/13] Updated the versioning --- fastshermanmorrison/__init__.py | 6 +++++- fastshermanmorrison/version.py | 1 - setup.py | 22 ++++------------------ 3 files changed, 9 insertions(+), 20 deletions(-) delete mode 100644 fastshermanmorrison/version.py diff --git a/fastshermanmorrison/__init__.py b/fastshermanmorrison/__init__.py index 2dfa73d..4148a08 100644 --- a/fastshermanmorrison/__init__.py +++ b/fastshermanmorrison/__init__.py @@ -1,2 +1,6 @@ from . import fastshermanmorrison -from .version import __version__ +try: + from ._version import __version__ +except ImportError: + # _version.py will be missing during package setup when setuptools_scm has not yet written it + __version__ = "unknown" diff --git a/fastshermanmorrison/version.py b/fastshermanmorrison/version.py deleted file mode 100644 index 8a3be2e..0000000 --- a/fastshermanmorrison/version.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.3.13" diff --git a/setup.py b/setup.py index 3ee379c..eb99505 100755 --- a/setup.py +++ b/setup.py @@ -1,23 +1,6 @@ -import os from setuptools import setup, find_packages from setuptools import Extension from distutils.command.build import build as build_orig -from setuptools.command.build_py import build_py - -# Dynamically calculate the version based on fastshermanmorrison.VERSION. -version_path = os.path.join( - os.path.dirname(__file__), "fastshermanmorrison", "version.py" -) -version_ns = {} -with open(version_path) as f: - exec(f.read(), {}, version_ns) - - -class BuildPyCommand(build_py): - # Ensure that build_py command runs before build_ext. - def run(self): - self.run_command("build_ext") - return super().run() ext_modules = [ @@ -49,7 +32,10 @@ def finalize_options(self): setup( name="fastshermanmorrison-pulsar", - version=version_ns["__version__"], + use_scm_version={ + "write_to": "fastshermanmorrison/_version.py", + "write_to_template": "__version__ = '{version}'", + }, description="Fast Sherman Morrison calculations for Enterprise", license="MIT", author="Rutger van Haasteren", From 4dba1c725dcd33474899219045211893fea65720 Mon Sep 17 00:00:00 2001 From: Rutger van Haasteren Date: Wed, 8 Nov 2023 17:54:02 +0100 Subject: [PATCH 08/13] Linting of setup.py --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index eb99505..fa4505d 100755 --- a/setup.py +++ b/setup.py @@ -2,7 +2,6 @@ from setuptools import Extension from distutils.command.build import build as build_orig - ext_modules = [ Extension( name="fastshermanmorrison.cython_fastshermanmorrison", From 6a233094234fcae6b2ab8e4433f593dfa95255e7 Mon Sep 17 00:00:00 2001 From: Rutger van Haasteren Date: Wed, 8 Nov 2023 17:54:41 +0100 Subject: [PATCH 09/13] Linting of __init__.py --- fastshermanmorrison/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/fastshermanmorrison/__init__.py b/fastshermanmorrison/__init__.py index 4148a08..6573e45 100644 --- a/fastshermanmorrison/__init__.py +++ b/fastshermanmorrison/__init__.py @@ -1,4 +1,5 @@ from . import fastshermanmorrison + try: from ._version import __version__ except ImportError: From 7e58a88acda4387182d950f95cfb805e95360b88 Mon Sep 17 00:00:00 2001 From: Rutger van Haasteren Date: Wed, 8 Nov 2023 18:06:53 +0100 Subject: [PATCH 10/13] All things working for PyPI test --- .github/workflows/ci_test.yml | 7 ------- pyproject.toml | 4 +--- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml index 7d1bcea..4c2173e 100644 --- a/.github/workflows/ci_test.yml +++ b/.github/workflows/ci_test.yml @@ -59,13 +59,6 @@ jobs: uses: actions/setup-python@v3 with: python-version: '3.x' -# - name: Extract version from git tag -# id: get_version -# run: echo "::set-output name=VERSION::$(git describe --tags --abbrev=0)" -# shell: bash -# - name: Set package version -# run: | -# echo "__version__ = '${{ steps.get_version.outputs.VERSION }}'" > fastshermanmorrison/version.py - name: Install build dependencies run: | python -m pip install --upgrade pip setuptools wheel cython cibuildwheel==2.3.1 diff --git a/pyproject.toml b/pyproject.toml index 3f8e484..9cd9dfd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,6 @@ build-backend = "setuptools.build_meta" [project] name = "fastshermanmorrison-pulsar" -dynamic = ["version"] authors = [ {name="Rutger van Haasteren", email="rutger@vhaasteren.com"}, ] @@ -23,6 +22,5 @@ classifiers = [ "Bug Tracker" = "https://github.com/vhaasteren/fastshermanmorrison/issues" [tool.setuptools_scm] -# Optional: Write the version number to your package's __version__.py -write_to = "fastshermanmorrison/version.py" +write_to = "fastshermanmorrison/_version.py" write_to_template = "__version__ = '{version}'" From 100990ba3b873c95568339b057a89ccf00e636b4 Mon Sep 17 00:00:00 2001 From: Rutger van Haasteren Date: Wed, 8 Nov 2023 18:11:02 +0100 Subject: [PATCH 11/13] =?UTF-8?q?=C2=A0Added=20dynamic=20versioning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 9cd9dfd..771c943 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "fastshermanmorrison-pulsar" +dynamic = ["version"] authors = [ {name="Rutger van Haasteren", email="rutger@vhaasteren.com"}, ] From d1eecf19018d182fba839507ef36145b90f999ca Mon Sep 17 00:00:00 2001 From: Rutger van Haasteren Date: Wed, 8 Nov 2023 18:42:01 +0100 Subject: [PATCH 12/13] Added setuptools_scm as an explicit build requirement --- .github/workflows/ci_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml index 4c2173e..11a1723 100644 --- a/.github/workflows/ci_test.yml +++ b/.github/workflows/ci_test.yml @@ -61,7 +61,7 @@ jobs: python-version: '3.x' - name: Install build dependencies run: | - python -m pip install --upgrade pip setuptools wheel cython cibuildwheel==2.3.1 + python -m pip install --upgrade pip setuptools wheel cython cibuildwheel==2.3.1 setuptools_scm - name: Install project dependencies run: | pip install "numpy>=1.16.3" --only-binary=numpy "scipy>=1.2.0" --only-binary=scipy From 44b294ae1afba75fd012802e36ef9cd175111f6c Mon Sep 17 00:00:00 2001 From: Rutger van Haasteren Date: Wed, 8 Nov 2023 18:54:16 +0100 Subject: [PATCH 13/13] Working releases. Switching to main PyPI index. Going to version 0.4.0 --- .github/workflows/ci_test.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml index 11a1723..a43fc58 100644 --- a/.github/workflows/ci_test.yml +++ b/.github/workflows/ci_test.yml @@ -105,6 +105,7 @@ jobs: python -m twine upload ./dist/* env: TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }} - #TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/ + #TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }} + #TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/