From 3316363c7d1962d2650e3cd574f33d13837bb42d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Kvalsvik?= Date: Wed, 27 Nov 2024 13:43:53 +0100 Subject: [PATCH 1/3] Test on python 3.7-3.11 And skip 3.6 as it is EOL. --- .github/workflows/test_and_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_and_build.yml b/.github/workflows/test_and_build.yml index c403b31..1ac0432 100644 --- a/.github/workflows/test_and_build.yml +++ b/.github/workflows/test_and_build.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: [3.6, 3.7, 3.8, 3.9] + python: [3.7, 3.8, 3.9, "3.10", 3.11] steps: - uses: actions/checkout@v2 - name: Set up python environment From 4d67821dbb82a555658d2b3e9abea1faa81a868d Mon Sep 17 00:00:00 2001 From: Frank Male Date: Tue, 26 Nov 2024 21:52:23 -0500 Subject: [PATCH 2/3] get package version using importlib --- wellpathpy/__init__.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/wellpathpy/__init__.py b/wellpathpy/__init__.py index 684c7c0..8138aba 100644 --- a/wellpathpy/__init__.py +++ b/wellpathpy/__init__.py @@ -1,7 +1,15 @@ +import sys +if sys.version_info >= (3, 8): + from importlib import metadata +else: + import importlib_metadata as metadata + try: - import pkg_resources - __version__ = pkg_resources.get_distribution(__name__).version -except pkg_resources.DistributionNotFound: + __version__ = metadata.version(__name__) +except: # PackageNotFoundError + # Don't hard crash when the the version cannot be looked up from the + # metadata, probably because the tests are running from the source dir and + # the module has not been packaged yet. pass __all__ = [ From d02f58e21f2ffcf25c524f25adf30ce80de437d1 Mon Sep 17 00:00:00 2001 From: Frank Male Date: Tue, 26 Nov 2024 22:24:32 -0500 Subject: [PATCH 3/3] use pyproject.toml for build specification --- .github/workflows/deploy_to_pypi.yml | 2 +- .github/workflows/test_and_build.yml | 4 +-- pyproject.toml | 45 ++++++++++++++++++++++++++++ requirements-dev.txt | 1 + setup.cfg | 2 -- setup.py | 21 ------------- 6 files changed, 49 insertions(+), 26 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/deploy_to_pypi.yml b/.github/workflows/deploy_to_pypi.yml index 46453f2..6ecc78b 100644 --- a/.github/workflows/deploy_to_pypi.yml +++ b/.github/workflows/deploy_to_pypi.yml @@ -20,7 +20,7 @@ jobs: pip install -r requirements-dev.txt - name: Build wheel run: | - python setup.py bdist_wheel + python -m pip build --wheel - name: Publish distribution to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: diff --git a/.github/workflows/test_and_build.yml b/.github/workflows/test_and_build.yml index 1ac0432..8da872b 100644 --- a/.github/workflows/test_and_build.yml +++ b/.github/workflows/test_and_build.yml @@ -24,7 +24,7 @@ jobs: pip install -r requirements-dev.txt - name: Run tests run: | - python setup.py pytest + python -m pytest - name: Build wheel run: | - python setup.py bdist_wheel \ No newline at end of file + python -m build --wheel diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..0a93ea2 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,45 @@ +[build-system] +requires = ["hatchling>=1.0", "hatch-vcs"] +build-backend = "hatchling.build" + +[project] +name = "wellpathpy" +dynamic = ["version"] +description = "Light package to load well deviations" +readme = "README.md" +authors = [ + { name = "Robert Leckenby", email = "fracgeol@gmail.com" }, + { name = "Jørgen Kvalsvik", email = "j@lambda.is" }, + { name = "Brendon Hall", email = "brendon.hall@gmail.com" }, +] +maintainers = [ +] +license = { file = "LICENSE" } +platforms = "any" + +dependencies = [ + "numpy >=1.10", +] + +[project.optional-dependencies] +test = [ + "pytest", + "hypothesis", +] + +[project.urls] +"Homepage" = "https://github.com/Zabamund/wellpathpy" +"Repository" = "https://github.com/Zabamund/wellpathpy" + +[tool.hatch.version] +source = "vcs" + +[tool.hatch.metadata] +license = "LGPL-3.0" + +[tool.pytest.ini_options] +testpaths = ["tests"] + +[tool.setuptools_scm] +version_scheme = "post-release" + diff --git a/requirements-dev.txt b/requirements-dev.txt index 7cfed63..23256a0 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,3 +3,4 @@ numpy setuptools-scm hypothesis wheel +build diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 9af7e6f..0000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[aliases] -test=pytest \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 9d04e2f..0000000 --- a/setup.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python3 - -from setuptools import setup - -with open("README.md", "r") as f: - long_description = f.read() - -setup(name='wellpathpy', - description='Light package to load well deviations', - long_description=long_description, - author='Robert Leckenby, Brendon Hall, Jørgen Kvalsvik', - author_email='fracgeol@gmail.com', - url='https://github.com/Zabamund/wellpathpy', - packages=['wellpathpy'], - license='LGPL-3.0', - platforms='any', - install_requires=['numpy >=1.10'], - setup_requires=['setuptools >=28', 'setuptools_scm', 'pytest-runner'], - tests_require=['pytest', 'hypothesis'], - use_scm_version=True, - )