From 671f04d4ec357d6f501bfa7ef76046aa957c6dd1 Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Wed, 27 Nov 2024 14:41:57 +0100 Subject: [PATCH 1/2] Switch away from setup.py --- CONTRIBUTING.md | 15 ++++++++++++ CONTRIBUTING.rst | 47 ------------------------------------- MANIFEST.in | 1 + pyproject.toml | 60 ++++++++++++++++++++++++++++++++++++++++-------- requirements.txt | 4 ---- setup.py | 38 ------------------------------ 6 files changed, 67 insertions(+), 98 deletions(-) create mode 100644 CONTRIBUTING.md delete mode 100644 CONTRIBUTING.rst delete mode 100644 requirements.txt delete mode 100644 setup.py diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..382e21ad --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,15 @@ +## Contributing + +We have provided detailed documentation for ways in which you can +contribute to Pulp here: +https://docs.pulpproject.org/contributing/ + +This documentation includes: + +* Suggestions of how to contribute +* How we track bugs +* Ways to get in touch with other contributors who can advise you +* A contribution checklist +* A developer guide + +Join us! We look forward to hearing from you. diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst deleted file mode 100644 index 20948fe4..00000000 --- a/CONTRIBUTING.rst +++ /dev/null @@ -1,47 +0,0 @@ -Community ---------- - -This plugin exists to serve the community. If we can do more for your use case, please let us know! -Also, contributions are greatly appreciated in the form of: - - 1. `Github Issues `_ - 2. `Github Pull Requests `_ - 3. `Helping other users `_ - -We can usually be found on Matrix in `#pulp-dev`, `#pulp`, and `#pulp-python`. - -Contributing -============ - -To contribute to the ``pulp_python`` package follow this process: - -1. Clone the GitHub repo -2. Make a change -3. Make sure all tests passed -4. Add a file into CHANGES folder (Changelog update). -5. Commit changes to own ``pulp_python`` clone -6. Make pull request from github page for your clone against master branch - - -.. _changelog-update: - -Changelog update -**************** - -The CHANGES.rst file is managed using the `towncrier tool `_ -and all non trivial changes must be accompanied by a news entry. - -To add an entry to the news file, you first need an issue in pulp.plan.io describing the change you -want to make. Once you have an issue, take its number and create a file inside of the ``CHANGES/`` -directory named after that issue number with an extension of .feature, .bugfix, .doc, .removal, or -.misc. So if your issue is 3543 and it fixes a bug, you would create the file -``CHANGES/3543.bugfix``. - -PRs can span multiple categories by creating multiple files (for instance, if you added a feature -and deprecated an old feature at the same time, you would create CHANGES/NNNN.feature and -CHANGES/NNNN.removal). Likewise if a PR touches multiple issues/PRs you may create a file for each -of them with the exact same contents and Towncrier will deduplicate them. - -The contents of this file are reStructuredText formatted text that will be used as the content of -the news file entry. You do not need to reference the issue or PR numbers here as towncrier will -automatically add a reference to all of the affected issues when rendering the news file. diff --git a/MANIFEST.in b/MANIFEST.in index e519d8a0..82301a4a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,6 +3,7 @@ include requirements.txt include pyproject.toml include CHANGES.md include COMMITMENT +exclude CONTRIBUTING.md include COPYRIGHT include functest_requirements.txt include test_requirements.txt diff --git a/pyproject.toml b/pyproject.toml index aa7d274c..c34e5417 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,51 @@ +[build-system] +requires = [ + "setuptools >= 40.8.0", + "wheel >= 0.29.0", +] +build-backend = 'setuptools.build_meta' + +[project] +name = "pulp_python" +version = "3.13.0.dev" +description = "pulp-python plugin for the Pulp Project" +readme = "README.md" +authors = [ + {name="Pulp Team", email="pulp-list@redhat.com"}, +] +classifiers=[ + "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", + "Operating System :: POSIX :: Linux", + "Development Status :: 5 - Production/Stable", + "Framework :: Django", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", +] +requires-python = ">=3.9" +dependencies = [ + "pulpcore>=3.49.0,<3.70", + "pkginfo>=1.10.0,<1.12.0", # Twine has <1.11 in their requirements + "bandersnatch>=6.3,<7.0", # Anything >6.3 requires Python 3.10+ + "pypi-simple>=1.5.0,<2.0", +] + +[project.urls] +Homepage = "https://pulpproject.org" +Documentation = "https://pulpproject.org/pulp_python/" +Repository = "https://github.com/pulp/pulp_python" +"Bug Tracker" = "https://github.com/pulp/pulp_python/issues" +Changelog = "https://pulpproject.org/pulp_python/changes/" + +[project.entry-points."pulpcore.plugin"] +pulp_python = "pulp_python:default_app_config" + +[project.entry-points."pytest11"] +pulp_python = "pulp_python.pytest_plugin" + +[tool.setuptools.packages.find] +where = ["."] + [tool.towncrier] package = "pulp_python" filename = "CHANGES.md" @@ -10,21 +58,15 @@ underlines = ["", "", ""] [tool.check-manifest] ignore = [ - ".bumpversion.cfg", - ".pep8speaks.yml", "CHANGES/**", - "CONTRIBUTING.rst", - "HISTORY.rst", "dev_requirements.txt", "doc_requirements.txt", "docs/**", - "staging_docs/**", "template_config.yml", - ".travis/**", - ".travis.yml", + ".pep8speaks.yml", "shelf_reader-0.1-py2-none-any.whl", - ".github/**", ".ci/**", + ".github/**", "lint_requirements.txt", ".flake8", ] @@ -58,4 +100,4 @@ search = "version = \"{current_version}\"" replace = "version = \"{new_version}\"" [[tool.bumpversion.files]] -filename = "./setup.py" \ No newline at end of file +filename = "./setup.py" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index c99e1c3d..00000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -pulpcore>=3.49.0,<3.70.0 -pkginfo>=1.10.0,<1.12.0 # Twine has <1.11 in their requirements -bandersnatch>=6.3,<7.0 # Anything >6.3 requires Python 3.10+ -pypi-simple>=1.5.0,<2.0 diff --git a/setup.py b/setup.py deleted file mode 100644 index 127bf0a6..00000000 --- a/setup.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python3 - -from setuptools import setup, find_packages - -with open("requirements.txt") as requirements: - requirements = requirements.readlines() - -with open("README.md") as f: - long_description = f.read() - -setup( - name="pulp-python", - version="3.13.0.dev", - description="pulp-python plugin for the Pulp Project", - long_description=long_description, - long_description_content_type="text/markdown", - license="GPLv2+", - python_requires=">=3.9", - author="Pulp Project Developers", - author_email="pulp-list@redhat.com", - url="https://www.pulpproject.org", - install_requires=requirements, - include_package_data=True, - packages=find_packages(exclude=["tests"]), - classifiers=( - "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", - "Operating System :: POSIX :: Linux", - "Development Status :: 5 - Production/Stable", - "Framework :: Django", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - ), - entry_points={ - "pulpcore.plugin": ["pulp_python = pulp_python:default_app_config"], - "pytest11": ["pulp_python = pulp_python.pytest_plugin"], - }, -) From ce8ffe8368abf3dd034a4a63267cc6cdae71b324 Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Wed, 27 Nov 2024 14:49:12 +0100 Subject: [PATCH 2/2] Apply plugin template --- .ci/scripts/check_release.py | 5 ++- .ci/scripts/check_requirements.py | 5 ++- .github/template_gitref | 2 +- .github/workflows/scripts/before_install.sh | 6 ++-- .../workflows/scripts/publish_plugin_pypi.sh | 4 +-- HISTORY.rst | 34 ------------------- pyproject.toml | 6 +++- 7 files changed, 19 insertions(+), 43 deletions(-) delete mode 100644 HISTORY.rst diff --git a/.ci/scripts/check_release.py b/.ci/scripts/check_release.py index 095dd739..da45be6a 100755 --- a/.ci/scripts/check_release.py +++ b/.ci/scripts/check_release.py @@ -37,7 +37,10 @@ def template_config(): def current_version(repo, commitish): try: pyproject_toml = tomllib.loads(repo.git.show(f"{commitish}:pyproject.toml")) - current_version = pyproject_toml["project"]["version"] + try: + current_version = pyproject_toml["project"]["version"] + except Exception: + current_version = pyproject_toml["tool"]["bumpversion"]["current_version"] except Exception: current_version = repo.git.grep( "current_version", commitish, "--", ".bumpversion.cfg" diff --git a/.ci/scripts/check_requirements.py b/.ci/scripts/check_requirements.py index ec871a10..cf9efbe9 100755 --- a/.ci/scripts/check_requirements.py +++ b/.ci/scripts/check_requirements.py @@ -62,7 +62,10 @@ def main(): else: if check_prereleases and req.specifier.prereleases: # Do not even think about begging for more exceptions! - if req.name != "pulp-python-client": + if ( + not req.name.startswith("opentelemetry") + and req.name != "pulp-python-client" + ): errors.append(f"{filename}:{nr}: Prerelease versions found in {line}.") ops = [spec.operator for spec in req.specifier] if "~=" in ops: diff --git a/.github/template_gitref b/.github/template_gitref index 8156a7ac..a119226d 100644 --- a/.github/template_gitref +++ b/.github/template_gitref @@ -1 +1 @@ -2021.08.26-399-g78ad960 +2021.08.26-403-g76d04d7 diff --git a/.github/workflows/scripts/before_install.sh b/.github/workflows/scripts/before_install.sh index c31ec734..4cc50fb8 100755 --- a/.github/workflows/scripts/before_install.sh +++ b/.github/workflows/scripts/before_install.sh @@ -30,7 +30,7 @@ fi COMMIT_MSG=$(git log --format=%B --no-merges -1) export COMMIT_MSG -COMPONENT_VERSION=$(sed -ne "s/\s*version.*=.*['\"]\(.*\)['\"][\s,]*/\1/p" setup.py) +COMPONENT_VERSION=$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])") mkdir .ci/ansible/vars || true echo "---" > .ci/ansible/vars/main.yaml @@ -61,10 +61,10 @@ then fi if [[ "$TEST" = "pulp" ]]; then - python3 .ci/scripts/calc_constraints.py -u requirements.txt > upperbounds_constraints.txt + python3 .ci/scripts/calc_constraints.py -u pyproject.toml > upperbounds_constraints.txt fi if [[ "$TEST" = "lowerbounds" ]]; then - python3 .ci/scripts/calc_constraints.py requirements.txt > lowerbounds_constraints.txt + python3 .ci/scripts/calc_constraints.py pyproject.toml > lowerbounds_constraints.txt fi if [ -f $POST_BEFORE_INSTALL ]; then diff --git a/.github/workflows/scripts/publish_plugin_pypi.sh b/.github/workflows/scripts/publish_plugin_pypi.sh index 1dd7d883..384cecb2 100755 --- a/.github/workflows/scripts/publish_plugin_pypi.sh +++ b/.github/workflows/scripts/publish_plugin_pypi.sh @@ -28,6 +28,6 @@ then fi twine upload -u __token__ -p "$PYPI_API_TOKEN" \ -"dist/pulp_python-$VERSION-py3-none-any.whl" \ -"dist/pulp-python-$VERSION.tar.gz" \ +dist/pulp?python-"$VERSION"-py3-none-any.whl \ +dist/pulp?python-"$VERSION".tar.gz \ ; diff --git a/HISTORY.rst b/HISTORY.rst deleted file mode 100644 index 2715edce..00000000 --- a/HISTORY.rst +++ /dev/null @@ -1,34 +0,0 @@ -3.0.0b6 -======= - -* See all changes `here `_. - -* Adds support for `pulpcore 3.0.0.rc2 `_. - - Changes urls for distributions and publications - -* Adds lazy sync - -* Docs replace snippets with testable scripts - -3.0.0b5 -======= - -* Fix relative_path to allow pip install - -3.0.0b4 -======= - -* Adds support for `pulpcore 3.0.0.rc1 `_. - -* Adds excludes support (aka 'blacklist') - - Renames the "projects" field on the remote to "includes". - - Adds a new "excludes" field to the remote which behaves like "includes", except that any specified - releasees or digests are not synced, even if an include specifier matches them. - - Also adds a 'prereleases' field to the remote, which toggles whether prerelease versions should be - synced. This mirrors the 'prereleases' flag that packaging.specifiers.SpecifierSet provides. - -* Removes Python 3.5 support diff --git a/pyproject.toml b/pyproject.toml index c34e5417..eec625fa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -100,4 +100,8 @@ search = "version = \"{current_version}\"" replace = "version = \"{new_version}\"" [[tool.bumpversion.files]] -filename = "./setup.py" +# This section is managed by the plugin template. Do not edit manually. + +filename = "./pyproject.toml" +search = "version = \"{current_version}\"" +replace = "version = \"{new_version}\"" \ No newline at end of file