Skip to content

Commit

Permalink
Update for python 3.13.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamwil committed Oct 12, 2024
1 parent 14030f1 commit f73be0c
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 31 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 24.4.2
rev: 24.10.0
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.4.9
rev: v0.6.9
hooks:
- id: ruff
- repo: https://github.com/pre-commit/mirrors-prettier
Expand Down
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@ A magic-free, understandable python project template using tox, ruff, pytest and
pip-tools. This template requires you to manage your own virtual environment,
but the configuration is explicit and easy to understand.

This is a great starting point, but it is just that. There are a great many best
practices with respect to packaging and distribution that are not covered here,
and for which I refer you to
This is a great starting point for internal tools, but it is just that. There
are a great many best practices with respect to packaging and distribution that
are not covered here, and for which I refer you to
[Seth Michael Larson's secure-python-package-template](https://github.com/sethmlarson/secure-python-package-template).

Moreover, since I created this template, ruff has become a
[for-profit company](https://astral.sh) and has integrated code formatting that
replaces black. They have also developed [uv](https://docs.astral.sh/uv/) which
has earned a strong foothold in the python workflow space. Much of this template
could be simplified using those cutting edge tools, however I likely will not
update it to match as I feel it is a useful reference for those who may not wish
to depend entirely on a vc-backed ecosystem.

## Background

I owe a debt of gratitude to [Claudio Jolowicz](https://github.com/cjolowicz/)
Expand Down Expand Up @@ -147,8 +155,8 @@ tool:
tox
```

By default, this will create environments for py310, py311 and py312. This
assumes all versions of python are available on your system. Take a look at
By default, this will create environments for py310, py311, py312 and py313.
This assumes all versions of python are available on your system. Take a look at
pyenv to make this easy.

You can add additional python versions to test against by modifying `tox.ini`
Expand Down
15 changes: 9 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
]
dependencies = []
Expand Down Expand Up @@ -53,7 +54,7 @@ fail_under = 100
show_missing = true

[tool.mypy]
python_version = "3.12"
python_version = "3.13"
warn_unused_configs = true
warn_unused_ignores = true
warn_redundant_casts = true
Expand All @@ -64,6 +65,10 @@ overrides = [{ module = [], ignore_missing_imports = true }]

[tool.ruff]
target-version = "py312"
src = ["src", "tests"]
preview = true

[tool.ruff.lint]
select = [
"E", # pycodestyle
"F", # pyflakes
Expand Down Expand Up @@ -124,18 +129,16 @@ select = [
"RUF", # Ruff-specific rules
]
ignore = ["ANN101", "CPY001"] # annotations for self
src = ["src", "tests"]
preview = true

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"tests/*.py" = [
"PLR2004", # magic value comparison
"S101", # use of assert detected
"TCH002", # third party import (for pytest)
]

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "pep257"

[tool.ruff.isort]
[tool.ruff.lint.isort]
known-first-party = ["bulletproof_python"]
34 changes: 18 additions & 16 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@
#
# pip-compile --all-extras pyproject.toml
#
black==24.4.2
black==24.10.0
# via bulletproof-python (pyproject.toml)
build==1.2.1
build==1.2.2.post1
# via pip-tools
cfgv==3.4.0
# via pre-commit
click==8.1.7
# via
# black
# pip-tools
coverage==7.5.3
coverage==7.6.2
# via bulletproof-python (pyproject.toml)
distlib==0.3.8
distlib==0.3.9
# via virtualenv
filelock==3.15.1
filelock==3.16.1
# via virtualenv
identify==2.5.36
identify==2.6.1
# via pre-commit
iniconfig==2.0.0
# via pytest
mypy==1.10.0
mypy==1.11.2
# via bulletproof-python (pyproject.toml)
mypy-extensions==1.0.0
# via
Expand All @@ -41,27 +41,29 @@ pathspec==0.12.1
# via black
pip-tools==7.4.1
# via bulletproof-python (pyproject.toml)
platformdirs==4.2.2
platformdirs==4.3.6
# via
# black
# virtualenv
pluggy==1.5.0
# via pytest
pre-commit==3.7.1
pre-commit==4.0.1
# via bulletproof-python (pyproject.toml)
pyproject-hooks==1.1.0
# via build
pytest==8.2.0
pyproject-hooks==1.2.0
# via
# build
# pip-tools
pytest==8.3.3
# via bulletproof-python (pyproject.toml)
pyyaml==6.0.1
pyyaml==6.0.2
# via pre-commit
ruff==0.4.9
ruff==0.6.9
# via bulletproof-python (pyproject.toml)
typing-extensions==4.12.2
# via mypy
virtualenv==20.26.2
virtualenv==20.26.6
# via pre-commit
wheel==0.43.0
wheel==0.44.0
# via pip-tools

# The following packages are considered to be unsafe in a requirements file:
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ envlist =
py310
py311
py312
py313
lint
type

Expand All @@ -31,7 +32,7 @@ deps =
ruff
commands =
black --check src tests
ruff src tests
ruff check src tests

[testenv:type]
description = Run type checks
Expand Down

0 comments on commit f73be0c

Please sign in to comment.