diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 336f322d5..9651393e9 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -15,72 +15,28 @@ on: - '!contrib/**' jobs: - pylint: + lint: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.10"] - name: Pylint - steps: - - name: checkout git - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Setup conda - uses: s-weigand/setup-conda@v1 - with: - update-conda: true - python-version: ${{ matrix.python-version }} - conda-channels: anaconda, conda-forge - - name: run pylint - run: | - sudo apt-get remove python3-openssl - pip install --upgrade -e '.[test]' - pip install pylint>3.2 - pylint -j 2 --reports no datacube - + python-version: ["3.12"] + lint-command: + - "pylint --j 2 --reports no datacube" + - "--group types mypy datacube" + - "pycodestyle tests integration_tests examples --max-line-length 120" - mypy: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.10"] - name: MyPy + name: Code Lint steps: - name: checkout git uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Setup conda - uses: s-weigand/setup-conda@v1 - with: - update-conda: true - python-version: ${{ matrix.python-version }} - conda-channels: anaconda, conda-forge - - name: run mypy - run: | - sudo apt-get remove python3-openssl - pip install --upgrade -e '.[types]' - mypy datacube - - - pycodestyle: - name: pycodestyle - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.10"] - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup conda - uses: s-weigand/setup-conda@v1 + - name: Install uv + uses: astral-sh/setup-uv@v2 with: - update-conda: true - python-version: ${{ matrix.python-version }} - conda-channels: anaconda, conda-forge - - name: Run pycodestyle + version: 0.5.5 + enable-cache: 'true' + cache-suffix: ${{ matrix.python-version }} + - name: Run ${{ matrix.lint-command }} run: | - sudo apt-get remove python3-openssl - pip install --upgrade -e '.[test]' - pycodestyle tests integration_tests examples --max-line-length 120 + uv run ${{ matrix.lint-command }} diff --git a/docs/about/whats_new.rst b/docs/about/whats_new.rst index 8dfb82ea8..02b5ac240 100644 --- a/docs/about/whats_new.rst +++ b/docs/about/whats_new.rst @@ -19,6 +19,7 @@ v1.9.next * Fix broken documentation build (:pull:`1668`) * Rename `DatasetType` to `Product` in all the tests (:pull:`1671`) * Documentation updates for 1.9 release (:pull:`1664`) +* Move package metadata from `setup.py` to `pyproject.toml` (:pull:`1670`) v1.9.0-rc11 (28th October 2024) =============================== diff --git a/pyproject.toml b/pyproject.toml index 4f0f41650..069da4b2d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,135 @@ -# pyproject.toml +[project] +name = 'datacube' +dynamic = ['version'] +requires-python = ">=3.10" +readme = "README.rst" +license = {text = "Apache License 2.0"} +description = "An analysis environment for satellite and other earth observation data" +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: Apache Software License", + "Natural Language :: English", + "Operating System :: MacOS :: MacOS X", + "Operating System :: POSIX", + "Operating System :: POSIX :: BSD", + "Operating System :: POSIX :: Linux", + "Operating System :: Microsoft :: Windows", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering :: GIS", + "Topic :: Scientific/Engineering :: Information Analysis", +] +dependencies = [ + 'affine', + 'antimeridian', + 'attrs>=18.1', + 'pyproj>=2.5', + 'shapely>=2.0', + 'cachetools', + 'click>=5.0', + 'cloudpickle>=0.4', + 'dask[array]<2024.11.0', # Dask versions from 2024.11 cause problems with numpy2 + 'distributed<2024.11.0', + 'jsonschema>=4.18', # New reference resolution API + 'numpy>=1.26.0', + 'lark', + 'pandas', + 'python-dateutil', + 'pyyaml', + 'rasterio>=1.3.11', # Deleted Numpy version in 1.3.10 + 'ruamel.yaml', + 'sqlalchemy>=2.0', # GeoAlchemy2 requires >=1.4. + 'GeoAlchemy2', + "alembic", + 'toolz', + 'xarray>=0.9', # >0.9 fixes most problems with `crs` attributes being lost + 'packaging', + 'odc-geo>=0.4.8', + 'deprecat', +] + +[project.urls] +Homepage = "https://opendatacube.org/" +Documentation = "https://datacube-core.readthedocs.io/" +Source = "https://github.com/opendatacube/datacube-core/" +Issues = "https://github.com/opendatacube/datacube-core/issues" +Chat = "https://discord.com/invite/4hhBQVas5U" + +[project.optional-dependencies] +performance = ['ciso8601', 'bottleneck'] +distributed = ['distributed', 'dask[distributed]'] +s3 = ['boto3', 'botocore'] +cf = ['compliance-checker>=4.0.0'] +netcdf = ['netcdf4'] +postgres = ['psycopg2'] + +[dependency-groups] +dev = [ + 'hypothesis', + 'pycodestyle', + 'pylint', + 'pytest', + 'pytest-cov', + 'pytest-timeout', + 'pytest-httpserver', + 'moto<5.0', # 5.0 will require changes to some tests. +] +types = [ + "mypy", + "types-affine", + "types-cachetools", + "types-jsonschema", + "types-psutil", + "types-python-dateutil", + "types-PyYAML", + "types-redis", + "types-setuptools", + "boto3-stubs", + "botocore-stubs" +] +doc = [ + 'Sphinx', + 'sphinx_autodoc_typehints', # Propagate mypy info into docs + 'sphinx-click', + 'recommonmark', + 'autodocsumm', + 'beautifulsoup4', + 'nbsphinx', + 'pydata-sphinx-theme==0.9.0', +] + +[project.scripts] +datacube = 'datacube.scripts.cli_app:cli' +datacube-search = 'datacube.scripts.search_tool:cli' +datacube-worker = 'datacube.execution.worker:main' + + [build-system] -requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"] +requires = ["setuptools>=69", "setuptools_scm[toml]>=3.4"] +# v61 Add support for pyproject.toml, and include-package-data defaults to try when using pyproject.toml +# v69 includes py.typed files by default +build-backend = "setuptools.build_meta" + +[project.entry-points."datacube.plugins.io.read"] +netcdf = "datacube.drivers.netcdf.driver:reader_driver_init" + +[project.entry-points."datacube.plugins.io.write"] +netcdf = 'datacube.drivers.netcdf.driver:writer_driver_init' + +[project.entry-points."datacube.plugins.index"] +postgres = 'datacube.index.postgres.index:index_driver_init' +null = 'datacube.index.null.index:index_driver_init' +memory = 'datacube.index.memory.index:index_driver_init' +postgis = 'datacube.index.postgis.index:index_driver_init' + +[tool.setuptools.packages.find] +exclude = ['integration_tests', 'tests', 'examples', 'docs'] +include = ['datacube*'] [tool.setuptools_scm] write_to = "datacube/_version.py" diff --git a/setup.cfg b/setup.cfg index 7dce40ae3..4ba60d7ba 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,9 +1,3 @@ -[aliases] -test=pytest - -[bdist_wheel] -universal=1 - [flake8] max-line-length = 120 ignore = diff --git a/setup.py b/setup.py deleted file mode 100755 index d74448a1d..000000000 --- a/setup.py +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/env python - -from setuptools import setup, find_packages - -tests_require = [ - 'hypothesis', - 'pycodestyle', - 'pylint', - 'pytest', - 'pytest-cov', - 'pytest-timeout', - 'pytest-httpserver', - 'moto<5.0', # 5.0 will require changes to some tests. - 'psycopg2', -] - -types_require = [ - "mypy", - "types-affine", - "types-cachetools", - "types-jsonschema", - "types-psutil", - "types-python-dateutil", - "types-PyYAML", - "types-redis", - "types-setuptools", - "boto3-stubs", - "botocore-stubs" -] - -doc_require = [ - 'Sphinx', - 'sphinx_autodoc_typehints', # Propagate mypy info into docs - 'sphinx-click', - 'recommonmark', - 'autodocsumm', - 'beautifulsoup4', - 'nbsphinx', - 'pydata-sphinx-theme==0.9.0', -] - -extras_require = { - 'performance': ['ciso8601', 'bottleneck'], - 'distributed': ['distributed', 'dask[distributed]'], - 'doc': doc_require, - 's3': ['boto3', 'botocore'], - 'test': tests_require, - "types": types_require, - 'cf': ['compliance-checker>=4.0.0'], - 'netcdf': ['netcdf4'], - 'postgres': ['psycopg2'], -} - -extras_require['dev'] = sorted(set(sum([extras_require[k] for k in [ - 'test', - 'types', - 'doc', - 'performance', - 's3', - 'distributed', - 'netcdf', - 'postgres', -]], []))) - -# An 'all' option, following ipython naming conventions. -extras_require['all'] = sorted(set(sum(extras_require.values(), []))) - -extra_plugins = dict(read=[], write=[], index=[]) - -setup( - name='datacube', - python_requires='>=3.10.0', - - url='https://github.com/opendatacube/datacube-core', - author='Open Data Cube', - maintainer='Open Data Cube', - maintainer_email='', - description='An analysis environment for satellite and other earth observation data', - long_description=open('README.rst').read(), - long_description_content_type='text/x-rst', - license='Apache License 2.0', - classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: Apache Software License", - "Natural Language :: English", - "Operating System :: MacOS :: MacOS X", - "Operating System :: POSIX", - "Operating System :: POSIX :: BSD", - "Operating System :: POSIX :: Linux", - "Operating System :: Microsoft :: Windows", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Topic :: Scientific/Engineering :: GIS", - "Topic :: Scientific/Engineering :: Information Analysis", - ], - - packages=find_packages( - exclude=('tests', 'tests.*', - 'integration_tests', 'integration_tests.*') - ), - package_data={ - '': ['*.yaml', '*/*.yaml'], - 'datacube': ['py.typed'], - 'datacube.drivers.postgis': ['alembic.ini', 'alembic/*.py*', 'alembic/README', 'alembic/versions/*.py'], - }, - scripts=[], - install_requires=[ - 'affine', - 'antimeridian', - 'attrs>=18.1', - 'pyproj>=2.5', - 'shapely>=2.0', - 'cachetools', - 'click>=5.0', - 'cloudpickle>=0.4', - 'dask[array]<2024.11.0', # Dask versions from 2024.11 cause problems with numpy2 - 'distributed<2024.11.0', - 'jsonschema>=4.18', # New reference resolution API - 'numpy>=1.26.0', - 'lark', - 'pandas', - 'python-dateutil', - 'pyyaml', - 'rasterio>=1.3.11', # Deleted Numpy version in 1.3.10 - 'ruamel.yaml', - 'sqlalchemy>=2.0', # GeoAlchemy2 requires >=1.4. - 'GeoAlchemy2', - "alembic", - 'toolz', - 'xarray>=0.9', # >0.9 fixes most problems with `crs` attributes being lost - 'packaging', - 'odc-geo>=0.4.8', - 'deprecat', - ], - extras_require=extras_require, - tests_require=tests_require, - - entry_points={ - 'console_scripts': [ - 'datacube = datacube.scripts.cli_app:cli', - 'datacube-search = datacube.scripts.search_tool:cli', - 'datacube-worker = datacube.execution.worker:main', - ], - 'datacube.plugins.io.read': [ - 'netcdf = datacube.drivers.netcdf.driver:reader_driver_init', - *extra_plugins['read'], - ], - 'datacube.plugins.io.write': [ - 'netcdf = datacube.drivers.netcdf.driver:writer_driver_init', - *extra_plugins['write'], - ], - 'datacube.plugins.index': [ - 'postgres = datacube.index.postgres.index:index_driver_init', - 'null = datacube.index.null.index:index_driver_init', - 'memory = datacube.index.memory.index:index_driver_init', - 'postgis = datacube.index.postgis.index:index_driver_init', - *extra_plugins['index'], - ], - }, -)