From 79b1d8a220298012d0590dcd165089d673b81d10 Mon Sep 17 00:00:00 2001 From: Kurt McKee Date: Fri, 1 Nov 2024 18:13:42 -0500 Subject: [PATCH 1/2] Update tools and configurations --- .github/workflows/test.yaml | 32 ++++++------ .pre-commit-config.yaml | 18 +++++-- .../20240205_134734_kurtmckee_updates.rst | 2 +- pyproject.toml | 52 ++++++++++++------- tox.ini | 9 ++-- 5 files changed, 66 insertions(+), 47 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7f14000..1377afd 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,4 +1,4 @@ -name: "🔬 Test" +name: "🧪 Test" on: pull_request: null @@ -17,6 +17,7 @@ jobs: }})" strategy: + fail-fast: false matrix: runner: - "ubuntu-latest" @@ -24,25 +25,22 @@ jobs: - "windows-latest" # Each operating system should test all Python interpreters simultaneously. - # This nested-list syntax accomplishes that goal - # without creating cross-products of every possible OS and interpreter. # # Note: The CPython interpreter versions should be in ascending order # because the last-listed version will be the default CPython version. # - cpythons: - - - "3.8" - - "3.9" - - "3.10" - - "3.11" - - "3.12" - cpython-beta: - - "3.13" - pypys: - - - "3.8" - - "3.9" - - "3.10" - fail-fast: false + include: + - cpythons: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + - "3.12" + - "3.13" + pypys: + - "3.8" + - "3.9" + - "3.10" uses: "kurtmckee/github-workflows/.github/workflows/tox.yaml@420931a88d3f09ca8dbce4778d145ed610c231e0" # v0.4 with: @@ -53,6 +51,7 @@ jobs: name: "Inputs (${{ matrix.os.name }})" strategy: + fail-fast: false matrix: os: - name: "Linux" @@ -61,7 +60,6 @@ jobs: runner: "macos-latest" - name: "Windows" runner: "windows-latest" - fail-fast: false runs-on: "${{ matrix.os.runner }}" steps: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index babb127..136ead4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,9 @@ ci: autoupdate_schedule: "monthly" +default_language_version: + python: "python3.13" + repos: - repo: "meta" hooks: @@ -8,7 +11,7 @@ repos: - id: "check-useless-excludes" - repo: "https://github.com/pre-commit/pre-commit-hooks" - rev: "v4.6.0" + rev: "v5.0.0" hooks: - id: "check-yaml" - id: "check-added-large-files" @@ -23,8 +26,13 @@ repos: hooks: - id: "update-headers" + - repo: "https://github.com/sirosen/slyp" + rev: 0.8.1 + hooks: + - id: "slyp" + - repo: "https://github.com/psf/black-pre-commit-mirror" - rev: "24.8.0" + rev: "24.10.0" hooks: - id: "black" @@ -38,7 +46,7 @@ repos: hooks: - id: "flake8" additional_dependencies: - - "flake8-bugbear==24.8.19" + - "flake8-bugbear==24.10.31" - repo: "https://github.com/editorconfig-checker/editorconfig-checker.python" rev: "3.0.3" @@ -66,12 +74,12 @@ repos: pass_filenames: false - repo: "https://github.com/python-jsonschema/check-jsonschema" - rev: "0.29.2" + rev: "0.29.4" hooks: - id: "check-github-workflows" - id: "check-dependabot" - repo: "https://github.com/rhysd/actionlint" - rev: "v1.7.1" + rev: "v1.7.3" hooks: - id: "actionlint" diff --git a/changelog.d/20240205_134734_kurtmckee_updates.rst b/changelog.d/20240205_134734_kurtmckee_updates.rst index 4c2b9e5..4a63f17 100644 --- a/changelog.d/20240205_134734_kurtmckee_updates.rst +++ b/changelog.d/20240205_134734_kurtmckee_updates.rst @@ -1,4 +1,4 @@ Python support -------------- -* Test against early Python 3.13 versions in CI. +* Test against Python 3.13 versions in CI. diff --git a/pyproject.toml b/pyproject.toml index 94ef258..fe6f875 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,11 @@ +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + + +# poetry +# ------ + [tool.poetry] name = "detect_pythons" version = "1.1.0" @@ -6,15 +14,27 @@ authors = ["Kurt McKee "] license = "MIT" readme = "README.rst" - [tool.poetry.dependencies] python = ">=3.8" -[build-system] -requires = ["poetry-core"] -build-backend = "poetry.core.masonry.api" +# chipshot +# -------- + +[tool.chipshot] +template = """ +This file is a part of the detect-pythons project. +https://github.com/kurtmckee/detect-pythons +Copyright 2023-{{ year }} Kurt McKee +SPDX-License-Identifier: MIT +""" +exclusions = [ + "changelog.d/", +] + +# coverage +# -------- [tool.coverage.run] parallel = true @@ -24,28 +44,31 @@ source = [ "tests", ] - [tool.coverage.paths] source = [ "src", "*/site-packages", ] - [tool.coverage.report] skip_covered = true fail_under = 100 - [tool.coverage.html] skip_covered = false directory = "htmlcov/" +# isort +# ----- + [tool.isort] profile = "black" +# pytest +# ------ + [tool.pytest.ini_options] addopts = "--color=yes" filterwarnings = [ @@ -53,6 +76,9 @@ filterwarnings = [ ] +# scriv +# ----- + [tool.scriv] version = "literal: pyproject.toml: tool.poetry.version" categories = [ @@ -70,15 +96,3 @@ fragment_directory = "changelog.d" insert_marker = "scriv-insert-here" main_branches = ["main", "releases"] new_fragment_template = "file: fragment-template.rst.txt" - - -[tool.chipshot] -template = """ -This file is a part of the detect-pythons project. -https://github.com/kurtmckee/detect-pythons -Copyright 2023-{{ year }} Kurt McKee -SPDX-License-Identifier: MIT -""" -exclusions = [ - "changelog.d/", -] diff --git a/tox.ini b/tox.ini index 642237a..66e8da8 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,8 @@ min_version = 4.3.5 envlist = coverage_erase - py{3.13, 3.12, 3.11, 3.10, 3.9, 3.8, py3.10, py3.9, py3.8} + py{3.13, 3.12, 3.11, 3.10, 3.9, 3.8} + pypy{3.10, 3.9, 3.8} coverage_report labels = update=update @@ -13,7 +14,7 @@ package = wheel wheel_build_env = build_wheel depends = - py{3.13, 3.12, 3.11, 3.10, 3.9, 3.8, py3.10, py3.9, py3.8}: coverage_erase + py{3.13, 3.12, 3.11, 3.10, 3.9, 3.8}, pypy{3.10, 3.9, 3.8}: coverage_erase deps = coverage[toml] pytest @@ -23,7 +24,6 @@ commands = [testenv:coverage_erase] -skipsdist = true skip_install = true deps = coverage[toml] commands = coverage erase @@ -31,8 +31,7 @@ commands = coverage erase [testenv:coverage_report] depends = - py{3.13, 3.12, 3.11, 3.10, 3.9, 3.8, py3.10, py3.9, py3.8} -skipsdist = true + py{3.13, 3.12, 3.11, 3.10, 3.9, 3.8}, pypy{3.10, 3.9, 3.8} skip_install = true deps = coverage[toml] commands_pre = From 64a30f8b62bd03fd178ac1cf623820c6afdc96b4 Mon Sep 17 00:00:00 2001 From: Kurt McKee Date: Fri, 1 Nov 2024 18:25:42 -0500 Subject: [PATCH 2/2] Update the README --- README.rst | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/README.rst b/README.rst index ce75e5d..1688f82 100644 --- a/README.rst +++ b/README.rst @@ -154,8 +154,8 @@ System CPython interpreters --------------------------- GitHub's Linux and macOS runners have system CPython interpreters installed. -These are available at paths like ``/usr/bin/python``, -which contains no useful information. +These are available at paths which contain no useful information, +like ``/usr/bin/python``. For these interpreters, the interpreter is executed and the value of ``sysconfig.get_config_var("EXT_SUFFIX")`` is extracted. @@ -167,25 +167,11 @@ This results in a value like the following: "Linux", "``.cpython-310-x86_64-linux-gnu.so``" "macOS", "``.cpython-311-darwin.so``" - -macOS runner variability ------------------------- - -At the time of writing, GitHub's macOS runners sometimes have CPython 2.7 pre-installed. -CPython 2.7 doesn't have an ``EXT_SUFFIX`` config value, -so ``detect-pythons`` constructs one. +Extremely old Python versions might not have an ``EXT_SUFFIX`` value. +For example, CPython 2.7 doesn't have this value. +If this is detected then an equivalent value is constructed. .. csv-table:: :header: "Platform", "Constructed ``EXT_SUFFIX`` equivalent" - "macOS 12.6", "``.cpython-27-darwin-x86_64``" - -Note that CPython 2.7 is only installed *sometimes*; sometimes it isn't. -This is because ``macos-latest`` is sometimes macOS 12.6, and sometimes it's macOS 12.7. -See actions/runner-images#8642 for more information. - -When using ``detect-pythons`` to help with cache-busting, -this variability means that you may see two caches appear in regular use -for your macOS-based workflows; -one that is valid when CPython 2.7 is pre-installed, -and another that is valid when it *isn't* installed. + "macOS", "``.cpython-27-darwin-x86_64``"