Skip to content

Commit a1c6e30

Browse files
committed
Python 3.14 support, pyproject.toml and CI modernization
1 parent 46e3656 commit a1c6e30

File tree

7 files changed

+418
-279
lines changed

7 files changed

+418
-279
lines changed

.editorconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ indent_size = 4
66
charset = utf-8
77
trim_trailing_whitespace = true
88
insert_final_newline = true
9+
end_of_line = lf
910

10-
[{*.yaml, *.yml}]
11+
[*.{yaml,yml}]
1112
indent_size = 2
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
name: Upload Python Package
2-
on:
3-
release:
4-
types: [published]
5-
jobs:
6-
deploy:
7-
runs-on: ubuntu-latest
8-
steps:
9-
- uses: actions/checkout@v4
10-
- name: Install uv
11-
uses: astral-sh/setup-uv@v3
12-
- name: Set up Python
13-
run: uv python install 3.12
14-
- name: Build and publish
15-
env:
16-
TWINE_USERNAME: __token__
17-
TWINE_PASSWORD: ${{ secrets.TOKEN }}
18-
run: |
19-
uv build
20-
uv run --with twine twine upload dist/*
1+
name: Upload Python Package
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
deploy:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- name: Install uv
11+
uses: astral-sh/setup-uv@v3
12+
- name: Set up Python
13+
run: uv python install 3.12
14+
- name: Build and publish
15+
env:
16+
TWINE_USERNAME: __token__
17+
TWINE_PASSWORD: ${{ secrets.TOKEN }}
18+
run: |
19+
uv build
20+
uv run --with twine twine upload dist/*

.github/workflows/tests.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,11 @@ jobs:
66
strategy:
77
fail-fast: false
88
matrix:
9-
python-version: [
10-
"3.10",
11-
"3.11",
12-
"3.12",
13-
"3.13"
14-
]
9+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
1510
steps:
16-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@v5
1712
- name: Install uv
18-
uses: astral-sh/setup-uv@v3
13+
uses: astral-sh/setup-uv@v7
1914

2015
- name: Set up Python ${{ matrix.python-version }}
2116
run: uv python install ${{ matrix.python-version }}

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ repos:
88
- id: check-toml
99

1010
- repo: https://github.com/astral-sh/ruff-pre-commit
11-
rev: v0.8.4
11+
rev: v0.14.2
1212
hooks:
13-
- id: ruff
14-
args: [--fix, --exit-non-zero-on-fix]
13+
- id: ruff-check
14+
args: [--fix, --exit-zero]
1515
- id: ruff-format

Justfile

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,62 @@
11
@_:
2-
just --list
2+
just --list
33

44
_require-uv:
5-
@uv --version > /dev/null || (echo "Please install uv: https://docs.astral.sh/uv/" && exit 1)
5+
@uv --version > /dev/null || (echo "Please install uv: https://docs.astral.sh/uv/" && exit 1)
66

77
_require-hatch:
88
@hatch --version > /dev/null || (echo "Please install hatch: uv tool install hatch" && exit 1)
99

1010
# check code style and potential issues
1111
lint:
12-
ruff check
13-
14-
# fix automatically fixable linting issues
15-
fix:
16-
ruff check --fix
12+
ruff check
1713

1814
# format code
1915
format:
20-
ruff format
16+
ruff format
17+
18+
# fix automatically fixable linting issues
19+
fix:
20+
ruff check --fix
2121

2222
# run tests across all supported Python versions
2323
test: _require-hatch
24-
hatch run test:test
25-
26-
# run all quality checks
27-
check: format lint test
24+
hatch run test:test
2825

2926
# build the package
3027
build: _require-uv
31-
uv build
28+
uv build
3229

33-
# setup development environment
30+
# setup or update local dev environment, keeps previously installed extras
3431
dev: _require-uv
35-
uv sync --extra dev
36-
uv run pre-commit install
32+
uv sync --inexact --extra dev
33+
uv run pre-commit install
34+
35+
# run tests with coverage and show a coverage report
36+
coverage:
37+
coverage run -m pytest
38+
coverage report
3739

3840
# clean build artifacts and caches
3941
clean:
40-
rm -rf .venv .pytest_cache .mypy_cache .ruff_cache
41-
find . -type d -name "__pycache__" -exec rm -r {} +
42+
rm -rf .venv .pytest_cache .mypy_cache .ruff_cache
43+
find . -type d -name "__pycache__" -exec rm -r {} +
44+
45+
# static type check with mypy
46+
typecheck: _require-uv
47+
uv run mypy
48+
49+
# check code for common misspellings
50+
spell:
51+
codespell
52+
53+
# run all quality checks
54+
check: format lint coverage typecheck spell
55+
56+
# list available recipes
57+
help:
58+
just --list
59+
60+
alias fmt := format
61+
alias cov := coverage
62+
alias mypy := typecheck

pyproject.toml

Lines changed: 59 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "objinspect"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
description = "A high-level library for Python object inspection"
55
authors = [{ name = "Žiga Ivanšek", email = "ziga.ivansek@gmail.com" }]
66
license = { file = "LICENSE" }
@@ -25,6 +25,7 @@ classifiers = [
2525
"Programming Language :: Python :: 3.11",
2626
"Programming Language :: Python :: 3.12",
2727
"Programming Language :: Python :: 3.13",
28+
"Programming Language :: Python :: 3.14",
2829
]
2930

3031
keywords = [
@@ -39,27 +40,62 @@ keywords = [
3940
"function-signature",
4041
]
4142

42-
4343
[project.optional-dependencies]
44-
test = ["pytest"]
45-
dev = ["pytest", "black", "ruff", "pre-commit"]
44+
test = ["pytest", "coverage"]
45+
dev = ["pytest", "coverage", "ruff", "pre-commit", "codespell", "mypy"]
4646

4747
[project.urls]
4848
Repository = "https://github.com/zigai/objinspect"
49-
Documentation = "https://objinspect.readthedocs.io"
5049
Issues = "https://github.com/zigai/objinspect/issues"
5150
Homepage = "https://github.com/zigai/objinspect"
51+
Documentation = "https://objinspect.readthedocs.io"
5252

5353
[build-system]
5454
requires = ["hatchling"]
5555
build-backend = "hatchling.build"
5656

57+
[tool.hatch.envs.test]
58+
features = ["test"]
59+
installer = "uv"
60+
61+
[[tool.hatch.envs.test.matrix]]
62+
python = ["3.10", "3.11", "3.12", "3.13", "3.14"]
63+
64+
[tool.hatch.envs.test.scripts]
65+
test = "pytest -v {args}"
66+
cov = "coverage run -m pytest {args}"
67+
5768
[tool.hatch.build.targets.wheel]
5869
packages = ["objinspect"]
5970

60-
[tool.black]
61-
line-length = 100
62-
target_version = ['py310', 'py311', 'py312', 'py313']
71+
[tool.coverage.run]
72+
source = ["objinspect"]
73+
branch = true
74+
75+
[tool.coverage.report]
76+
exclude_lines = [
77+
'pragma: no cover',
78+
'raise NotImplementedError',
79+
'if TYPE_CHECKING:',
80+
'if typing.TYPE_CHECKING:',
81+
]
82+
omit = ["tests/*", "tests/**"]
83+
84+
[tool.mypy]
85+
python_version = "3.10"
86+
files = ["objinspect"]
87+
exclude = ["^tests/"]
88+
89+
disallow_untyped_defs = true
90+
disallow_untyped_calls = true
91+
disallow_any_generics = true
92+
no_implicit_optional = true
93+
warn_unused_ignores = true
94+
warn_redundant_casts = true
95+
warn_return_any = true
96+
warn_unused_configs = true
97+
strict_equality = true
98+
ignore_missing_imports = true
6399

64100
[tool.ruff]
65101
line-length = 100
@@ -74,13 +110,13 @@ select = [
74110
'YTT', # flake8-2020
75111
'B', # flake8-bugbear
76112
"PLE", # pylint
77-
'PYI006', # flake8-pyi
78-
'PYI019', # flake8-pyi
79-
'PYI024', # flake8-pyi
80-
'PYI030', # flake8-pyi
81-
'PYI062', # flake8-pyi
82-
'PYI063', # flake8-pyi
83-
'PYI066', # flake8-pyi
113+
'PYI006',
114+
'PYI019',
115+
'PYI024',
116+
'PYI030',
117+
'PYI062',
118+
'PYI063',
119+
'PYI066',
84120
"RUF001",
85121
"RUF002",
86122
"RUF003",
@@ -134,33 +170,7 @@ ignore = [
134170
"UP007",
135171
"UP038",
136172
]
137-
isort = { known-first-party = ["objinspect", 'tests'] }
138-
pydocstyle = { convention = 'google' }
139-
140-
exclude = [
141-
".bzr",
142-
".direnv",
143-
".eggs",
144-
".git",
145-
".hg",
146-
".mypy_cache",
147-
".nox",
148-
".pants.d",
149-
".pytype",
150-
".ruff_cache",
151-
".svn",
152-
".tox",
153-
".venv",
154-
"__pypackages__",
155-
"_build",
156-
"buck-out",
157-
"build",
158-
"dist",
159-
"node_modules",
160-
"venv",
161-
"tests/*",
162-
"tests/**/*",
163-
]
173+
exclude = ["build", "tests/**"]
164174

165175
[tool.ruff.lint.per-file-ignores]
166176
"__init__.py" = [
@@ -173,14 +183,13 @@ exclude = [
173183
quote-style = "double"
174184
indent-style = "space"
175185
skip-magic-trailing-comma = false
176-
line-ending = "auto"
186+
line-ending = "lf"
177187

178-
[tool.hatch.envs.test]
179-
features = ["test"]
180-
installer = "uv"
188+
[tool.ruff.lint.isort]
189+
known-first-party = ["objinspect", "tests"]
181190

182-
[[tool.hatch.envs.test.matrix]]
183-
python = ["3.10", "3.11", "3.12", "3.13"]
191+
[tool.ruff.lint.pydocstyle]
192+
convention = "google"
184193

185-
[tool.hatch.envs.test.scripts]
186-
test = "pytest -v"
194+
[tool.codespell]
195+
skip = '.git,uv.lock'

0 commit comments

Comments
 (0)