From 3655830d31cc83678e0e274b97b7d43d48cf3900 Mon Sep 17 00:00:00 2001 From: Zach <4951117+zach-overflow@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:19:44 -0500 Subject: [PATCH 1/3] fix: Use PEP-621 compliant dependencies spec Signed-off-by: Zach <4951117+zach-overflow@users.noreply.github.com> --- .github/workflows/main.yaml | 2 ++ CHANGELOG.md | 1 + Makefile | 6 ++-- docs/getting_started/installation.md | 4 +-- oras/version.py | 18 ------------ pyproject.toml | 36 ++++++++++++++++++++++++ setup.py | 42 ---------------------------- 7 files changed, 44 insertions(+), 65 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 541ff5ea..9dbf1517 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -19,6 +19,7 @@ jobs: - name: Lint Oras Python run: | python --version + python3 -m pip install --upgrade pip python3 -m pip install pre-commit python3 -m pip install black make develop @@ -78,5 +79,6 @@ jobs: registry_port: ${{ job.services.registry.ports[5000] }} REGISTRY_STORAGE_DELETE_ENABLED: "true" run: | + python3 -m pip install --upgrade pip make install make test diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d113a6c..305c6108 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are: The versions coincide with releases on pip. Only major versions will be released as tags on Github. ## [0.0.x](https://github.com/oras-project/oras-py/tree/main) (0.0.x) + - declare install requirements and extras in `pyproject.toml` (PEP 621) instead of `oras/version.py`, and move test dependencies (now including `boto3`) from the `tests` extra and `all` to a `tests` dependency group (PEP 735) (0.2.44) - clean up temporary directory archives after push and pull, including failed transfers (0.2.44) - make `username` and `password` optional in `login()` so the interactive prompts can be used, hide password entry and reject empty usernames, closes issue [235](https://github.com/oras-project/oras-py/issues/235) (0.2.44) - route push completion output through the logger and support the documented `quiet` option, closes issue [229](https://github.com/oras-project/oras-py/issues/229) (0.2.43) diff --git a/Makefile b/Makefile index a5aa04c2..2525bce2 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ test: .PHONY: install install: - pip install -e .[all] + pip install -e .[all] --group tests .PHONY: lint lint: @@ -12,9 +12,9 @@ lint: .PHONY: testreqs testreqs: - pip install -e .[tests] + pip install -e . --group tests .PHONY: develop develop: - pip install -e .[all] + pip install -e .[all] --group tests pip install -r .github/dev-requirements.txt diff --git a/docs/getting_started/installation.md b/docs/getting_started/installation.md index f59a07e2..1a3e287e 100644 --- a/docs/getting_started/installation.md +++ b/docs/getting_started/installation.md @@ -23,8 +23,8 @@ Note that we have several extra modes for installation: # Interactions are done via the docker client instead of manual $ pip install oras[docker] -# Install dependencies for linting and tests -$ pip install oras[tests] +# From a clone, install dependencies for tests (requires pip>=25.1) +$ pip install --group tests # Install everything $ pip install oras[all] diff --git a/oras/version.py b/oras/version.py index 2dda9b59..a5896d42 100644 --- a/oras/version.py +++ b/oras/version.py @@ -10,21 +10,3 @@ KEYWORDS = "oci, registry, storage" DESCRIPTION = "OCI Registry as Storage Python SDK" LICENSE = "LICENSE" - -################################################################################ -# Global requirements - -INSTALL_REQUIRES = ( - ("jsonschema", {"min_version": None}), - ("requests", {"min_version": None}), -) - -TESTS_REQUIRES = (("pytest", {"min_version": "4.6.2"}),) - -DOCKER_REQUIRES = (("docker", {"exact_version": "5.0.1"}),) - -ECR_REQUIRES = (("boto3", {"min_version": "1.33.0"}),) - -INSTALL_REQUIRES_ALL = ( - INSTALL_REQUIRES + TESTS_REQUIRES + DOCKER_REQUIRES + ECR_REQUIRES -) diff --git a/pyproject.toml b/pyproject.toml index 8fa6a186..85102730 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,39 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "oras" +dynamic = [ + "version", + "authors", + "maintainers", + "description", + "readme", + "license", + "keywords", + "classifiers", + "urls", +] +dependencies = [ + "jsonschema", + "requests", +] + +[project.optional-dependencies] +all = [ + "docker==5.0.1", + "boto3>=1.33.0", +] +docker = ["docker==5.0.1"] +ecr = ["boto3>=1.33.0"] + +[dependency-groups] +tests = [ + "pytest>=4.6.2", + "boto3>=1.33.0", +] + [tool.black] profile = "black" exclude = '^env/' diff --git a/setup.py b/setup.py index 19af091f..dce4c6ee 100644 --- a/setup.py +++ b/setup.py @@ -11,31 +11,6 @@ def get_lookup(): return lookup -# Read in requirements -def get_reqs(lookup=None, key="INSTALL_REQUIRES"): - """ - get requirements, mean reading in requirements and versions from - the lookup obtained with get_lookup - """ - - if lookup is None: - lookup = get_lookup() - - install_requires = [] - for module in lookup[key]: - module_name = module[0] - module_meta = module[1] - if "exact_version" in module_meta: - dependency = "%s==%s" % (module_name, module_meta["exact_version"]) - elif "min_version" in module_meta: - if module_meta["min_version"] is None: - dependency = module_name - else: - dependency = "%s>=%s" % (module_name, module_meta["min_version"]) - install_requires.append(dependency) - return install_requires - - # Make sure everything is relative to setup.py install_path = os.path.dirname(os.path.abspath(__file__)) os.chdir(install_path) @@ -43,7 +18,6 @@ def get_reqs(lookup=None, key="INSTALL_REQUIRES"): # Get version information from the lookup lookup = get_lookup() VERSION = lookup["__version__"] -NAME = lookup["NAME"] AUTHOR = lookup["AUTHOR"] EMAIL = lookup["EMAIL"] PACKAGE_URL = lookup["PACKAGE_URL"] @@ -63,14 +37,7 @@ def get_reqs(lookup=None, key="INSTALL_REQUIRES"): ################################################################################ if __name__ == "__main__": - INSTALL_REQUIRES = get_reqs(lookup) - TESTS_REQUIRES = get_reqs(lookup, "TESTS_REQUIRES") - INSTALL_REQUIRES_ALL = get_reqs(lookup, "INSTALL_REQUIRES_ALL") - DOCKER_REQUIRES = get_reqs(lookup, "DOCKER_REQUIRES") - ECR_REQUIRES = get_reqs(lookup, "ECR_REQUIRES") - setup( - name=NAME, version=VERSION, author=AUTHOR, author_email=EMAIL, @@ -84,15 +51,6 @@ def get_reqs(lookup=None, key="INSTALL_REQUIRES"): long_description=LONG_DESCRIPTION, long_description_content_type="text/markdown", keywords=KEYWORDS, - setup_requires=[], - install_requires=INSTALL_REQUIRES, - tests_require=TESTS_REQUIRES, - extras_require={ - "all": [INSTALL_REQUIRES_ALL], - "tests": [TESTS_REQUIRES], - "docker": [DOCKER_REQUIRES], - "ecr": [ECR_REQUIRES], - }, classifiers=[ "Intended Audience :: Science/Research", "Intended Audience :: Developers", From cda353ab0ce254f9c934dc7e85ffcc95547cf80e Mon Sep 17 00:00:00 2001 From: Zach <4951117+zach-overflow@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:19:46 -0500 Subject: [PATCH 2/3] build: Replace setup.py with pyproject.toml metadata Signed-off-by: Zach <4951117+zach-overflow@users.noreply.github.com> --- setup.cfg => .flake8 | 0 .github/workflows/release.yaml | 6 ++-- CHANGELOG.md | 2 +- oras/version.py | 7 ---- pyproject.toml | 38 ++++++++++++++------ setup.py | 65 ---------------------------------- 6 files changed, 31 insertions(+), 87 deletions(-) rename setup.cfg => .flake8 (100%) delete mode 100644 setup.py diff --git a/setup.cfg b/.flake8 similarity index 100% rename from setup.cfg rename to .flake8 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 291eae6d..c641bce5 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -18,12 +18,12 @@ jobs: - name: Install dependencies run: | - pip install -e . - pip install setuptools wheel twine + python -m pip install --upgrade pip + python -m pip install build twine - name: Build and publish env: TWINE_USERNAME: ${{ secrets.PYPI_USER }} TWINE_PASSWORD: ${{ secrets.PYPI_PASS }} run: | - python setup.py sdist bdist_wheel + python -m build twine upload dist/* diff --git a/CHANGELOG.md b/CHANGELOG.md index 305c6108..ef8d5e34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and **Merged pull requests**. Critical items to know are: The versions coincide with releases on pip. Only major versions will be released as tags on Github. ## [0.0.x](https://github.com/oras-project/oras-py/tree/main) (0.0.x) - - declare install requirements and extras in `pyproject.toml` (PEP 621) instead of `oras/version.py`, and move test dependencies (now including `boto3`) from the `tests` extra and `all` to a `tests` dependency group (PEP 735) (0.2.44) + - remove `setup.py` and declare all package metadata, install requirements and extras in `pyproject.toml` (PEP 621), drop the packaging constants (`AUTHOR`, `DESCRIPTION`, etc.) from `oras/version.py`, move flake8 config from `setup.cfg` to `.flake8`, and move test dependencies (now including `boto3`) from the `tests` extra and `all` to a `tests` dependency group (PEP 735) (0.2.44) - clean up temporary directory archives after push and pull, including failed transfers (0.2.44) - make `username` and `password` optional in `login()` so the interactive prompts can be used, hide password entry and reject empty usernames, closes issue [235](https://github.com/oras-project/oras-py/issues/235) (0.2.44) - route push completion output through the logger and support the documented `quiet` option, closes issue [229](https://github.com/oras-project/oras-py/issues/229) (0.2.43) diff --git a/oras/version.py b/oras/version.py index a5896d42..1ad4cad3 100644 --- a/oras/version.py +++ b/oras/version.py @@ -3,10 +3,3 @@ __license__ = "Apache-2.0" __version__ = "0.2.44" -AUTHOR = "Vanessa Sochat" -EMAIL = "vsoch@users.noreply.github.com" -NAME = "oras" -PACKAGE_URL = "https://github.com/oras-project/oras-py" -KEYWORDS = "oci, registry, storage" -DESCRIPTION = "OCI Registry as Storage Python SDK" -LICENSE = "LICENSE" diff --git a/pyproject.toml b/pyproject.toml index 85102730..6f3317b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,19 +1,26 @@ [build-system] -requires = ["setuptools>=61.0"] +requires = ["setuptools>=77.0"] build-backend = "setuptools.build_meta" [project] name = "oras" -dynamic = [ - "version", - "authors", - "maintainers", - "description", - "readme", - "license", - "keywords", - "classifiers", - "urls", +dynamic = ["version"] +description = "OCI Registry as Storage Python SDK" +readme = "README.md" +license = "Apache-2.0" +license-files = ["LICENSE"] +authors = [{ name = "Vanessa Sochat", email = "vsoch@users.noreply.github.com" }] +maintainers = [{ name = "Vanessa Sochat" }] +keywords = ["oci", "registry", "storage"] +classifiers = [ + "Intended Audience :: Science/Research", + "Intended Audience :: Developers", + "Programming Language :: Python", + "Topic :: Software Development", + "Topic :: Scientific/Engineering", + "Operating System :: Unix", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.7", ] dependencies = [ "jsonschema", @@ -28,12 +35,21 @@ all = [ docker = ["docker==5.0.1"] ecr = ["boto3>=1.33.0"] +[project.urls] +Homepage = "https://github.com/oras-project/oras-py" + [dependency-groups] tests = [ "pytest>=4.6.2", "boto3>=1.33.0", ] +[tool.setuptools.dynamic] +version = { attr = "oras.version.__version__" } + +[tool.setuptools.packages.find] +include = ["oras*"] + [tool.black] profile = "black" exclude = '^env/' diff --git a/setup.py b/setup.py deleted file mode 100644 index dce4c6ee..00000000 --- a/setup.py +++ /dev/null @@ -1,65 +0,0 @@ -import os - -from setuptools import find_packages, setup - - -def get_lookup(): - lookup = dict() - version_file = os.path.join("oras", "version.py") - with open(version_file) as filey: - exec(filey.read(), lookup) - return lookup - - -# Make sure everything is relative to setup.py -install_path = os.path.dirname(os.path.abspath(__file__)) -os.chdir(install_path) - -# Get version information from the lookup -lookup = get_lookup() -VERSION = lookup["__version__"] -AUTHOR = lookup["AUTHOR"] -EMAIL = lookup["EMAIL"] -PACKAGE_URL = lookup["PACKAGE_URL"] -KEYWORDS = lookup["KEYWORDS"] -DESCRIPTION = lookup["DESCRIPTION"] -LICENSE = lookup["LICENSE"] - -# Try to read description, otherwise fallback to short description -try: - with open("README.md") as filey: - LONG_DESCRIPTION = filey.read() -except Exception: - LONG_DESCRIPTION = DESCRIPTION - -################################################################################ -# MAIN ######################################################################### -################################################################################ - -if __name__ == "__main__": - setup( - version=VERSION, - author=AUTHOR, - author_email=EMAIL, - maintainer=AUTHOR, - packages=find_packages(), - include_package_data=True, - zip_safe=False, - url=PACKAGE_URL, - license=LICENSE, - description=DESCRIPTION, - long_description=LONG_DESCRIPTION, - long_description_content_type="text/markdown", - keywords=KEYWORDS, - classifiers=[ - "Intended Audience :: Science/Research", - "Intended Audience :: Developers", - "License :: OSI Approved :: Apache Software License", - "Programming Language :: Python", - "Topic :: Software Development", - "Topic :: Scientific/Engineering", - "Operating System :: Unix", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.7", - ], - ) From bda8dba809b70b2d86b21b41233c62b01a075cf8 Mon Sep 17 00:00:00 2001 From: Zach <4951117+zach-overflow@users.noreply.github.com> Date: Thu, 12 Nov 2026 10:55:15 -0500 Subject: [PATCH 3/3] build: Require Python 3.9+ for setuptools>=77 Signed-off-by: Zach <4951117+zach-overflow@users.noreply.github.com> --- CHANGELOG.md | 2 +- pyproject.toml | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef8d5e34..85d046f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and **Merged pull requests**. Critical items to know are: The versions coincide with releases on pip. Only major versions will be released as tags on Github. ## [0.0.x](https://github.com/oras-project/oras-py/tree/main) (0.0.x) - - remove `setup.py` and declare all package metadata, install requirements and extras in `pyproject.toml` (PEP 621), drop the packaging constants (`AUTHOR`, `DESCRIPTION`, etc.) from `oras/version.py`, move flake8 config from `setup.cfg` to `.flake8`, and move test dependencies (now including `boto3`) from the `tests` extra and `all` to a `tests` dependency group (PEP 735) (0.2.44) + - remove `setup.py` and declare all package metadata, install requirements and extras in `pyproject.toml` (PEP 621), drop the packaging constants (`AUTHOR`, `DESCRIPTION`, etc.) from `oras/version.py`, move flake8 config from `setup.cfg` to `.flake8`, and move test dependencies (now including `boto3`) from the `tests` extra and `all` to a `tests` dependency group (PEP 735), and require Python 3.9+ (needed by `setuptools>=77`) (0.2.44) - clean up temporary directory archives after push and pull, including failed transfers (0.2.44) - make `username` and `password` optional in `login()` so the interactive prompts can be used, hide password entry and reject empty usernames, closes issue [235](https://github.com/oras-project/oras-py/issues/235) (0.2.44) - route push completion output through the logger and support the documented `quiet` option, closes issue [229](https://github.com/oras-project/oras-py/issues/229) (0.2.43) diff --git a/pyproject.toml b/pyproject.toml index 6f3317b1..08432fae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,6 +7,7 @@ name = "oras" dynamic = ["version"] description = "OCI Registry as Storage Python SDK" readme = "README.md" +requires-python = ">=3.9" license = "Apache-2.0" license-files = ["LICENSE"] authors = [{ name = "Vanessa Sochat", email = "vsoch@users.noreply.github.com" }] @@ -20,7 +21,11 @@ classifiers = [ "Topic :: Scientific/Engineering", "Operating System :: Unix", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] dependencies = [ "jsonschema",