Skip to content

Move project metadata to pyproject.toml (PEP 621)#3430

Merged
snowman2 merged 5 commits intorasterio:mainfrom
mwtoews:pep-621
Dec 8, 2025
Merged

Move project metadata to pyproject.toml (PEP 621)#3430
snowman2 merged 5 commits intorasterio:mainfrom
mwtoews:pep-621

Conversation

@mwtoews
Copy link
Contributor

@mwtoews mwtoews commented Nov 12, 2025

This PR moves the project metadata to pyproject.toml, following PEP 621. Some other details:

  • Simplify setup.py, don't write VERSION.txt (was this used by anything?) and remove unneeded dynamic content already supported by setuptools
  • Merge duplicate pytest configuration from setup.cfg to pyproject.toml
  • Use SPDX license identifier "BSD-3-Clause"; remove the PyPI Trove classifier for the license info, which is deprecated as a unnecessary duplicate
  • Specify license-files with ["LICENSE.txt", "AUTHORS.txt"]
  • Add URLs for Documentation and Repository

Now it is possible to use modern tools like uv sync --all-extras and uv run pytest to build and test everything.

@snowman2 snowman2 added this to the 1.5.0 milestone Nov 13, 2025
Copy link
Contributor

@adamjstewart adamjstewart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are ways that this could be improved (see comments), but I would suggest sticking with a strict setup.py -> pyproject.toml conversion in this PR and make these improvements in a follow-up PR.

pyproject.toml Outdated
"setuptools>=67.8",
"setuptools>=77.0.3",
"wheel",
"cython~=3.1.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can relax this constraint to support 3.2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about "cython>=3.1,<=3.2"?

{name = "Sean Gillies", email = "sean@mapbox.com"},
]
maintainers = [
{name = "Rasterio contributors"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest listing the people with merge privileges here. All rasterio contributors are authors, but only some are maintainers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is reasonable. But I'd suggest this for a follow-up PR, as I don't know the current list of maintainers.

"click-plugins",
"cligj>=0.5",
"numpy>=1.24",
"pyparsing",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice if we discovered the minimum supported versions of all deps and actually tested them to make sure they stay up-to-date.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good follow-up PR to go along with revising use of requirements.txt files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could be convinced to work on this if we get all other tests in CI passing first.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we get rid of these requirements files so as to avoid code duplication? Or use them with pinned versions and dependabot solely for testing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamjstewart the requirements file is only for testing. In CI or locally.

I'll make a separate PR to move it to ci/requirements.txt.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently they are duplicates. We could use pip install .[tests] in testing if we aren't planning on using dependabot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely separate PR, as there are many variations and nuances how to use (or not) these files.

]

[project.optional-dependencies]
all = ["rasterio[docs,ipython,plot,s3,test]"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that although this works (and I personally use it in my projects), it's undocumented and not guaranteed to be supported forever.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've noticed this too. It has "worked" for pip versions for at least a few years, but I recall it didn't work with earlier versions. I'd expect some PEP like this (currently draft) PEP 771 to eventually support this need.

Copy link
Member

@sgillies sgillies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mwtoews !

@snowman2 snowman2 merged commit 6a574f7 into rasterio:main Dec 8, 2025
13 of 25 checks passed
@snowman2
Copy link
Member

snowman2 commented Dec 8, 2025

Thanks @mwtoews 👍

@mwtoews mwtoews deleted the pep-621 branch December 8, 2025 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants