Skip to content

Commit 57ffd87

Browse files
authored
Merge pull request #19 from sruggier/pr/modernize
Use uv and pre-commit to run checks locally, and on GitHub Actions
2 parents dca159a + 74743c8 commit 57ffd87

11 files changed

Lines changed: 5436 additions & 36 deletions

File tree

.basedpyright/baseline.json

Lines changed: 4552 additions & 0 deletions
Large diffs are not rendered by default.

.github/workflows/ruff.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Static analysis
2+
on: [push, pull_request]
3+
jobs:
4+
static_analysis:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- name: Install uv
9+
uses: astral-sh/setup-uv@v5
10+
with:
11+
# This is pinned for reproducibility. It can be updated anytime
12+
# a new version of uv is released.
13+
version: 0.6.17
14+
- name: "Set up Python"
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version-file: "pyproject.toml"
18+
- name: Install dependencies
19+
run: uv sync --locked --all-extras --dev
20+
- name: Run static checks
21+
run: uv run pre-commit run --all-files

.github/workflows/test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: test
2+
on: [push, pull_request]
3+
jobs:
4+
check:
5+
runs-on: ubuntu-latest
6+
strategy:
7+
matrix:
8+
python-version:
9+
- "3.9"
10+
- "3.10"
11+
- "3.11"
12+
- "3.12"
13+
- "3.13"
14+
- "3.14"
15+
env:
16+
UV_PYTHON: ${{ matrix.python-version }}
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v5
21+
with:
22+
# This is pinned for reproducibility. It can be updated anytime
23+
# a new version of uv is released.
24+
version: 0.6.17
25+
python-version: ${{ matrix.python-version }}
26+
- name: Install dependencies
27+
run: uv sync --locked --all-extras --dev
28+
- name: Run py.test
29+
run: uv run py.test colander_tools

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
build
12
*.egg-info
23

34
__pycache__

.pre-commit-config.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
fail_fast: true
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v5.0.0
5+
hooks:
6+
- id: trailing-whitespace
7+
- id: end-of-file-fixer
8+
# This file is automatically written without a newline, and fixing it
9+
# repeatedly would be a waste of time.
10+
exclude: ".basedpyright/baseline.json"
11+
- id: debug-statements
12+
- id: check-docstring-first
13+
- id: check-merge-conflict
14+
- id: name-tests-test
15+
- repo: local
16+
hooks:
17+
- id: uv-lock
18+
name: uv lock
19+
language: system
20+
require_serial: true
21+
files: (^|/)pyproject\.toml$
22+
pass_filenames: false
23+
entry: uv lock
24+
args:
25+
- --check
26+
27+
- id: ruff
28+
name: ruff check
29+
language: system
30+
require_serial: true
31+
types: [python]
32+
entry: uv run ruff check
33+
args:
34+
- --fix
35+
- --exit-non-zero-on-fix
36+
- id: ruff-format
37+
name: ruff format
38+
language: system
39+
require_serial: true
40+
types: [python]
41+
entry: uv run ruff format
42+
args:
43+
- --verbose
44+
45+
- id: pyproject-fmt
46+
name: pyproject-fmt
47+
language: system
48+
files: (^|/)pyproject\.toml$
49+
entry: uv run pyproject-fmt
50+
51+
- id: prospector
52+
name: prospector
53+
language: system
54+
require_serial: true
55+
types: [python]
56+
entry: uv run prospector
57+
args:
58+
- --ignore-patterns='^(?!colander_tools)'
59+
- --no-autodetect
60+
61+
- id: basedpyright
62+
name: basedpyright
63+
language: system
64+
require_serial: true
65+
types: [python]
66+
entry: uv run basedpyright
67+
args:
68+
- --level
69+
- error

.prospector.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
strictness: medium
2+
3+
pylint:
4+
disable:
5+
# TODO: incrementally re-enable and fix each of these warnings
6+
- consider-using-f-string
7+
- disallowed-name
8+
- raise-missing-from
9+
- redefined-builtin
10+
- super-with-arguments
11+
- useless-object-inheritance

.travis.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

pyproject.toml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@ license = "BSD-3-Clause"
1414
authors = [
1515
{ name = "Platform.sh", email = "sayhello@platform.sh" },
1616
]
17-
requires-python = ">=3.7"
17+
requires-python = ">=3.9"
1818
classifiers = [
1919
"Intended Audience :: Developers",
2020
"Programming Language :: Python",
2121
"Programming Language :: Python :: 3 :: Only",
22-
"Programming Language :: Python :: 3.7",
23-
"Programming Language :: Python :: 3.8",
2422
"Programming Language :: Python :: 3.9",
2523
"Programming Language :: Python :: 3.10",
2624
"Programming Language :: Python :: 3.11",
@@ -36,10 +34,22 @@ dependencies = [
3634

3735
urls.source = "https://github.com/platformsh/colander-tools"
3836

39-
[tool.pyproject-fmt]
40-
indent = 4
41-
4237
[dependency-groups]
4338
dev = [
39+
"basedpyright~=1.29",
40+
"pre-commit~=4.2",
41+
"prospector~=1.16",
42+
"pyproject-fmt~=2.5",
43+
"pytest~=8.3",
4444
"ruff~=0.11.5",
4545
]
46+
47+
[tool.pyproject-fmt]
48+
indent = 4
49+
50+
[tool.pyright]
51+
venvPath = "."
52+
venv = ".venv"
53+
include = [ "colander_tools" ]
54+
pythonVersion = "3.9"
55+
failOnWarnings = false

test-requirements.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)