From e2e7c392d92c645ed005bd2d6dbc3397f9b50aed Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Mon, 18 Dec 2023 14:11:39 +0200 Subject: [PATCH 1/2] Add tox for easy testing of many Python versions --- .github/workflows/lint.yml | 20 +++++++++++++++++++ .github/workflows/tests.yml | 24 +++++++++++----------- .pre-commit-config.yaml | 22 ++++++++++++++++++++ blurb/pyproject.toml | 40 ++++++++++++++++++++++++------------- blurb/tox.ini | 21 +++++++++++++++++++ 5 files changed, 101 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 .pre-commit-config.yaml create mode 100644 blurb/tox.ini diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..dae63b0 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,20 @@ +name: Lint + +on: [push, pull_request, workflow_dispatch] + +env: + FORCE_COLOR: 1 + +permissions: + contents: read + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.x" + - uses: pre-commit/action@v3.0.0 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8867629..455d84e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,7 +6,7 @@ env: FORCE_COLOR: 1 jobs: - build_ubuntu: + test: strategy: fail-fast: false matrix: @@ -15,27 +15,27 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} allow-prereleases: true cache: pip - cache-dependency-path: ".github/workflows/tests.yml" - - name: setup + + - name: Install dependencies run: | python --version python -m pip install --upgrade pip - python -m pip install --upgrade pytest pytest-cov pyfakefs - - name: install + python -m pip install --upgrade tox + + - name: Tox tests run: | cd blurb + tox -e py + python -m pip install -e . - - name: test - run: | - blurb test - - name: pytest - run: | - python -I -m pytest --cov blurb + - name: Upload coverage uses: codecov/codecov-action@v3 with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..3aea1fd --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,22 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-case-conflict + - id: check-merge-conflict + - id: check-toml + - id: check-yaml + - id: debug-statements + + - repo: https://github.com/tox-dev/tox-ini-fmt + rev: 1.3.1 + hooks: + - id: tox-ini-fmt + + - repo: meta + hooks: + - id: check-hooks-apply + - id: check-useless-excludes + +ci: + autoupdate_schedule: quarterly diff --git a/blurb/pyproject.toml b/blurb/pyproject.toml index 2bcee4f..68a8963 100644 --- a/blurb/pyproject.toml +++ b/blurb/pyproject.toml @@ -1,21 +1,33 @@ [build-system] -requires = ["flit_core >=2,<4"] build-backend = "flit_core.buildapi" +requires = [ + "flit_core<4,>=2", +] -[tool.flit.metadata] -module = "blurb" -author = "Larry Hastings" -author-email = "larry@hastings.org" -maintainer = "Python Core Developers" -maintainer-email = "core-workflow@mail.python.org" -home-page = "https://github.com/python/core-workflow/tree/main/blurb" +[project] +name = "blurb" +description = "Command-line tool to manage CPython Misc/NEWS.d entries." +readme = "README.rst" +maintainers = [{name = "Python Core Developers", email="core-workflow@mail.python.org"}] +authors = [{ name="Larry Hastings", email="larry@hastings.org"}] requires-python = ">=3.8" -description-file = "README.rst" classifiers = [ - "Intended Audience :: Developers", - "License :: OSI Approved :: BSD License", - "Programming Language :: Python :: 3 :: Only" + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Programming Language :: Python :: 3 :: Only", ] - -[tool.flit.scripts] +dynamic = [ + "version", +] +[project.optional-dependencies] +tests = [ + "pyfakefs", + "pytest", + "pytest-cov", +] +[project.urls] +Changelog = "https://github.com/python/core-workflow/tree/main/blurb#changelog" +Homepage = "https://github.com/python/core-workflow/tree/main/blurb" +Source = "https://github.com/python/core-workflow/tree/main/blurb" +[project.scripts] blurb = "blurb:main" diff --git a/blurb/tox.ini b/blurb/tox.ini new file mode 100644 index 0000000..29d8a8a --- /dev/null +++ b/blurb/tox.ini @@ -0,0 +1,21 @@ +[tox] +requires = + tox>=4.2 +env_list = + py{313, 312, 311, 310, 39, 38} + +[testenv] +extras = + tests +pass_env = + FORCE_COLOR +commands = + {envpython} -I -m pytest \ + --cov blurb \ + --cov tests \ + --cov-report html \ + --cov-report term \ + --cov-report xml \ + {posargs} + blurb test + blurb help From 73f4aaa6150b5f66f8af8059b00168dcccf6cdaa Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 16 Jan 2024 08:31:22 +0200 Subject: [PATCH 2/2] Test Python 3.13 --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 455d84e..7e764d1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] name: ${{ matrix.python-version }} runs-on: ubuntu-latest steps: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy