From 594160d6bb91ec2925a6cc9e180855b6dd66239b Mon Sep 17 00:00:00 2001 From: Leonardo Uieda Date: Wed, 10 Apr 2024 08:42:55 -0300 Subject: [PATCH] Switch to pyproject.toml for package configuration (#78) We can now remove setup.cfg since setuptools supports pyproject.toml. --- .flake8 | 42 +++++++++++++++++++ .github/workflows/docs.yml | 2 +- .github/workflows/test.yml | 2 +- MANIFEST.in | 1 + pyproject.toml | 47 ++++++++++++++++++++- setup.cfg | 83 -------------------------------------- 6 files changed, 90 insertions(+), 87 deletions(-) create mode 100644 .flake8 delete mode 100644 setup.cfg diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..384169c --- /dev/null +++ b/.flake8 @@ -0,0 +1,42 @@ +# Configure flake8 + +[flake8] +max-line-length = 88 +max-doc-length = 79 +ignore = + # Too many leading '#' for block comment + E266, + # Line too long (82 > 79 characters) + E501, + # Do not use variables named 'I', 'O', or 'l' + E741, + # Line break before binary operator (conflicts with black) + W503, + # Ignore spaces before a colon (Black handles it) + E203, +exclude = + .git, + __pycache__, + .ipynb_checkpoints, + doc/_build, +per-file-ignores = + # disable unused-imports errors on __init__.py + __init__.py: F401, + _io.py: A005, + +# Configure flake8-rst-docstrings +# ------------------------------- +# Add some roles used in our docstrings +rst-roles = + class, + func, + mod, + meth, + ref, +# Ignore "Unknown target name" raised on citations +extend-ignore = RST306 + +# Configure flake8-functions +# -------------------------- +# Allow a max of 10 arguments per function +max-parameters-amount = 10 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 1d6a240..9390a74 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -61,7 +61,7 @@ jobs: - name: Collect requirements run: | echo "Install Dependente to capture dependencies:" - python -m pip install dependente==0.1.0 + python -m pip install dependente==0.3.0 echo "" echo "Capturing run-time dependencies:" dependente --source install > requirements-full.txt diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 561a151..3f3f851 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -85,7 +85,7 @@ jobs: - name: Collect requirements run: | echo "Install Dependente to capture dependencies:" - python -m pip install dependente==0.1.0 + python -m pip install dependente==0.3.0 echo "" echo "Capturing run-time dependencies:" if [[ "${{ matrix.dependencies }}" == "oldest" ]]; then diff --git a/MANIFEST.in b/MANIFEST.in index 3cacaf2..88c8b8b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -7,6 +7,7 @@ prune data exclude .*.yml exclude .*rc exclude .gitignore +exclude .flake8 exclude CONTRIBUTING.md exclude CODE_OF_CONDUCT.md exclude environment.yml diff --git a/pyproject.toml b/pyproject.toml index 232977f..96298b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,45 @@ -# Specify that we use setuptools and setuptools_scm (to generate the version -# string). Actual configuration is in setup.cfg. +[project] +name = "xlandsat" +description = "Analyze Landsat remote sensing images using xarray" +dynamic = ["version"] +authors = [ + {name="Leonardo Uieda", email="leo@uieda.com"}, +] +readme = "README.md" +license = {text = "MIT License"} +keywords = ["xarray", "remote sensing", "satellite", "landsat"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Intended Audience :: Science/Research", + "Intended Audience :: Developers", + "Intended Audience :: Education", + "Topic :: Scientific/Engineering", + "Topic :: Software Development :: Libraries", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", +] +requires-python = ">=3.7" +dependencies = [ + "numpy>=1.19", + "scipy>=1.5", + "xarray>=0.16", + "scikit-image>=0.18", + "pooch>=1.3.0", +] + +[project.urls] +"Documentation" = "https://www.compgeolab.org/xlandsat" +"Changelog" = "https://www.compgeolab.org/xlandsat/latest/changes.html" +"Bug Tracker" = "https://github.com/compgeolab/xlandsat/issues" +"Source Code" = "https://github.com/compgeolab/xlandsat" + [build-system] requires = ["setuptools>=61", "wheel", "setuptools_scm[toml]>=6.2"] build-backend = "setuptools.build_meta" @@ -9,6 +49,9 @@ version_scheme = "post-release" local_scheme = "node-and-date" write_to = "xlandsat/_version_generated.py" +[tool.setuptools.packages] +find = {} # Scanning implicit namespaces is active by default + # Make sure isort and Black are compatible [tool.isort] profile = "black" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index bb2ce24..0000000 --- a/setup.cfg +++ /dev/null @@ -1,83 +0,0 @@ -[metadata] -name = xlandsat -description = Load Landsat remote sensing images into xarray -long_description = file: README.md -long_description_content_type = text/markdown -author = Leonardo Uieda -author_email = leouieda@gmail.com -license = MIT License -license_files = LICENSE.txt -platform = any -keywords = xarray, remote-sensing, landsat -classifiers = - Development Status :: 3 - Alpha - Intended Audience :: Science/Research - Intended Audience :: Developers - Intended Audience :: Education - Natural Language :: English - Operating System :: OS Independent - Topic :: Scientific/Engineering - Topic :: Software Development :: Libraries - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 -url = https://github.com/compgeolab/xlandsat -project_urls = - Documentation = https://www.compgeolab.org/xlandsat - Release Notes = https://github.com/compgeolab/xlandsat/releases - Bug Tracker = https://github.com/compgeolab/xlandsat/issues - Source Code = https://github.com/compgeolab/xlandsat - -[options] -zip_safe = True -packages = find: -python_requires = >=3.7 -install_requires = - numpy>=1.19 - scipy>=1.5 - xarray>=0.16 - scikit-image>=0.18 - pooch>=1.3.0 - -[flake8] -max-line-length = 88 -max-doc-length = 79 -ignore = - # Too many leading '#' for block comment - E266, - # Line too long (82 > 79 characters) - E501, - # Do not use variables named 'I', 'O', or 'l' - E741, - # Line break before binary operator (conflicts with black) - W503, -exclude = - .git, - __pycache__, - .ipynb_checkpoints, - doc/_build, -per-file-ignores = - # disable unused-imports errors on __init__.py - __init__.py: F401, - _io.py: A005, - - -# Configure flake8-rst-docstrings -# ------------------------------- -# Add some roles used in our docstrings -rst-roles = - class, - func, - mod, - meth, - ref, -# Ignore "Unknown target name" raised on citations -extend-ignore = RST306 - -# Configure flake8-functions -# -------------------------- -# Allow a max of 10 arguments per function -max-parameters-amount = 10