From f40b6c2698c1bca34241c3c5e60e4ecae257a3ba Mon Sep 17 00:00:00 2001 From: "Peter A. Jonsson" Date: Mon, 6 Jul 2026 08:55:46 +0200 Subject: [PATCH] Convert setup.py to pyproject.toml The same files are included before/after when doing "python3 -m build" on my machine. --- .github/workflows/build-wheel.yml | 6 +- pyproject.toml | 141 +++++++++++++++++++++++++++++- setup.py | 128 --------------------------- 3 files changed, 141 insertions(+), 134 deletions(-) delete mode 100644 setup.py diff --git a/.github/workflows/build-wheel.yml b/.github/workflows/build-wheel.yml index 2bb066480..1794919c7 100644 --- a/.github/workflows/build-wheel.yml +++ b/.github/workflows/build-wheel.yml @@ -16,9 +16,9 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install wheel - - name: Build bdist_wheel - run: python setup.py bdist_wheel + pip install build wheel + - name: Build wheel + run: python3 -m build - uses: actions/upload-artifact@v4 with: path: dist/*.whl diff --git a/pyproject.toml b/pyproject.toml index 13265d8ee..53d713e59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,142 @@ +[project] +name = "openeo" +dynamic = ["version"] +description = "Client API for openEO" +readme = "README.md" +license = "Apache-2.0" +requires-python = ">=3.8" +authors = [ + { name = "Jeroen Dries", email = "jeroen.dries@vito.be" }, +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", +] +dependencies = [ + "deprecated>=1.2.12", + # TODO #717 Simplify geopandas constraints when Python 3.8 support is dropped + "geopandas", # Best-effort geopandas dependency for Python 3.8 + "geopandas>=0.14; python_version>='3.9'", + "importlib_resources; python_version<'3.9'", + "numpy>=1.17.0", + "oschmod>=0.3.12; sys_platform == \"win32\"", + "pandas>0.20.0,<3.0.0", # TODO pandas 3 compatibility https://github.com/Open-EO/openeo-python-client/issues/856 + # TODO #578: pystac 1.5.0 is highest version available for lowest Python + # version we still support (3.7). + "pystac>=1.5.0", + "requests>=2.26.0", + "shapely>=1.6.4", + "urllib3>=1.9.0", + "xarray>=0.12.3,<2025.01.2", # TODO #721 xarray non-nanosecond support +] -#[build-system] -#requires = ["setuptools"] -#build-backend = "setuptools.build_meta" +[project.optional-dependencies] +artifacts = [ + "boto3", + "botocore", +] +dev = [ + "boto3", + "boto3~=1.37.38; python_version<'3.9'", + "botocore", + "botocore~=1.37.38; python_version<'3.9'", + "dirty_equals>=0.8.0", + "flake8>=5.0.0", + "httpretty>=1.1.4", + "mock", + "moto>=5.0.0", + "moto~=5.0.28; python_version<'3.9'", + "myst-parser", + "netCDF4>=1.7.0", + "pyarrow>=10.0.1", + "pydata_sphinx_theme", + "pyproj>=3.2.0", # Pyproj is an optional, best-effort runtime dependency + "pystac-client>=0.7.5", + "pytest>=4.5.0", + "python-dateutil>=2.7.0", + "requests-mock>=1.8.0", + "sphinx", + "sphinx-autodoc-annotation", + "sphinx-autodoc-typehints>=2.2.3", + "sphinx-copybutton", + "time_machine>=2.13.0", + "types-boto3-s3", + "types-boto3-sts", + "urllib3<2.3.0", +] +docs = [ + "myst-parser", + "pydata_sphinx_theme", + "sphinx", + "sphinx-autodoc-annotation", + "sphinx-autodoc-typehints>=2.2.3", + "sphinx-copybutton", +] +jupyter = [ + "ipyleaflet>=0.17.0", + "ipython", +] +localprocessing = [ + "openeo_pg_parser_networkx>=2023.5.1", + "openeo_processes_dask[implementations]>=2023.7.1", + "pyproj", + "rioxarray>=0.13.0", +] +# Install oschmod even when platform is not Windows, e.g. for testing in CI. +oschmod = [ + "oschmod>=0.3.12", +] +tests = [ + "boto3", + "boto3~=1.37.38; python_version<'3.9'", + "botocore", + "botocore~=1.37.38; python_version<'3.9'", + "dirty_equals>=0.8.0", + "flake8>=5.0.0", + "httpretty>=1.1.4", + "mock", + "moto>=5.0.0", + # Some pins to speed up slow dependency resolution in Python 3.8 venvs + "moto~=5.0.28; python_version<'3.9'", + "netCDF4>=1.7.0", + "pyarrow>=10.0.1", # For Parquet read/write support in pandas + "pyproj>=3.2.0", + "pystac-client>=0.7.5", + "pytest>=4.5.0", + "python-dateutil>=2.7.0", + "requests-mock>=1.8.0", + "time_machine>=2.13.0", + # httpretty doesn't work properly with urllib3>=2.3.0. See #700 and + # https://github.com/gabrielfalcao/HTTPretty/issues/484 + "urllib3<2.3.0", +] + +[project.scripts] +openeo-auth = "openeo.rest.auth.cli:main" + +[project.urls] +"Bug Tracker" = "https://github.com/Open-EO/openeo-python-client/issues" +Changelog = "https://github.com/Open-EO/openeo-python-client/blob/master/CHANGELOG.md" +Documentation = "https://open-eo.github.io/openeo-python-client/" +Homepage = "https://github.com/Open-EO/openeo-python-client" +"Source Code" = "https://github.com/Open-EO/openeo-python-client" + +[build-system] +requires = ["setuptools>=69"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.dynamic] +version = {attr = "openeo._version.__version__"} + +[tool.setuptools.packages.find] +include = ["openeo"] [tool.black] line-length = 120 diff --git a/setup.py b/setup.py deleted file mode 100644 index 09a2c1746..000000000 --- a/setup.py +++ /dev/null @@ -1,128 +0,0 @@ -from setuptools import find_packages, setup - -# Load the openeo version info. -# -# Note that we cannot simply import the module, since dependencies listed -# in setup() will very likely not be installed yet when setup.py run. -# -# See: -# https://packaging.python.org/guides/single-sourcing-package-version - - -_version = {} -with open("openeo/_version.py") as fp: - exec(fp.read(), _version) - -with open("README.md", "r") as fh: - long_description = fh.read() - -tests_require = [ - "pytest>=4.5.0", - "mock", - "requests-mock>=1.8.0", - "httpretty>=1.1.4", - "urllib3<2.3.0", # httpretty doesn't work properly with urllib3>=2.3.0. See #700 and https://github.com/gabrielfalcao/HTTPretty/issues/484 - "netCDF4>=1.7.0", - "flake8>=5.0.0", - "time_machine>=2.13.0", - "pyproj>=3.2.0", # Pyproj is an optional, best-effort runtime dependency - "dirty_equals>=0.8.0", - "pyarrow>=10.0.1", # For Parquet read/write support in pandas - "python-dateutil>=2.7.0", - "pystac-client>=0.7.5", - "moto>=5.0.0", - # Some pins to speed up slow dependency resolution in Python 3.8 venvs - "moto~=5.0.28; python_version<'3.9'", - "boto3~=1.37.38; python_version<'3.9'", - "botocore~=1.37.38; python_version<'3.9'", -] - -docs_require = [ - "sphinx", - "pydata_sphinx_theme", - "sphinx-autodoc-annotation", - "sphinx-autodoc-typehints>=2.2.3", - "sphinx-copybutton", - "myst-parser", -] - -localprocessing_require = [ - "rioxarray>=0.13.0", - "pyproj", - "openeo_pg_parser_networkx>=2023.5.1", - "openeo_processes_dask[implementations]>=2023.7.1", -] - -jupyter_require = [ - "ipyleaflet>=0.17.0", - "ipython", -] - -artifacts_require = ["boto3", "botocore"] - -typing_requires = ["types-boto3-s3", "types-boto3-sts"] - -name = "openeo" -setup( - name=name, - version=_version["__version__"], - author="Jeroen Dries", - author_email="jeroen.dries@vito.be", - description="Client API for openEO", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/Open-EO/openeo-python-client", - python_requires=">=3.8", - packages=find_packages(include=["openeo*"]), - include_package_data=True, - tests_require=tests_require, - test_suite="tests", - install_requires=[ - "requests>=2.26.0", - "urllib3>=1.9.0", - "shapely>=1.6.4", - "numpy>=1.17.0", - "xarray>=0.12.3,<2025.01.2", # TODO #721 xarray non-nanosecond support - "pandas>0.20.0,<3.0.0", # TODO pandas 3 compatibility https://github.com/Open-EO/openeo-python-client/issues/856 - # TODO #578: pystac 1.5.0 is highest version available for lowest Python version we still support (3.7). - "pystac>=1.5.0", - "deprecated>=1.2.12", - 'oschmod>=0.3.12; sys_platform == "win32"', - "importlib_resources; python_version<'3.9'", - # TODO #717 Simplify geopandas constraints when Python 3.8 support is dropped - "geopandas>=0.14; python_version>='3.9'", - "geopandas", # Best-effort geopandas dependency for Python 3.8 - ], - extras_require={ - "tests": tests_require + artifacts_require, - "dev": tests_require + docs_require + typing_requires + artifacts_require, - "docs": docs_require, - "oschmod": [ # install oschmod even when platform is not Windows, e.g. for testing in CI. - "oschmod>=0.3.12" - ], - "localprocessing": localprocessing_require, - "jupyter": jupyter_require, - "artifacts": artifacts_require, - }, - entry_points={ - "console_scripts": ["openeo-auth=openeo.rest.auth.cli:main"], - }, - classifiers=[ - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "Programming Language :: Python :: 3.14", - "License :: OSI Approved :: Apache Software License", - "Development Status :: 5 - Production/Stable", - "Operating System :: OS Independent", - ], - project_urls={ - "Documentation": "https://open-eo.github.io/openeo-python-client/", - "Source Code": "https://github.com/Open-EO/openeo-python-client", - "Bug Tracker": "https://github.com/Open-EO/openeo-python-client/issues", - "Changelog": "https://github.com/Open-EO/openeo-python-client/blob/master/CHANGELOG.md", - }, -)