Skip to content

Commit d18a1dd

Browse files
authored
chore: better integration with uv run (#252)
1 parent 5e63a31 commit d18a1dd

File tree

4 files changed

+51
-39
lines changed

4 files changed

+51
-39
lines changed

.github/CONTRIBUTING.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,17 @@ $ hatch run example:repo-review <args> # Run an example
3232
Hatch handles everything for you, including setting up an temporary virtual
3333
environment.
3434

35+
Using `uv run` directly is also supported.
36+
3537
## Setting up a development environment manually
3638

37-
You can set up a development environment by running:
39+
You can set up a development environment in `.venv` by running:
3840

3941
```bash
40-
python3 -m venv .venv
41-
source ./.venv/bin/activate
42-
pip install -v -e .[dev]
42+
uv sync
4343
```
4444

45-
If you have the [Python Launcher for Unix](https://github.com/brettcannon/python-launcher),
46-
you can instead do:
47-
48-
```bash
49-
py -m venv .venv
50-
py -m install -v -e .[dev]
51-
```
45+
Or just prefix every command by `uv run`.
5246

5347
# Post setup
5448

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ repos:
88
rev: 1.19.1
99
hooks:
1010
- id: blacken-docs
11-
additional_dependencies: [black==23.*]
11+
additional_dependencies: [black==24.*]
1212

1313
- repo: https://github.com/astral-sh/ruff-pre-commit
14-
rev: "v0.8.1"
14+
rev: "v0.8.3"
1515
hooks:
1616
- id: ruff
1717
args: ["--fix", "--show-fixes"]
1818
- id: ruff-format
1919

2020
- repo: https://github.com/rbubley/mirrors-prettier
21-
rev: "v3.4.1"
21+
rev: "v3.4.2"
2222
hooks:
2323
- id: prettier
2424
types_or: [yaml, markdown, html, css, scss, javascript, json]

.readthedocs.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,4 @@ build:
1313
- asdf plugin add uv
1414
- asdf install uv latest
1515
- asdf global uv latest
16-
- uv venv
17-
- uv pip install .[docs]
18-
- . .venv/bin/activate && sphinx-build -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html
16+
- uv run --group docs sphinx-build -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html

pyproject.toml

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,40 @@ dependencies = [
3737
"typing-extensions; python_version < '3.11'",
3838
]
3939

40+
[project.urls]
41+
Changelog = "https://github.com/scientific-python/repo-review/releases"
42+
Demo = "https://scientific-python.github.io/repo-review"
43+
Documentation = "https://repo-review.readthedocs.io"
44+
Homepage = "https://repo-review.readthedocs.io"
45+
Source = "https://github.com/scientific-python/repo-review"
46+
47+
[project.scripts]
48+
repo-review = "repo_review.__main__:main"
49+
50+
[project.entry-points."repo_review.fixtures"]
51+
pyproject = "repo_review.fixtures:pyproject"
52+
list_all = "repo_review.fixtures:list_all"
53+
54+
[project.entry-points."validate_pyproject.tool_schema"]
55+
repo-review = "repo_review.schema:get_schema"
56+
4057
[project.optional-dependencies]
4158
cli = [
4259
"click >=8",
4360
"rich >=12.2",
4461
"rich-click",
4562
]
63+
64+
[dependency-groups]
4665
test = [
4766
"pytest >=7",
4867
"sp-repo-review >=2024.08.19",
4968
"validate-pyproject >=0.14",
5069
]
5170
dev = [
52-
"repo-review[test,cli]",
71+
{ include-group = "test" },
72+
"sp-repo-review[cli]",
73+
"validate-pyproject-schema-store[all]",
5374
]
5475
docs = [
5576
"furo",
@@ -63,24 +84,6 @@ docs = [
6384
"sphinx-github-changelog",
6485
]
6586

66-
[project.urls]
67-
Changelog = "https://github.com/scientific-python/repo-review/releases"
68-
Demo = "https://scientific-python.github.io/repo-review"
69-
Documentation = "https://repo-review.readthedocs.io"
70-
Homepage = "https://repo-review.readthedocs.io"
71-
Source = "https://github.com/scientific-python/repo-review"
72-
73-
[project.scripts]
74-
repo-review = "repo_review.__main__:main"
75-
76-
[project.entry-points."repo_review.fixtures"]
77-
pyproject = "repo_review.fixtures:pyproject"
78-
list_all = "repo_review.fixtures:list_all"
79-
80-
[project.entry-points."validate_pyproject.tool_schema"]
81-
repo-review = "repo_review.schema:get_schema"
82-
83-
8487
[tool.hatch]
8588
version.source = "vcs"
8689
build.hooks.vcs.version-file = "src/repo_review/_version.py"
@@ -89,7 +92,13 @@ build.hooks.vcs.version-file = "src/repo_review/_version.py"
8992
installer = "uv"
9093

9194
[tool.hatch.envs.hatch-test]
92-
features = ["test", "cli"]
95+
features = ["cli"]
96+
# duplicated since hatch doesn't support groups yet
97+
dependencies = [
98+
"pytest >=7",
99+
"sp-repo-review >=2024.08.19",
100+
"validate-pyproject >=0.14",
101+
]
93102
env-vars.PYTHONWARNDEFAULTENCODING = "1"
94103

95104
[tool.hatch.envs.lint]
@@ -103,8 +112,19 @@ dependencies = ["pylint>=3.2"]
103112
scripts.lint = "pylint repo_review {args}"
104113

105114
[tool.hatch.envs.docs]
106-
features = ["docs"]
107-
dependencies = ["sphinx-autobuild"]
115+
# duplicated since hatch doesn't support groups yet
116+
dependencies = [
117+
"furo",
118+
"myst_parser >=0.13",
119+
"repo-review[cli]",
120+
"sphinx >=4.0",
121+
"sphinx-autodoc-typehints",
122+
"sphinx-copybutton",
123+
"sphinxcontrib-programoutput",
124+
"sphinxext-opengraph",
125+
"sphinx-github-changelog",
126+
"sphinx-autobuild",
127+
]
108128
scripts.linkcheck = "sphinx-build -b=linkcheck docs docs/_build/linkcheck {args}"
109129
scripts.html = "sphinx-build --keep-going -n -T -b=html docs docs/_build/html {args}"
110130
scripts.serve = "sphinx-autobuild -n -T -b=html docs docs/_build/html {args}"

0 commit comments

Comments
 (0)