diff --git a/.gitignore b/.gitignore index 8990fa1d46..4803714590 100644 --- a/.gitignore +++ b/.gitignore @@ -75,3 +75,9 @@ doc/source/_build/* satpy/version.py doc/source/api/*.rst doc/source/reader_table.rst + +# lock files +*.lock + +# rye files +.python-version diff --git a/pyproject.toml b/pyproject.toml index 537f70cabb..35ba5e8dc2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,122 @@ +[project] +name = "satpy" +dynamic = ["version"] +description = "Python package for earth-observing satellite data processing" +authors = [ + { name = "The Pytroll Team", email = "pytroll@googlegroups.com" } +] +dependencies = [ + "appdirs", + "dask[array]>=0.17.1", + "donfig", + "numpy>=1.21", + "packaging", + "pillow", + "pooch", + "pykdtree", + "pyorbital", + "pyproj>=2.2", + "pyresample>=1.24.0", + "pyyaml>=5.1", + "trollimage>=1.23", + "trollsift", + "xarray>=0.14.1", + "zarr", +] +readme = "README.rst" +requires-python = ">=3.9" +license = { text = "GPLv3" } +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Topic :: Scientific/Engineering" +] + +[project.optional-dependencies] +avhrr_l1b_eps = ["defusedxml"] +avhrr_l1b_gaclac = ["pygac >= 1.3.0"] +modis_l1b = ["pyhdf", "python-geotiepoints >= 1.1.7"] +geocat = ["pyhdf"] +acspo = ["netCDF4 >= 1.1.8"] +clavrx = ["netCDF4 >= 1.1.8"] +viirs_l1b = ["netCDF4 >= 1.1.8"] +viirs_sdr = ["h5py >= 2.7.0"] +viirs_compact = ["h5py >= 2.7.0"] +omps_edr = ["h5py >= 2.7.0"] +amsr2_l1b = ["h5py >= 2.7.0"] +hrpt = ["pyorbital >= 1.3.1", "pygac", "python-geotiepoints >= 1.1.7"] +hrit_msg = ["pytroll-schedule"] +msi_safe = ["rioxarray", "bottleneck", "python-geotiepoints", "defusedxml"] +nc_nwcsaf_msg = ["netCDF4 >= 1.1.8"] +sar_c = ["python-geotiepoints >= 1.1.7", "rasterio", "rioxarray", "defusedxml"] +abi_l1b = ["h5netcdf"] +seviri_l1b_hrit = ["pyorbital >= 1.3.1"] +seviri_l1b_native = ["pyorbital >= 1.3.1"] +seviri_l1b_nc = ["pyorbital >= 1.3.1", "netCDF4 >= 1.1.8"] +seviri_l2_bufr = ["eccodes"] +seviri_l2_grib = ["eccodes"] +hsaf_grib = ["pygrib"] +remote_reading = ["fsspec"] +insat_3d = ["xarray-datatree"] +gms5-vissr_l1b = ["numba"] +# Writers: +cf = ["h5netcdf >= 0.7.3"] +awips_tiled = ["netCDF4 >= 1.1.8"] +geotiff = ["rasterio", "trollimage[geotiff]"] +ninjo = ["pyninjotiff", "pint"] +units = ["pint-xarray"] +# Composites/Modifiers: +rayleigh = ["pyspectral >= 0.10.1"] +angles = ["pyorbital >= 1.3.1"] +filters = ["dask-image"] +# MultiScene: +animations = ["imageio"] +# Documentation: +doc = ["sphinx", "sphinx_rtd_theme", "sphinxcontrib-apidoc"] +# Other +geoviews = ["geoviews"] +holoviews = ["holoviews"] +hvplot = ["hvplot", "geoviews", "cartopy", "holoviews"] +overlays = ["pycoast", "pydecorate"] +satpos_from_tle = ["skyfield", "astropy"] +tests = ["behave", "h5py", "netCDF4", "pyhdf", "imageio", + "rasterio", "geoviews", "trollimage", "fsspec", "bottleneck", + "rioxarray", "pytest", "pytest-lazy-fixture", "defusedxml", + "s3fs", "eccodes", "h5netcdf", "xarray-datatree", + "skyfield", "ephem", "pint-xarray", "astropy", "dask-image", "python-geotiepoints", "numba"] + +[project.scripts] +satpy_retrieve_all_aux_data = "satpy.aux_download:retrieve_all_cmd" + +[project.urls] +Homepage = "https://github.com/pytroll/satpy" +"Bug Tracker" = "https://github.com/pytroll/satpy/issues" +Documentation = "https://satpy.readthedocs.io/en/stable/" +"Source Code" = "https://github.com/pytroll/satpy" +Organization = "https://pytroll.github.io/" +Slack = "https://pytroll.slack.com/" +Twitter = "https://twitter.com/hashtag/satpy?src=hashtag_click" +"Release Notes" = "https://github.com/pytroll/satpy/blob/main/CHANGELOG.md" +Mastodon = "https://fosstodon.org/tags/satpy" + [build-system] -requires = ["setuptools>=60", "wheel", "setuptools_scm[toml]>=8.0"] -build-backend = "setuptools.build_meta" +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" + +[tool.hatch.metadata] +allow-direct-references = true + +[tool.hatch.build.targets.wheel] +packages = ["satpy"] + +[tool.hatch.version] +source = "vcs" -[tool.setuptools_scm] -write_to = "satpy/version.py" +[tool.hatch.build.hooks.vcs] +version-file = "satpy/version.py" [tool.isort] sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 205f924b33..0000000000 --- a/setup.cfg +++ /dev/null @@ -1,25 +0,0 @@ -[bdist_rpm] -requires=h5py pyresample python2-numexpr pyhdf xarray dask h5netcdf -release=1 -doc_files = doc/Makefile doc/source/*.rst doc/examples/*.py - -[bdist_wheel] -universal=1 - -[flake8] -max-line-length = 120 -exclude = - satpy/readers/li_l2.py - satpy/readers/scatsat1_l2b.py - satpy/version.py - satpy/tests/features -per-file-ignores = - satpy/tests/*/conftest.py:F401 - satpy/tests/*/*/conftest.py:F401 - doc/source/doi_role.py:D103 - satpy/tests/features/steps/*.py:F811 - -[coverage:run] -relative_files = True -omit = - satpy/version.py diff --git a/setup.py b/setup.py deleted file mode 100644 index 2f467286d0..0000000000 --- a/setup.py +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2009-2023 Satpy developers -# -# This file is part of satpy. -# -# satpy is free software: you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation, either version 3 of the License, or (at your option) any later -# version. -# -# satpy is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with -# satpy. If not, see . -"""Setup file for satpy.""" - -import os.path -from glob import glob - -from setuptools import find_packages, setup - -requires = ["numpy >=1.21", "pillow", "pyresample >=1.24.0", "trollsift", - "trollimage >=1.23", "pykdtree", "pyyaml >=5.1", "xarray >=0.14.1", - "dask[array] >=0.17.1", "pyproj>=2.2", "zarr", "donfig", "appdirs", - "packaging", "pooch", "pyorbital"] - -test_requires = ["behave", "h5py", "netCDF4", "pyhdf", "imageio", - "rasterio", "geoviews", "trollimage", "fsspec", "bottleneck", - "rioxarray", "pytest", "pytest-lazy-fixture", "defusedxml", - "s3fs", "eccodes", "h5netcdf", "xarray-datatree", - "skyfield", "ephem", "pint-xarray", "astropy", "dask-image"] - -extras_require = { - # Readers: - "avhrr_l1b_eps": ["defusedxml"], - "avhrr_l1b_gaclac": ["pygac >= 1.3.0"], - "modis_l1b": ["pyhdf", "python-geotiepoints >= 1.1.7"], - "geocat": ["pyhdf"], - "acspo": ["netCDF4 >= 1.1.8"], - "clavrx": ["netCDF4 >= 1.1.8"], - "viirs_l1b": ["netCDF4 >= 1.1.8"], - "viirs_sdr": ["h5py >= 2.7.0"], - "viirs_compact": ["h5py >= 2.7.0"], - "omps_edr": ["h5py >= 2.7.0"], - "amsr2_l1b": ["h5py >= 2.7.0"], - "hrpt": ["pyorbital >= 1.3.1", "pygac", "python-geotiepoints >= 1.1.7"], - "hrit_msg": ["pytroll-schedule"], - "msi_safe": ["rioxarray", "bottleneck", "python-geotiepoints", "defusedxml"], - "nc_nwcsaf_msg": ["netCDF4 >= 1.1.8"], - "sar_c": ["python-geotiepoints >= 1.1.7", "rasterio", "rioxarray", "defusedxml"], - "abi_l1b": ["h5netcdf"], - "seviri_l1b_hrit": ["pyorbital >= 1.3.1"], - "seviri_l1b_native": ["pyorbital >= 1.3.1"], - "seviri_l1b_nc": ["pyorbital >= 1.3.1", "netCDF4 >= 1.1.8"], - "seviri_l2_bufr": ["eccodes"], - "seviri_l2_grib": ["eccodes"], - "hsaf_grib": ["pygrib"], - "remote_reading": ["fsspec"], - "insat_3d": ["xarray-datatree"], - "gms5-vissr_l1b": ["numba"], - # Writers: - "cf": ["h5netcdf >= 0.7.3"], - "awips_tiled": ["netCDF4 >= 1.1.8"], - "geotiff": ["rasterio", "trollimage[geotiff]"], - "ninjo": ["pyninjotiff", "pint"], - "units": ["pint-xarray"], - # Composites/Modifiers: - "rayleigh": ["pyspectral >= 0.10.1"], - "angles": ["pyorbital >= 1.3.1"], - "filters": ["dask-image"], - # MultiScene: - "animations": ["imageio"], - # Documentation: - "doc": ["sphinx", "sphinx_rtd_theme", "sphinxcontrib-apidoc"], - # Other - "geoviews": ["geoviews"], - "holoviews": ["holoviews"], - "hvplot": ["hvplot", "geoviews", "cartopy", "holoviews"], - "overlays": ["pycoast", "pydecorate"], - "satpos_from_tle": ["skyfield", "astropy"], - "tests": test_requires, -} -all_extras = [] -for extra_deps in extras_require.values(): - all_extras.extend(extra_deps) -extras_require["all"] = list(set(all_extras)) - - -def _config_data_files(base_dirs, extensions=(".cfg", )): - """Find all subdirectory configuration files. - - Searches each base directory relative to this setup.py file and finds - all files ending in the extensions provided. - - :param base_dirs: iterable of relative base directories to search - :param extensions: iterable of file extensions to include (with '.' prefix) - :returns: list of 2-element tuples compatible with `setuptools.setup` - """ - data_files = [] - pkg_root = os.path.realpath(os.path.dirname(__file__)) + "/" - for base_dir in base_dirs: - new_data_files = [] - for ext in extensions: - configs = glob(os.path.join(pkg_root, base_dir, "*" + ext)) - configs = [c.replace(pkg_root, "") for c in configs] - new_data_files.extend(configs) - data_files.append((base_dir, new_data_files)) - - return data_files - - -entry_points = { - "console_scripts": [ - "satpy_retrieve_all_aux_data=satpy.aux_download:retrieve_all_cmd", - ], -} - - -NAME = "satpy" -with open("README.rst", "r") as readme: - README = readme.read() - -setup(name=NAME, - description="Python package for earth-observing satellite data processing", - long_description=README, - author="The Pytroll Team", - author_email="pytroll@googlegroups.com", - classifiers=["Development Status :: 5 - Production/Stable", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: GNU General Public License v3 " + - "or later (GPLv3+)", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Topic :: Scientific/Engineering"], - url="https://github.com/pytroll/satpy", - download_url="https://pypi.python.org/pypi/satpy", - project_urls={ - "Bug Tracker": "https://github.com/pytroll/satpy/issues", - "Documentation": "https://satpy.readthedocs.io/en/stable/", - "Source Code": "https://github.com/pytroll/satpy", - "Organization": "https://pytroll.github.io/", - "Slack": "https://pytroll.slack.com/", - "Twitter": "https://twitter.com/hashtag/satpy?src=hashtag_click", - "Release Notes": "https://github.com/pytroll/satpy/blob/main/CHANGELOG.md", - "Mastodon": "https://fosstodon.org/tags/satpy", - }, - packages=find_packages(), - # Always use forward '/', even on Windows - # See https://setuptools.readthedocs.io/en/latest/userguide/datafiles.html#data-files-support - package_data={"satpy": ["etc/geo_image.cfg", - "etc/areas.yaml", - "etc/satpy.cfg", - "etc/himawari-8.cfg", - "etc/eps_avhrrl1b_6.5.xml", - "etc/readers/*.yaml", - "etc/writers/*.yaml", - "etc/composites/*.yaml", - "etc/enhancements/*.cfg", - "etc/enhancements/*.yaml", - "tests/etc/readers/*.yaml", - "tests/etc/composites/*.yaml", - "tests/etc/writers/*.yaml", - ]}, - zip_safe=False, - install_requires=requires, - python_requires=">=3.9", - extras_require=extras_require, - entry_points=entry_points, - )