Skip to content

fix: Use PEP-621 compliant dependencies spec - #265

Open
zach-overflow wants to merge 3 commits into
oras-project:mainfrom
zach-overflow:zo/pep-621-compliant-install-requires
Open

zach-overflow wants to merge 3 commits into
oras-project:mainfrom
zach-overflow:zo/pep-621-compliant-install-requires

Conversation

@zach-overflow

@zach-overflow zach-overflow commented Oct 16, 2026 •

Copy link
Copy Markdown

What?

  • Moves the install requirements and extras from oras/version.py to pyproject.toml.
  • Specifically, moves each category to the proper PEP-621 / PEP-725 compliant modern standards:
old version.py constant new pyproject.toml location
INSTALL_REQUIRES [project].dependencies
TESTS_REQUIRES [dependency-groups].tests
DOCKER_REQUIRES [project.optional-dependencies].docker
ECR_REQUIRES [project.optional-dependencies].ecr
INSTALL_REQUIRES_ALL [project.optional-dependencies].all
  • Removes setup.py entirely. All package metadata (description, authors, license, keywords, classifiers, URLs) is declared statically in [project]; the version is still read from oras/version.py via [tool.setuptools.dynamic].
  • Drops the now-unused packaging constants (AUTHOR, EMAIL, DESCRIPTION, etc.) from oras/version.py.
  • Declares the license as a PEP 639 SPDX expression (Apache-2.0), which requires setuptools>=77 and replaces the License :: classifier.
  • Sets requires-python = ">=3.9" and updates the version classifiers to 3.9–3.13, since setuptools>=77 requires Python 3.9+.
  • Moves the flake8 config from setup.cfg to .flake8, so no setuptools config files remain.
  • The release workflow builds with python -m build instead of python setup.py sdist bdist_wheel.

Why?

Testing

  1. Packaging metadata matches main apart from the intended dependency changes:

    pip install --upgrade pip build
    git worktree add ../oras-main origin/main
    (cd ../oras-main && python -m build --wheel -o /tmp/before)
    python -m build --wheel -o /tmp/after
    diff <(unzip -p /tmp/before/*.whl '*/METADATA') <(unzip -p /tmp/after/*.whl '*/METADATA')

    Expected diff: pytest (and the redundant jsonschema/requests) removed from the all extra, the tests extra removed, all Dynamic: lines removed, Home-page replaced by Project-URL: Homepage, Author/Author-email merged into Author-email: Vanessa Sochat <...>, and License: LICENSE + the License :: classifier replaced by License-Expression: Apache-2.0, Requires-Python: >=3.9 added, and the Python :: 3.7 classifier replaced by 3.9–3.13. The wheel's file list is unchanged.

  2. Test suite, installing test dependencies from the new tests dependency group:

    docker run -d --rm -p 5000:5000 ghcr.io/oras-project/registry:latest
    python -m venv .venv && . .venv/bin/activate
    pip install --upgrade pip
    make install   # pip install -e .[all] --group tests
    make test
  3. Lint:

    make develop && make lint

@vsoch

vsoch commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

I agree with the changes, and it's a great start here. One issue is that including setup.py and pyproject.toml is having two avenues to do the same thing. I want to suggest completely removing the setup.py (deprecated) install mechanism and completely using the pyproject.toml.

@zach-overflow

zach-overflow commented Nov 2, 2026 •

Copy link
Copy Markdown
Author

I agree with the changes, and it's a great start here. One issue is that including setup.py and pyproject.toml is having two avenues to do the same thing. I want to suggest completely removing the setup.py (deprecated) install mechanism and completely using the pyproject.toml.

@vsoch I'm happy to do that and agree. I considered making that broader change first, but opted for the smaller scope just in case there was some legacy reason I wasn't aware of for the use of setup.py in this repo. Given we're in agreement, I'll put up a followup commit to fully cutover to exclusively use pyproject.toml

@zach-overflow
zach-overflow force-pushed the zo/pep-621-compliant-install-requires branch from 6256604 to f6f4dce Compare November 3, 2026 14:19
Signed-off-by: Zach <4951117+zach-overflow@users.noreply.github.com>
Signed-off-by: Zach <4951117+zach-overflow@users.noreply.github.com>
@zach-overflow
zach-overflow force-pushed the zo/pep-621-compliant-install-requires branch from f6f4dce to cda353a Compare November 3, 2026 14:19
@zach-overflow

Copy link
Copy Markdown
Author

@vsoch I've consolidated to pyproject.toml. I left __version__ defined within the code since that's useful as a client to access as opposed to hard-coding the value in [project].version of pyproject.toml IMO. If you'd prefer that's cut over as well, though, let me know 👍

@vsoch

vsoch commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

This looks great! One small note. Using setuptools>=77.0 needs Python 3.9 or newer, so perhaps we should change the package metadata to update from 3.7.

Signed-off-by: Zach <4951117+zach-overflow@users.noreply.github.com>
@zach-overflow
zach-overflow force-pushed the zo/pep-621-compliant-install-requires branch from 283868c to bda8dba Compare November 12, 2026 16:08
@zach-overflow

Copy link
Copy Markdown
Author

This looks great! One small note. Using setuptools>=77.0 needs Python 3.9 or newer, so perhaps we should change the package metadata to update from 3.7.

@vsoch good call. I've made that update. Should be ready for another review 👍

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Installing oras[all] forces clients to install oras' test dependencies

2 participants