From 600712dfdf7d28fdd85a91a1c64896ec689ae9f3 Mon Sep 17 00:00:00 2001 From: David Salvisberg Date: Wed, 21 Aug 2024 09:44:51 +0200 Subject: [PATCH] Drops 3.7 support, adds 3.12 and 3.13 support. Modernizes configuration. Switches to trusted publishers. --- .coveragerc | 12 --- .github/workflows/python-pr.yaml | 6 +- .github/workflows/python-publish.yaml | 30 +++++--- .github/workflows/python-tox.yaml | 6 +- pyproject.toml | 105 ++++++++++++++++++++++++++ setup.py | 68 +---------------- tox.ini | 36 --------- 7 files changed, 132 insertions(+), 131 deletions(-) delete mode 100644 .coveragerc create mode 100644 pyproject.toml delete mode 100644 tox.ini diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 2bd7a47..0000000 --- a/.coveragerc +++ /dev/null @@ -1,12 +0,0 @@ -[paths] -source = - src - */site-packages - -[run] -source = - pytest_codecov - -[report] -show_missing = true -precision = 2 diff --git a/.github/workflows/python-pr.yaml b/.github/workflows/python-pr.yaml index 04067c5..35b7060 100644 --- a/.github/workflows/python-pr.yaml +++ b/.github/workflows/python-pr.yaml @@ -8,13 +8,13 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9, '3.10', '3.11'] + python-version: [3.8, 3.9, '3.10', '3.11', '3.12', '3.13'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/python-publish.yaml b/.github/workflows/python-publish.yaml index 75af208..0d471c5 100644 --- a/.github/workflows/python-publish.yaml +++ b/.github/workflows/python-publish.yaml @@ -9,20 +9,28 @@ jobs: runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/project/pytest-codecov + + permissions: + id-token: write + steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: '3.x' + python-version: "3.x" + - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - python setup.py sdist bdist_wheel - twine upload dist/* + pip install build + + - name: Build package distributions + run: python -m build -s -w + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/python-tox.yaml b/.github/workflows/python-tox.yaml index 7839f1e..69ffcc4 100644 --- a/.github/workflows/python-tox.yaml +++ b/.github/workflows/python-tox.yaml @@ -8,10 +8,10 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9, '3.10', '3.11'] + python-version: [3.8, 3.9, '3.10', '3.11', '3.12', '3.13'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Get branch name (merge) if: github.event_name != 'pull_request' @@ -28,7 +28,7 @@ jobs: >> $GITHUB_ENV - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1f79b62 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,105 @@ +[build-system] +requires = [ + "setuptools>=61.0.0", +] +build-backend = "setuptools.build_meta" + +[project] +name = "pytest-codecov" +dynamic = ["version"] +description = "Pytest plugin for uploading pytest-cov results to codecov.io" +readme = "README.rst" +requires-python = ">=3.8" +authors = [ + { name = "David Salvisberg", email = "david.salvisberg@seantis.ch" }, +] +maintainers = [ + { name = "David Salvisberg", email = "david.salvisberg@seantis.ch" }, +] +license = {file = "LICENSE"} +classifiers = [ + "Framework :: Pytest", + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Topic :: Software Development :: Testing", + "Operating System :: OS Independent", + "Programming Language :: Python", + "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", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "License :: OSI Approved :: MIT License", +] +dependencies = [ + "pytest>=4.6.0", + "pytest-cov>=2.11.0", + "coverage[toml]>=5.2.1", + "requests>=2.25.1", +] + +[project.optional-dependencies] +git = [ + "GitPython>=3.1.15", +] + +[project.urls] +Repository = "https://github.com/seantis/pytest-codecov" + +[project.entry-points.pytest11] +codecov = "pytest_codecov" + +[tool.setuptools.dynamic] +version = {attr = "pytest_codecov.__version__"} + +[tool.coverage.paths] +source = ["src"] + +[tool.coverage.run] +source = ["pytest_codecov"] + +[tool.coverage.report] +show_missing = true +precision = 2 + +[tool.tox] +legacy_tox_ini = """ + [tox] + envlist = py38,py39,py310,py311,py312,py313,flake8,report + + [gh-actions] + python = + 3.8: py38,flake8 + 3.9: py39 + 3.10: py310 + 3.11: py311 + 3.12: py312 + 3.13: py313 + + [testenv] + setenv = + py{38,39,310,311,312,313}: COVERAGE_FILE = .coverage.{envname} + commands = pytest --cov --cov-report= {posargs:tests} + deps = + pytest + coverage + pytest-cov + . + GitPython + + [testenv:flake8] + skip_install = true + deps = flake8 + commands = flake8 src setup.py tests + + [testenv:report] + deps = coverage + skip_install = true + commands = + coverage combine + coverage report +""" diff --git a/setup.py b/setup.py index 2e848a2..6068493 100644 --- a/setup.py +++ b/setup.py @@ -1,67 +1,3 @@ -#!/usr/bin/env python -import codecs -import os -from glob import glob -from os.path import basename -from os.path import splitext -from setuptools import setup, find_packages +from setuptools import setup - -def read(fname): - file_path = os.path.join(os.path.dirname(__file__), fname) - return codecs.open(file_path, encoding='utf-8').read() - - -setup( - name='pytest-codecov', - version='0.5.1', - author='David Salvisberg', - author_email='david.salvisberg@seantis.ch', - maintainer='David Salvisberg', - maintainer_email='david.salvisberg@seantis.ch', - license='MIT', - url='https://github.com/seantis/pytest-codecov', - description='Pytest plugin for uploading pytest-cov results to codecov.io', - long_description=read('README.rst'), - packages=find_packages('src'), - package_dir={'': 'src'}, - py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')], - include_package_data=True, - python_requires='>=3.5', - install_requires=[ - 'pytest>=4.6.0', - 'pytest-cov>=2.11.0', - 'coverage[toml]>=5.2.1', - 'requests>=2.25.1' - ], - tests_require=[ - 'GitPython>=3.1.15' - ], - extras_require={ - 'git': [ - 'GitPython>=3.1.15' - ], - }, - classifiers=[ - 'Development Status :: 4 - Beta', - 'Framework :: Pytest', - 'Intended Audience :: Developers', - 'Topic :: Software Development :: Testing', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - '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 :: Only', - 'Programming Language :: Python :: Implementation :: CPython', - 'Operating System :: OS Independent', - 'License :: OSI Approved :: MIT License', - ], - entry_points={ - 'pytest11': [ - 'codecov = pytest_codecov', - ], - }, -) +setup() diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 4d70698..0000000 --- a/tox.ini +++ /dev/null @@ -1,36 +0,0 @@ -[tox] -envlist = py36,py37,py38,py39,py310,flake8,report - -[tool:pytest] -testpaths = tests - -[gh-actions] -python = - 3.7: py37 - 3.8: py38,flake8 - 3.9: py39 - 3.10: py310 - 3.11: py311 - -[testenv] -setenv = - py{37,38,39,310,311}: COVERAGE_FILE = .coverage.{envname} -commands = pytest --cov --cov-report= {posargs:-vv} -deps = - pytest - coverage - pytest-cov - . - GitPython - -[testenv:flake8] -skip_install = true -deps = flake8 -commands = flake8 src setup.py tests - -[testenv:report] -deps = coverage -skip_install = true -commands = - coverage combine - coverage report