From 75a419e2ad288f8caaba0e7c905e75b27e561639 Mon Sep 17 00:00:00 2001 From: Sandor Kertesz Date: Wed, 8 May 2024 11:24:48 +0100 Subject: [PATCH] Use pyproject.toml and src rootdir (#48) * Use pyproject.toml instead of setup.py --- .github/workflows/notify-new-issue.yml | 26 ++++++------ .github/workflows/notify-new-pr.yml | 26 ++++++------ .gitignore | 3 +- pyproject.toml | 55 ++++++++++++++++++++++---- setup.cfg | 40 ------------------- {earthkit => src/earthkit}/__init__.py | 4 +- 6 files changed, 78 insertions(+), 76 deletions(-) rename {earthkit => src/earthkit}/__init__.py (88%) diff --git a/.github/workflows/notify-new-issue.yml b/.github/workflows/notify-new-issue.yml index 526bae2..f1ce11b 100644 --- a/.github/workflows/notify-new-issue.yml +++ b/.github/workflows/notify-new-issue.yml @@ -1,15 +1,15 @@ -name: Notify new issue +# name: Notify new issue -on: - issues: - types: - - "opened" +# on: +# issues: +# types: +# - "opened" -jobs: - notify: - runs-on: ubuntu-latest - steps: - - name: Notify new issue - uses: ecmwf-actions/notify-teams-issue@v1 - with: - incoming_webhook: ${{ secrets.MS_TEAMS_INCOMING_WEBHOOK }} +# jobs: +# notify: +# runs-on: ubuntu-latest +# steps: +# - name: Notify new issue +# uses: ecmwf-actions/notify-teams-issue@v1 +# with: +# incoming_webhook: ${{ secrets.MS_TEAMS_INCOMING_WEBHOOK }} diff --git a/.github/workflows/notify-new-pr.yml b/.github/workflows/notify-new-pr.yml index 50a5305..d225601 100644 --- a/.github/workflows/notify-new-pr.yml +++ b/.github/workflows/notify-new-pr.yml @@ -1,15 +1,15 @@ -name: Notify new PR +# name: Notify new PR -on: - pull_request_target: - types: - - "opened" +# on: +# pull_request_target: +# types: +# - "opened" -jobs: - notify: - runs-on: ubuntu-latest - steps: - - name: Notify new PR - uses: ecmwf-actions/notify-teams-pr@v1 - with: - incoming_webhook: ${{ secrets.MS_TEAMS_INCOMING_WEBHOOK }} +# jobs: +# notify: +# runs-on: ubuntu-latest +# steps: +# - name: Notify new PR +# uses: ecmwf-actions/notify-teams-pr@v1 +# with: +# incoming_webhook: ${{ secrets.MS_TEAMS_INCOMING_WEBHOOK }} diff --git a/.gitignore b/.gitignore index fed8c25..2d0f438 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # setuptools-scm -earthkit/version.py +version.py +_version.py # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/pyproject.toml b/pyproject.toml index 4c283f9..4cba824 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,49 @@ [build-system] -requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] +requires = ["setuptools>=61", "setuptools-scm>=8.0"] + +[project] +authors = [ + {name = "European Centre for Medium-Range Weather Forecasts (ECMWF)", email = "software.support@ecmwf.int"} +] +classifiers = [ + "Development Status :: 2 - Pre-Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Operating System :: OS Independent" +] +dependencies = [ + "earthkit-data[all]>=0.7.0", + "earthkit-geo>=0.1.0", + "earthkit-maps>=0.0.18", + "earthkit-meteo>=0.1.0", + "earthkit-plots>=0.0.6", + "earthkit-regrid>=0.3.0" +] +description = "A format-agnostic Python interface for geospatial data" +dynamic = ["version"] +license = {text = "Apache License Version 2.0"} +name = "earthkit" +readme = "README.md" +requires-python = ">= 3.8" + +[project.optional-dependencies] +test = ["pytest"] + +[project.urls] +Documentation = "https://earthkit.readthedocs.io/" +Homepage = "https://github.com/ecmwf/earthkit/" +Issues = "https://github.com/ecmwf/earthkit.issues" +Repository = "https://github.com/ecmwf/earthkit/" [tool.coverage.run] -branch = true +branch = "true" [tool.isort] profile = "black" @@ -11,9 +52,9 @@ profile = "black" add_ignore = ["D1", "D200", "D205", "D400", "D401"] convention = "numpy" +[tool.setuptools.packages.find] +include = ["earthkit", "earthkit.*"] +where = ["src/", "./"] + [tool.setuptools_scm] -write_to = "earthkit/version.py" -write_to_template = ''' -# Do not change! Do not track in version control! -__version__ = "{version}" -''' +version_file = "src/earthkit/_version.py" diff --git a/setup.cfg b/setup.cfg index 3a9cbe8..4736e11 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,43 +1,3 @@ -[metadata] -name = earthkit -license = Apache License 2.0 -url = https://github.com/ecmwf/earthkit -author = European Centre for Medium-Range Weather Forecasts (ECMWF) -author_email = software.support@ecmwf.int -classifiers = - Development Status :: 2 - Pre-Alpha - Intended Audience :: Science/Research - License :: OSI Approved :: Apache Software License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Topic :: Scientific/Engineering -long_description_content_type = text/markdown -long_description = file: README.md -test_suite = tests - -[options] -python-requires = >=3.8 -packages = find_namespace: -install_requires = - earthkit-data[all]>=0.7.0 - earthkit-geo>=0.1.0 - earthkit-maps>=0.0.18 - earthkit-meteo>=0.1.0 - earthkit-plots>=0.0.6 - earthkit-regrid>=0.3.0 - -[options.packages.find] -include = earthkit, earthkit.* - [flake8] max-line-length = 110 extend-ignore = E203, W503 - -[mypy] -strict = False -ignore_missing_imports = True diff --git a/earthkit/__init__.py b/src/earthkit/__init__.py similarity index 88% rename from earthkit/__init__.py rename to src/earthkit/__init__.py index 36fba11..4ca1e2a 100644 --- a/earthkit/__init__.py +++ b/src/earthkit/__init__.py @@ -9,9 +9,9 @@ try: - # NOTE: the `version.py` file must not be present in the git repository + # NOTE: the `_version.py` file must not be present in the git repository # as it is generated by setuptools at install time - from .version import __version__ + from ._version import __version__ except ImportError: # pragma: no cover # Local copy or not installed with setuptools __version__ = "999"