From aa26ab61436324b1fa9515b203eec82320662451 Mon Sep 17 00:00:00 2001 From: Brian Okken <1568356+okken@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:01:56 -0700 Subject: [PATCH] setup.py removal (#72) * simplify build and release * setup.py -> pyproject.toml --- .github/RELEASING.md | 8 ++++++ .github/workflows/pypi-package.yml | 41 ++++++++++++++++++++++++++ MANIFEST.in | 1 - pyproject.toml | 46 ++++++++++++++++++++++++++++-- pytest_repeat.py | 2 +- setup.py | 36 ----------------------- tox.ini | 11 ++++--- 7 files changed, 99 insertions(+), 46 deletions(-) create mode 100644 .github/RELEASING.md create mode 100644 .github/workflows/pypi-package.yml delete mode 100644 MANIFEST.in delete mode 100644 setup.py diff --git a/.github/RELEASING.md b/.github/RELEASING.md new file mode 100644 index 000000000..71e1f61e9 --- /dev/null +++ b/.github/RELEASING.md @@ -0,0 +1,8 @@ +Here are the steps on how to make a new release. + +1. Create a `release-VERSION` branch from `upstream/main`. +2. Update `CHANGELOG.rst`. +3. Push the branch to `upstream`. +4. Once all tests pass, merge the PR. +5. Once the PR completes, create a Release with a new version tag on GitHub. + Version should be in the form of "vx.y.z". ex: v0.9.2 diff --git a/.github/workflows/pypi-package.yml b/.github/workflows/pypi-package.yml new file mode 100644 index 000000000..1f2607930 --- /dev/null +++ b/.github/workflows/pypi-package.yml @@ -0,0 +1,41 @@ +--- +name: Build & maybe upload PyPI package + +on: + release: + types: [published] + workflow_dispatch: + +permissions: + contents: read + id-token: write + +jobs: + build-package: + name: Build & verify package + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: hynek/build-and-inspect-python-package@v1 + + # Upload to real PyPI on GitHub Releases. + release-pypi: + name: Publish released package to pypi.org + environment: release-pypi + if: github.repository_owner == 'pytest-dev' && github.event.action == 'published' + runs-on: ubuntu-latest + needs: build-package + + steps: + - name: Download packages built by build-and-inspect-python-package + uses: actions/download-artifact@v3 + with: + name: Packages + path: dist + + - name: Upload package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index bec201fc8..000000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include pyproject.toml diff --git a/pyproject.toml b/pyproject.toml index 91cda87b2..3826f3bee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,45 @@ +[project] +name = "pytest-repeat" +description = "pytest plugin for repeating tests" +readme = "README.rst" +license = {file = "LICENSE"} +authors = [{name = "Bob Silverberg"}] +requires-python = ">=3.7" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Framework :: Pytest", + "Intended Audience :: Developers", + "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX", + "Programming Language :: Python", + "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", + "Programming Language :: Python :: 3.12", + "Topic :: Software Development :: Quality Assurance", + "Topic :: Software Development :: Testing", + "Topic :: Utilities", +] +dynamic = [ "version" ] +dependencies = [ "pytest" ] + +[project.urls] +Home = "https://github.com/pytest-dev/pytest-repeat" + +[project.entry-points.pytest11] +repeat = "pytest_repeat" + + + [build-system] -requires = ["setuptools>=40.8.0", "wheel", "setuptools_scm"] -build-backend = 'setuptools.build_meta' +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" + +[tool.hatch.version] +source = "vcs" + diff --git a/pytest_repeat.py b/pytest_repeat.py index 7727fa2e8..008b692bf 100644 --- a/pytest_repeat.py +++ b/pytest_repeat.py @@ -34,7 +34,7 @@ class UnexpectedError(Exception): pass -@pytest.fixture +@pytest.fixture() def __pytest_repeat_step_number(request): marker = request.node.get_closest_marker("repeat") count = marker and marker.args[0] or request.config.option.count diff --git a/setup.py b/setup.py deleted file mode 100644 index f1235ff43..000000000 --- a/setup.py +++ /dev/null @@ -1,36 +0,0 @@ -from setuptools import setup - -setup(name='pytest-repeat', - use_scm_version=True, - description='pytest plugin for repeating tests', - long_description=open('README.rst').read(), - long_description_content_type='text/x-rst', - author='Bob Silverberg', - author_email='bsilverberg@mozilla.com', - url='https://github.com/pytest-dev/pytest-repeat', - py_modules=['pytest_repeat'], - entry_points={'pytest11': ['repeat = pytest_repeat']}, - setup_requires=['setuptools_scm'], - install_requires=['pytest>=3.6'], - license='Mozilla Public License 2.0 (MPL 2.0)', - keywords='pytest pytest repeat', - python_requires='>=3.7', - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Framework :: Pytest', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)', - 'Operating System :: POSIX', - 'Operating System :: Microsoft :: Windows', - 'Operating System :: MacOS :: MacOS X', - 'Topic :: Software Development :: Quality Assurance', - 'Topic :: Software Development :: Testing', - 'Topic :: Utilities', - 'Programming Language :: Python', - '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', - 'Programming Language :: Python :: 3.12', - ]) diff --git a/tox.ini b/tox.ini index aeadccc8b..b207a451d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,24 +1,23 @@ -# Tox (https://tox.readthedocs.io/) is a tool for running tests -# in multiple virtualenvs. This configuration file will run the -# test suite on all supported python versions. To use it, "pip install tox" -# and then run "tox" from this directory. - [tox] -minversion = 3.4.0 +minversion = 4.0 isolated_build = true envlist = py{37,38,39,310,311,312,py3}-pytest7 py37-pytest{4,5,6} flake8 + [testenv] commands = pytest {posargs} +package = wheel +wheel_build_env = .pkg deps = pytest4: pytest~=4.6 pytest5: pytest~=5.4 pytest6: pytest~=6.2 pytest7: pytest>=7 + [testenv:flake8] basepython = py311 deps = flake8