From 3c5a4c583874edb03402db52fbcb239af40d11c4 Mon Sep 17 00:00:00 2001 From: valpesendorfer Date: Mon, 28 Aug 2023 22:34:23 +0200 Subject: [PATCH 1/4] rework setup --- pyproject.toml | 3 +++ setup.cfg | 29 +++++++++++++++++++++++++++++ setup.py | 50 ++++++++++++++++++++++---------------------------- 3 files changed, 54 insertions(+), 28 deletions(-) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e4ca2ec --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools>=51.0.0", "wheel", "numpy>=1.15.1", "cython"] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg index 18fa5e2..7a3643c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,32 @@ +[metadata] +name = vam.whittaker +description = VAM whittaker core +version = attr: ._version.__version__ +author = WFP-VAM +author_email = +maintainer = WFP-VAM +maintainer_email = +long_description_content_type = text/rst +long_description = file: README.rst +platforms = any +license = MIT License +url = http://github.com/WFP-VAM/vam.whittaker/ +project_urls = + Bug Reporting = http://github.com/WFP-VAM/vam.whittaker/issues + +classifiers = + License :: OSI Approved :: MIT License + Intended Audience :: Developers + Development Status :: 3 - Beta + Operating System :: OS Independent + Programming Language :: Python :: 3 + Natural Language :: English + Topic :: Software Development :: Libraries :: Python Modules + Topic :: Scientific/Engineering :: GIS + +[options] +python_requires = >=3,<4 + [aliases] test=pytest diff --git a/setup.py b/setup.py index 43994ab..abd707b 100644 --- a/setup.py +++ b/setup.py @@ -1,20 +1,20 @@ -#!/usr/bin/env python # pylint: disable=invalid-name, line-too-long """setup.py for VAM whittaker core""" from setuptools import setup, Extension import numpy -import _version -USE_CYTHON = 'auto' + +USE_CYTHON = "auto" if USE_CYTHON: try: from Cython.Distutils import build_ext - if USE_CYTHON == 'auto': + + if USE_CYTHON == "auto": USE_CYTHON = True except ImportError: - if USE_CYTHON == 'auto': + if USE_CYTHON == "auto": USE_CYTHON = False else: raise @@ -24,34 +24,28 @@ if USE_CYTHON: ext_modules += [ - Extension("vam.whittaker", - ["src/_whittaker.pyx"], extra_compile_args=["-O3", "-ffast-math"])] - cmdclass.update({'build_ext': build_ext}) + Extension( + "vam.whittaker", + ["src/_whittaker.pyx"], + extra_compile_args=["-O3", "-ffast-math"], + ) + ] + cmdclass.update({"build_ext": build_ext}) else: ext_modules += [ - Extension("vam.whittaker", - ["src/_whittaker.c"], extra_compile_args=["-O3", "-ffast-math"])] + Extension( + "vam.whittaker", + ["src/_whittaker.c"], + extra_compile_args=["-O3", "-ffast-math"], + ) + ] setup( - name='vam.whittaker', - description='VAM whittaker core', - version=_version.__version__, - author='Valentin Pesendorfer', - author_email='valentin.pesendorfer@wfp.org', - url='http://github.com/WFP-VAM/vam.whittaker', - long_description='''State-of-the art whittaker smoother, implemented as fast C-extension through Cython and including a V-curve optimization of the smoothing parameter.\n\nFor more information, please visit: http://github.com/WFP-VAM/vam.whittaker''', include_dirs=[numpy.get_include()], cmdclass=cmdclass, ext_modules=ext_modules, - classifiers=[ - 'Development Status :: 4 - Beta', - 'Programming Language :: Python :: 3', - ], - setup_requires=['pytest-runner'], - tests_require=['pytest'], - install_requires=[ - 'numpy>=1.15.1', - 'mock;python_version<"3.0"' - ], - python_requires='>=3, <4', + setup_requires=["pytest-runner"], + tests_require=["pytest"], + install_requires=["numpy>=1.15.1", 'mock;python_version<"3.0"'], + python_requires=">=3, <4", ) From 386352f8e37aa2274a4d8b44e22ecfd3c5ba9198 Mon Sep 17 00:00:00 2001 From: valpesendorfer Date: Mon, 28 Aug 2023 22:46:05 +0200 Subject: [PATCH 2/4] update actions --- .github/workflows/ci.yml | 10 +++++----- .github/workflows/wheels.yml | 22 +++++++++++++--------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93adead..6c7a85c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,18 +9,18 @@ on: jobs: build_and_test: - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: [3.8, 3.9, '3.10', 3.11] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - name: install dependencies - run: pip install cython numpy + run: pip install cython numpy wheel - name: build run: pip install $GITHUB_WORKSPACE - name: test diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index b4622a4..ffee56a 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -6,12 +6,14 @@ on: jobs: build_wheels: - name: Build wheels - runs-on: ubuntu-latest - + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04, windows-2022] + steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - name: Install cibuildwheel @@ -24,7 +26,7 @@ jobs: CIBW_BUILD: "{cp,pp}3*-*" CIBW_SKIP: "cp35-* *-manylinux_i686" - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: path: ./wheelhouse/*.whl @@ -45,7 +47,7 @@ jobs: - name: Build sdist run: python setup.py sdist - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: path: dist/*.tar.gz @@ -54,12 +56,14 @@ jobs: runs-on: ubuntu-latest if: github.event_name == 'release' && github.event.action == 'published' steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: artifact path: dist - uses: pypa/gh-action-pypi-publish@master with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository-url: https://test.pypi.org/legacy/ + #user: __token__ + #password: ${{ secrets.PYPI_API_TOKEN }} From 1b6126b131eec949c7bc38d8c8b479244380522e Mon Sep 17 00:00:00 2001 From: valpesendorfer Date: Tue, 29 Aug 2023 09:52:23 +0200 Subject: [PATCH 3/4] reformat package structure --- setup.py | 4 ++-- vam/whittaker/__init__.py | 3 +++ vam/whittaker/_version.py | 12 ++++++++++++ {src => vam/whittaker}/_whittaker.pyx | 0 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 vam/whittaker/__init__.py create mode 100644 vam/whittaker/_version.py rename {src => vam/whittaker}/_whittaker.pyx (100%) diff --git a/setup.py b/setup.py index abd707b..31dccfc 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ ext_modules += [ Extension( "vam.whittaker", - ["src/_whittaker.pyx"], + ["vam/whittaker/_whittaker.pyx"], extra_compile_args=["-O3", "-ffast-math"], ) ] @@ -35,7 +35,7 @@ ext_modules += [ Extension( "vam.whittaker", - ["src/_whittaker.c"], + ["vam/whittaker/_whittaker.c"], extra_compile_args=["-O3", "-ffast-math"], ) ] diff --git a/vam/whittaker/__init__.py b/vam/whittaker/__init__.py new file mode 100644 index 0000000..d374cc5 --- /dev/null +++ b/vam/whittaker/__init__.py @@ -0,0 +1,3 @@ +from ._version import __version__ + +__all__ = ("__version__",) diff --git a/vam/whittaker/_version.py b/vam/whittaker/_version.py new file mode 100644 index 0000000..99e047e --- /dev/null +++ b/vam/whittaker/_version.py @@ -0,0 +1,12 @@ +""" +_version + +Version information for MODAPE whittaker core + +""" + +VERSION_MAJOR = 2 +VERSION_MINOR = 0 +VERSION_PATCH = 2 + +__version__ = ".".join(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH) diff --git a/src/_whittaker.pyx b/vam/whittaker/_whittaker.pyx similarity index 100% rename from src/_whittaker.pyx rename to vam/whittaker/_whittaker.pyx From ef05cc4e54ada8dccb419529bfd0a6c59f6ea3a3 Mon Sep 17 00:00:00 2001 From: valpesendorfer Date: Wed, 30 Aug 2023 14:38:09 +0200 Subject: [PATCH 4/4] restructure package dir --- _version/__init__.py | 22 ---------------------- setup.cfg | 7 ++++++- setup.py | 6 +++--- vam/whittaker/__init__.py | 1 + vam/whittaker/_version.py | 13 +------------ 5 files changed, 11 insertions(+), 38 deletions(-) delete mode 100644 _version/__init__.py diff --git a/_version/__init__.py b/_version/__init__.py deleted file mode 100644 index 63ecbb5..0000000 --- a/_version/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -""" -_version - -Version information for MODAPE whittaker core - -""" - -__all__ = [ - 'VERSION_MAJOR', - 'VERSION_MINOR', - 'VERSION_PATCH', - 'VERSION_STRING', - '__version__', -] - -VERSION_MAJOR = 2 -VERSION_MINOR = 0 -VERSION_PATCH = 2 - -VERSION_STRING = '%s.%s.%s' % (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH) - -__version__ = VERSION_STRING diff --git a/setup.cfg b/setup.cfg index 7a3643c..043f12a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] name = vam.whittaker description = VAM whittaker core -version = attr: ._version.__version__ +version = attr: vam.whittaker._version.__version__ author = WFP-VAM author_email = maintainer = WFP-VAM @@ -27,6 +27,11 @@ classifiers = [options] python_requires = >=3,<4 + +[options.packages.find] +include = + vam* + [aliases] test=pytest diff --git a/setup.py b/setup.py index 31dccfc..854f838 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ import numpy -USE_CYTHON = "auto" +USE_CYTHON = True # "auto" if USE_CYTHON: try: @@ -25,7 +25,7 @@ if USE_CYTHON: ext_modules += [ Extension( - "vam.whittaker", + "vam.whittaker._whit", ["vam/whittaker/_whittaker.pyx"], extra_compile_args=["-O3", "-ffast-math"], ) @@ -34,7 +34,7 @@ else: ext_modules += [ Extension( - "vam.whittaker", + "vam.whittaker._whit", ["vam/whittaker/_whittaker.c"], extra_compile_args=["-O3", "-ffast-math"], ) diff --git a/vam/whittaker/__init__.py b/vam/whittaker/__init__.py index d374cc5..a26c4f5 100644 --- a/vam/whittaker/__init__.py +++ b/vam/whittaker/__init__.py @@ -1,3 +1,4 @@ from ._version import __version__ +from ._whit import lag1corr, ws2d, ws2dp, ws2doptv, ws2doptvp __all__ = ("__version__",) diff --git a/vam/whittaker/_version.py b/vam/whittaker/_version.py index 99e047e..0309ae2 100644 --- a/vam/whittaker/_version.py +++ b/vam/whittaker/_version.py @@ -1,12 +1 @@ -""" -_version - -Version information for MODAPE whittaker core - -""" - -VERSION_MAJOR = 2 -VERSION_MINOR = 0 -VERSION_PATCH = 2 - -__version__ = ".".join(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH) +__version__ = "2.0.2"