From 3d8695df5e203865a947e8638ef47ff8c7b3b535 Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Thu, 26 Feb 2026 10:55:08 -0500 Subject: [PATCH 1/2] use only pyproject configuration --- .github/workflows/main.yml | 13 ++--- MANIFEST.in | 1 - README.md | 11 ++-- pyproject.toml | 48 ++++++++++++++++++ pywiscat/__init__.py | 3 +- pywiscat/util.py | 40 +++++++++++++++ requirements-dev.txt | 3 -- requirements.txt | 6 --- setup.py | 100 ------------------------------------- 9 files changed, 99 insertions(+), 126 deletions(-) delete mode 100644 MANIFEST.in create mode 100644 pywiscat/util.py delete mode 100644 requirements-dev.txt delete mode 100644 requirements.txt delete mode 100644 setup.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4d13b5b..6c617a1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,18 +14,15 @@ jobs: name: Setup Python ${{ matrix.python-version }} with: python-version: ${{ matrix.python-version }} - - name: Install requirements 📦 - run: | - python3 -m pip install --upgrade pip - pip3 install setuptools - pip3 install -r requirements.txt - pip3 install -r requirements-dev.txt - name: Install package 📦 - run: pip3 install . + run: | + pip3 install . + pip3 install ".[dev]" + pip3 install ".[release]" - name: run tests ⚙️ run: python3 tests/run_tests.py - name: run flake8 ⚙️ run: | find . -type f -name "*.py" | xargs flake8 - name: build Python package 🏗️ - run: python3 setup.py sdist bdist_wheel --universal + run: python3 -m build diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 8e2b4b2..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include LICENSE.md README.md requirements.txt diff --git a/README.md b/README.md index 40c1f5c..a70e5cc 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,6 @@ cd pywiscat . bin/activate git clone https://github.com/wmo-im/pywiscat.git cd pywiscat -pip3 install -r requirements.txt pip3 install . ``` @@ -104,9 +103,7 @@ python3 -m venv pywiscat cd pywiscat source bin/activate git clone https://github.com/wmo-im/pywiscat.git -pip3 install -r requirements.txt -pip3 install -r requirements-dev.txt -python3 setup.py install +pip3 install . ``` ### Running tests @@ -119,7 +116,7 @@ python3 tests/run_tests.py ```bash # create release (x.y.z is the release version) -vi pywiscat/__init__.py # update __version__ +vi pyproject.toml # update [project]/version git commit -am 'update release version x.y.z' git push origin master git tag -a x.y.z -m 'tagging release version x.y.z' @@ -127,13 +124,13 @@ git push --tags # upload to PyPI rm -fr build dist *.egg-info -python3 setup.py sdist bdist_wheel --universal +python3 -m build twine upload dist/* # publish release on GitHub (https://github.com/wmo-im/pywiscat/releases/new) # bump version back to dev -vi pywiscat/__init__.py # update __version__ +vi pyproject.toml # update [project]/version git commit -am 'back to dev' git push origin master ``` diff --git a/pyproject.toml b/pyproject.toml index 205a289..9f1bd11 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,51 @@ [build-system] requires = ["setuptools>=46.4", "wheel"] build-backend = "setuptools.build_meta" + +[project] +name = "pywiscat" +version = "0.4.dev0" +description = "WMO WIS Catalogue Python client" +readme = "README.md" +requires-python = ">=3.12" +license = "Apache-2.0" +license-files = ["LICENSE.md"] +keywords = ["WMO", "WIS2"] +authors = [ + {name = "Tom Kralidis", email = "tomkralidis@gmail.com"}, +] +maintainers = [ + {name = "Tom Kralidis", email = "tomkralidis@gmail.com"}, +] +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Topic :: Scientific/Engineering :: Atmospheric Science", + "Topic :: Scientific/Engineering :: GIS", + "Topic :: Scientific/Engineering :: Information Analysis" +] +dependencies = [ + "click", + "emoji-country-flag", + "iso3166", + "prettytable", + "pywcmp", + "requests" +] + +[project.optional-dependencies] +dev = ["flake8"] +release = ["build", "twine", "wheel"] + +[project.scripts] +pywiscat = "pywiscat:cli" + +[project.urls] +homepage = "https://github.com/World-Meteorological-Organization/pywiscat" +source = "https://github.com/World-Meteorological-Organization/pywiscat" +documentation = "https://github.com/World-Meteorological-Organization/pywiscat" +issues = "https://github.com/World-Meteorological-Organization/pywiscat/issues" diff --git a/pywiscat/__init__.py b/pywiscat/__init__.py index 5b8a8fd..b4d26ba 100644 --- a/pywiscat/__init__.py +++ b/pywiscat/__init__.py @@ -32,8 +32,9 @@ from pywiscat.wis2.archive import archive from pywiscat.wis2.catalogue import get_gdc_record, search_gdc from pywiscat.wis2.metrics import metrics +from pywiscat.util import get_package_version -__version__ = '0.4.dev0' +__version__ = get_package_version() @click.group() diff --git a/pywiscat/util.py b/pywiscat/util.py new file mode 100644 index 0000000..77636d1 --- /dev/null +++ b/pywiscat/util.py @@ -0,0 +1,40 @@ +# ================================================================= +# +# Authors: Tom Kralidis +# +# Copyright (c) 2026 Tom Kralidis +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# +# ================================================================= + +import importlib.metadata + + +def get_package_version() -> str: + """ + Helper function to get package version + + :returns: `str` of version of package + """ + + return importlib.metadata.version('pywiscat') diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index ff3303f..0000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,3 +0,0 @@ -flake8 -twine -wheel diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 887a50b..0000000 --- a/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -click -emoji-country-flag -iso3166 -prettytable -pywcmp -requests diff --git a/setup.py b/setup.py deleted file mode 100644 index b38ed7d..0000000 --- a/setup.py +++ /dev/null @@ -1,100 +0,0 @@ -# ================================================================= -# -# Authors: Tom Kralidis -# -# Copyright (c) 2026 Tom Kralidis -# -# Permission is hereby granted, free of charge, to any person -# obtaining a copy of this software and associated documentation -# files (the "Software"), to deal in the Software without -# restriction, including without limitation the rights to use, -# copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following -# conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. -# -# ================================================================= - -import io -import os -import re -from setuptools import find_packages, setup - - -def read(filename, encoding='utf-8'): - """read file contents""" - full_path = os.path.join(os.path.dirname(__file__), filename) - with io.open(full_path, encoding=encoding) as fh: - contents = fh.read().strip() - return contents - - -def get_package_version(): - """get version from top-level package init""" - version_file = read('pywiscat/__init__.py') - version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", - version_file, re.M) - if version_match: - return version_match.group(1) - raise RuntimeError("Unable to find version string.") - - -KEYWORDS = [ - 'wmo', - 'wis' -] - -DESCRIPTION = 'WMO WIS Catalogue Python client' - -# ensure a fresh MANIFEST file is generated -if (os.path.exists('MANIFEST')): - os.unlink('MANIFEST') - - -setup( - name='pywiscat', - version=get_package_version(), - description=DESCRIPTION.strip(), - long_description=read('README.md'), - long_description_content_type='text/markdown', - license='MIT', - platforms='all', - keywords=' '.join(KEYWORDS), - author='Tom Kralidis', - author_email='tomkralidis@gmail.com', - maintainer='Tom Kralidis', - maintainer_email='tomkralidis@gmail.com', - url='https://github.com/wmo-im/pywiscat', - install_requires=read('requirements.txt').splitlines(), - packages=find_packages(), - entry_points={ - 'console_scripts': [ - 'pywiscat=pywiscat:cli' - ] - }, - classifiers=[ - 'Development Status :: 4 - Beta', - 'Environment :: Console', - 'Intended Audience :: Developers', - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Topic :: Scientific/Engineering :: Atmospheric Science', - 'Topic :: Scientific/Engineering :: GIS', - 'Topic :: Scientific/Engineering :: Information Analysis' - ], - test_suite='tests.run_tests' -) From c7dc6059ae62938085773001f598102cb7efec7d Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Fri, 27 Feb 2026 13:30:42 -0500 Subject: [PATCH 2/2] Fix formatting in pyproject.toml for authors and maintainers --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9f1bd11..be4726f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,10 +12,10 @@ license = "Apache-2.0" license-files = ["LICENSE.md"] keywords = ["WMO", "WIS2"] authors = [ - {name = "Tom Kralidis", email = "tomkralidis@gmail.com"}, + {name = "Tom Kralidis", email = "tomkralidis@gmail.com"} ] maintainers = [ - {name = "Tom Kralidis", email = "tomkralidis@gmail.com"}, + {name = "Tom Kralidis", email = "tomkralidis@gmail.com"} ] classifiers = [ "Development Status :: 4 - Beta",