Skip to content

Commit 0e51052

Browse files
Widen dependency support and bump dev deps (#262)
* Widen dependency support and bump dev deps Skip flaky ruff subprocess steps (see #45) * Only run pre-commit on one CI matrix entry * Bump typer lower bound to fix click incompatibility * Bump tomlkit - might fix CI * Bisect tomlkit version * Bisect tomlkit version * Bisect tomlkit version
1 parent 567d1ab commit 0e51052

7 files changed

Lines changed: 384 additions & 358 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
uv pip install --system --break-system-packages -r requirements.txt
3535
3636
- name: Run pre-commit
37+
if: matrix.pre-commit
3738
run: |
3839
uv run --frozen pre-commit run --all-files
3940
@@ -53,12 +54,15 @@ jobs:
5354
python-version: ["3.10", "3.11", "3.12", "3.13"]
5455
resolution: ["highest"]
5556
codspeed: [false]
57+
pre-commit: [false]
5658
include:
5759
- os: "ubuntu-latest"
5860
python-version: "3.10"
5961
resolution: "lowest-direct"
6062
codspeed: false
63+
pre-commit: false
6164
- os: "ubuntu-latest"
6265
python-version: "3.13"
6366
resolution: "highest"
6467
codspeed: true
68+
pre-commit: true

pyproject.toml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,33 +34,33 @@ dynamic = [
3434
"version",
3535
]
3636
dependencies = [
37-
"mergedeep>=1.3.4",
38-
"packaging>=24.1",
39-
"pydantic>=2.9.2",
40-
"requests>=2.32.3",
41-
"rich>=13.8.1",
42-
"ruamel-yaml>=0.18.6",
43-
"tomlkit>=0.13.2",
44-
"typer>=0.12.5",
45-
"typing-extensions>=4.12.2",
37+
"mergedeep>=1.3.1",
38+
"packaging>=20.9",
39+
"pydantic>=2.5.0",
40+
"requests>=2.26.0",
41+
"rich>=9.6.1",
42+
"ruamel-yaml>=0.16.13",
43+
"tomlkit>=0.12.0",
44+
"typer>=0.4.1",
45+
"typing-extensions>=3.10.0.0",
4646
]
4747
scripts.usethis = "usethis.__main__:app"
4848

4949
[dependency-groups]
5050
dev = [
51-
"datamodel-code-generator[http]>=0.26.2",
51+
"datamodel-code-generator[http]>=0.26.5",
5252
"deptry>=0.23.0",
5353
"import-linter>=2.1",
54-
"pre-commit>=4.0.1",
55-
"pyright>=1.1.391",
54+
"pre-commit>=4.1.0",
55+
"pyright>=1.1.393",
5656
"ruff>=0.9.4",
5757
]
5858
test = [
59-
"coverage[toml]>=7.6.3",
60-
"gitpython>=3.1.43",
61-
"pytest>=8.3.2",
62-
"pytest-codspeed>=3.1.2",
63-
"pytest-cov>=5.0.0",
59+
"coverage[toml]>=7.6.10",
60+
"gitpython>=3.1.44",
61+
"pytest>=8.3.4",
62+
"pytest-codspeed>=3.2.0",
63+
"pytest-cov>=6.0.0",
6464
"pytest-emoji>=0.2.0",
6565
"pytest-md>=0.2.0",
6666
]

src/usethis/_integrations/bitbucket/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# using the command:
55
# datamodel-codegen --input tests\usethis\_integrations\bitbucket\schema.json --input-file-type jsonschema --output src\usethis\_integrations\bitbucket\schema.py --enum-field-as-literal all --field-constraints --use-double-quotes --use-union-operator --use-standard-collections --use-default-kwarg --output-model-type pydantic_v2.BaseModel --target-python-version 3.10
66
# ruff: noqa: ERA001
7-
# pyright: reportGeneralTypeIssues=false
7+
# pyright: reportAssignmentType=false
88
# plus manually add Definitions.scripts for type hinting
99
# plus manually add ScriptItemAnchor as a root type of Script, and import it
1010
# plus manually forbid StepItem.step from being None

src/usethis/_integrations/pyproject/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import mergedeep
44
from pydantic import TypeAdapter
5-
from tomlkit import TOMLDocument
5+
from tomlkit.toml_document import TOMLDocument
66

77
from usethis._integrations.pyproject.errors import (
88
PyProjectTOMLValueAlreadySetError,
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
from functools import cache
22
from pathlib import Path
33

4-
import tomlkit
4+
from tomlkit.api import dumps, parse
55
from tomlkit.exceptions import TOMLKitError
6+
from tomlkit.toml_document import TOMLDocument
67

78
from usethis._integrations.pyproject.errors import (
89
PyProjectTOMLDecodeError,
910
PyProjectTOMLNotFoundError,
1011
)
1112

1213

13-
def read_pyproject_toml() -> tomlkit.TOMLDocument:
14+
def read_pyproject_toml() -> TOMLDocument:
1415
return read_pyproject_toml_from_path(Path.cwd() / "pyproject.toml")
1516

1617

1718
@cache
18-
def read_pyproject_toml_from_path(path: Path) -> tomlkit.TOMLDocument:
19+
def read_pyproject_toml_from_path(path: Path) -> TOMLDocument:
1920
try:
20-
return tomlkit.parse(path.read_text())
21+
return parse(path.read_text())
2122
except FileNotFoundError:
2223
msg = "'pyproject.toml' not found in the current directory."
2324
raise PyProjectTOMLNotFoundError(msg)
@@ -26,6 +27,6 @@ def read_pyproject_toml_from_path(path: Path) -> tomlkit.TOMLDocument:
2627
raise PyProjectTOMLDecodeError(msg) from None
2728

2829

29-
def write_pyproject_toml(toml_document: tomlkit.TOMLDocument) -> None:
30+
def write_pyproject_toml(toml_document: TOMLDocument) -> None:
3031
read_pyproject_toml_from_path.cache_clear()
31-
(Path.cwd() / "pyproject.toml").write_text(tomlkit.dumps(toml_document))
32+
(Path.cwd() / "pyproject.toml").write_text(dumps(toml_document))

tests/usethis/_core/test_tool.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import subprocess
23
from pathlib import Path
34

@@ -204,7 +205,9 @@ def test_run_deptry_fail(self, uv_init_dir: Path):
204205

205206
# Assert
206207
with pytest.raises(subprocess.CalledProcessError):
207-
subprocess.run(["deptry", "."], cwd=uv_init_dir, check=True)
208+
subprocess.run(
209+
["uv", "run", "deptry", "."], cwd=uv_init_dir, check=True
210+
)
208211

209212
@pytest.mark.usefixtures("_vary_network_conn")
210213
def test_run_deptry_pass(self, uv_init_dir: Path):
@@ -217,7 +220,7 @@ def test_run_deptry_pass(self, uv_init_dir: Path):
217220
use_deptry()
218221

219222
# Assert
220-
subprocess.run(["deptry", "."], cwd=uv_init_dir, check=True)
223+
subprocess.run(["uv", "run", "deptry", "."], cwd=uv_init_dir, check=True)
221224

222225
@pytest.mark.usefixtures("_vary_network_conn")
223226
def test_pre_commit_after(
@@ -1239,6 +1242,10 @@ def test_blank_slate(self, uv_init_dir: Path):
12391242
# Assert
12401243
assert (uv_init_dir / "pyproject.toml").read_text() == contents
12411244

1245+
@pytest.mark.skipif(
1246+
not os.getenv("CI"),
1247+
reason="https://github.com/nathanjmcdougall/usethis-python/issues/45",
1248+
)
12421249
@pytest.mark.usefixtures("_vary_network_conn")
12431250
def test_roundtrip(self, uv_init_dir: Path):
12441251
# Arrange
@@ -1292,6 +1299,10 @@ def test_use_after(self, uv_init_repo_dir: Path):
12921299
assert "ruff-format" in hook_names
12931300
assert "ruff" in hook_names
12941301

1302+
@pytest.mark.skipif(
1303+
not os.getenv("CI"),
1304+
reason="https://github.com/nathanjmcdougall/usethis-python/issues/45",
1305+
)
12951306
@pytest.mark.usefixtures("_vary_network_conn")
12961307
def test_remove(
12971308
self, uv_init_repo_dir: Path, capfd: pytest.CaptureFixture[str]

0 commit comments

Comments
 (0)