Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 15 additions & 17 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "🔬 Test"
name: "🧪 Test"

on:
pull_request: null
Expand All @@ -17,32 +17,30 @@ jobs:
}})"

strategy:
fail-fast: false
matrix:
runner:
- "ubuntu-latest"
- "macos-latest"
- "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:
Expand All @@ -53,6 +51,7 @@ jobs:
name: "Inputs (${{ matrix.os.name }})"

strategy:
fail-fast: false
matrix:
os:
- name: "Linux"
Expand All @@ -61,7 +60,6 @@ jobs:
runner: "macos-latest"
- name: "Windows"
runner: "windows-latest"
fail-fast: false

runs-on: "${{ matrix.os.runner }}"
steps:
Expand Down
18 changes: 13 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
ci:
autoupdate_schedule: "monthly"

default_language_version:
python: "python3.13"

repos:
- repo: "meta"
hooks:
- id: "check-hooks-apply"
- 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"
Expand All @@ -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"

Expand All @@ -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"
Expand Down Expand Up @@ -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"
26 changes: 6 additions & 20 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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``"
2 changes: 1 addition & 1 deletion changelog.d/20240205_134734_kurtmckee_updates.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Python support
--------------

* Test against early Python 3.13 versions in CI.
* Test against Python 3.13 versions in CI.
52 changes: 33 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -6,15 +14,27 @@ authors = ["Kurt McKee <contactme@kurtmckee.org>"]
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 <contactme@kurtmckee.org>
SPDX-License-Identifier: MIT
"""
exclusions = [
"changelog.d/",
]


# coverage
# --------

[tool.coverage.run]
parallel = true
Expand All @@ -24,35 +44,41 @@ 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 = [
"error",
]


# scriv
# -----

[tool.scriv]
version = "literal: pyproject.toml: tool.poetry.version"
categories = [
Expand All @@ -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 <contactme@kurtmckee.org>
SPDX-License-Identifier: MIT
"""
exclusions = [
"changelog.d/",
]
9 changes: 4 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -23,16 +24,14 @@ commands =


[testenv:coverage_erase]
skipsdist = true
skip_install = true
deps = coverage[toml]
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 =
Expand Down