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
8 changes: 4 additions & 4 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -453,17 +453,17 @@ jobs:
# NOTE: The latest and the lowest supported Pythons are prioritized
# NOTE: to improve the responsiveness. It's nice to see the most
# NOTE: important results first.
- 3.13
- 3.9
- 3.14
# str
- >-
3.10
- 3.13
- 3.12
- 3.11
runner-vm-os:
- ubuntu-24.04
- macos-14
- macos-13
- macos-15
- macos-15-intel
- windows-2025
toxenv:
- pytest
Expand Down
2 changes: 1 addition & 1 deletion .mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[mypy]
python_version = 3.9
python_version = 3.10
color_output = true
error_summary = true
# IMPORTANT: The file list MUST NOT have a trailing comma after the last entry.
Expand Down
60 changes: 30 additions & 30 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,53 +121,53 @@ repos:
rev: 9f70dc58c23dfcca1b97af99eaeee3140a807c7e # frozen: v1.18.2
hooks:
- id: mypy
alias: mypy-py313
name: MyPy, for Python 3.13
alias: mypy-py314
name: MyPy, for Python 3.14
additional_dependencies:
- lxml # dep of `--txt-report`, `--cobertura-xml-report` & `--html-report`
- pytest
- pytest-mock
args:
- --python-version=3.13
- --any-exprs-report=.tox/.tmp/.test-results/mypy--py-3.13
- --cobertura-xml-report=.tox/.tmp/.test-results/mypy--py-3.13
- --html-report=.tox/.tmp/.test-results/mypy--py-3.13
- --linecount-report=.tox/.tmp/.test-results/mypy--py-3.13
- --linecoverage-report=.tox/.tmp/.test-results/mypy--py-3.13
- --lineprecision-report=.tox/.tmp/.test-results/mypy--py-3.13
- --txt-report=.tox/.tmp/.test-results/mypy--py-3.13
- --python-version=3.14
- --any-exprs-report=.tox/.tmp/.test-results/mypy--py-3.14
- --cobertura-xml-report=.tox/.tmp/.test-results/mypy--py-3.14
- --html-report=.tox/.tmp/.test-results/mypy--py-3.14
- --linecount-report=.tox/.tmp/.test-results/mypy--py-3.14
- --linecoverage-report=.tox/.tmp/.test-results/mypy--py-3.14
- --lineprecision-report=.tox/.tmp/.test-results/mypy--py-3.14
- --txt-report=.tox/.tmp/.test-results/mypy--py-3.14
pass_filenames: false
- id: mypy
alias: mypy-py311
name: MyPy, for Python 3.11
alias: mypy-py312
name: MyPy, for Python 3.12
additional_dependencies:
- lxml # dep of `--txt-report`, `--cobertura-xml-report` & `--html-report`
- pytest
- pytest-mock
args:
- --python-version=3.11
- --any-exprs-report=.tox/.tmp/.test-results/mypy--py-3.11
- --cobertura-xml-report=.tox/.tmp/.test-results/mypy--py-3.11
- --html-report=.tox/.tmp/.test-results/mypy--py-3.11
- --linecount-report=.tox/.tmp/.test-results/mypy--py-3.11
- --linecoverage-report=.tox/.tmp/.test-results/mypy--py-3.11
- --lineprecision-report=.tox/.tmp/.test-results/mypy--py-3.11
- --txt-report=.tox/.tmp/.test-results/mypy--py-3.11
- --python-version=3.12
- --any-exprs-report=.tox/.tmp/.test-results/mypy--py-3.12
- --cobertura-xml-report=.tox/.tmp/.test-results/mypy--py-3.12
- --html-report=.tox/.tmp/.test-results/mypy--py-3.12
- --linecount-report=.tox/.tmp/.test-results/mypy--py-3.12
- --linecoverage-report=.tox/.tmp/.test-results/mypy--py-3.12
- --lineprecision-report=.tox/.tmp/.test-results/mypy--py-3.12
- --txt-report=.tox/.tmp/.test-results/mypy--py-3.12
pass_filenames: false
- id: mypy
alias: mypy-py39
name: MyPy, for Python 3.9
alias: mypy-py310
name: MyPy, for Python 3.10
additional_dependencies:
- lxml # dep of `--txt-report`, `--cobertura-xml-report` & `--html-report`
- pytest
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be a good idea to start pinning the additional deps in here. Both these and the repo version contribute to the cache key in pre-commit. And the cache in https://pre-commit.ci is effectively immportal. So when a new version of a dep like pytest is out, pre-commit.ci won't start using it until the cache key changes. That can happen when the repo version above changes or when something in this list of strings changes. This results in updating the repo version suddenly starting to use a different pytest version way later than its actual release happens. Having pins in here gives you better control over when the new versions are being picked up and so you'd see failures when you bump things in here instead of seeing failures at some point later, when the repo is getting bumped by the bot.

One project that can manage these is https://pypi.org/p/upadup.

- pytest-mock
args:
- --python-version=3.9
- --any-exprs-report=.tox/.tmp/.test-results/mypy--py-3.9
- --cobertura-xml-report=.tox/.tmp/.test-results/mypy--py-3.9
- --html-report=.tox/.tmp/.test-results/mypy--py-3.9
- --linecount-report=.tox/.tmp/.test-results/mypy--py-3.9
- --linecoverage-report=.tox/.tmp/.test-results/mypy--py-3.9
- --lineprecision-report=.tox/.tmp/.test-results/mypy--py-3.9
- --txt-report=.tox/.tmp/.test-results/mypy--py-3.9
- --python-version=3.10
- --any-exprs-report=.tox/.tmp/.test-results/mypy--py-3.10
- --cobertura-xml-report=.tox/.tmp/.test-results/mypy--py-3.10
- --html-report=.tox/.tmp/.test-results/mypy--py-3.10
- --linecount-report=.tox/.tmp/.test-results/mypy--py-3.10
- --linecoverage-report=.tox/.tmp/.test-results/mypy--py-3.10
- --lineprecision-report=.tox/.tmp/.test-results/mypy--py-3.10
- --txt-report=.tox/.tmp/.test-results/mypy--py-3.10
pass_filenames: false
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ classifiers = [
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'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.14',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
]
Expand All @@ -43,7 +43,7 @@ dynamic = [
'urls',
'version',
]
requires-python = ">= 3.9"
requires-python = ">= 3.10"

[[project.authors]]
name = 'Anton Babenko'
Expand Down
3 changes: 0 additions & 3 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Assume Python 3.9
target-version = "py39"

line-length = 79 # To decrease PR diff size

namespace-packages = ["src/pre_commit_terraform/", "tests/pytest/"]
Expand Down
4 changes: 2 additions & 2 deletions src/pre_commit_terraform/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

from argparse import ArgumentParser, Namespace
from collections.abc import Callable
from typing import Protocol, Union
from typing import Protocol

from ._structs import ReturnCode


ReturnCodeType = Union[ReturnCode, int] # Union instead of pipe for Python 3.9
ReturnCodeType = ReturnCode | int
CLIAppEntryPointCallableType = Callable[[Namespace], ReturnCodeType]


Expand Down
Loading