Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: better integration with uv run #252

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,17 @@ $ hatch run example:repo-review <args> # Run an example
Hatch handles everything for you, including setting up an temporary virtual
environment.

Using `uv run` directly is also supported.

## Setting up a development environment manually

You can set up a development environment by running:
You can set up a development environment in `.venv` by running:

```bash
python3 -m venv .venv
source ./.venv/bin/activate
pip install -v -e .[dev]
uv sync
```

If you have the [Python Launcher for Unix](https://github.com/brettcannon/python-launcher),
you can instead do:

```bash
py -m venv .venv
py -m install -v -e .[dev]
```
Or just prefix every command by `uv run`.

# Post setup

Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ repos:
rev: 1.19.1
hooks:
- id: blacken-docs
additional_dependencies: [black==23.*]
additional_dependencies: [black==24.*]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.8.1"
rev: "v0.8.3"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format

- repo: https://github.com/rbubley/mirrors-prettier
rev: "v3.4.1"
rev: "v3.4.2"
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]
Expand Down
4 changes: 1 addition & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@ build:
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
- uv venv
- uv pip install .[docs]
- . .venv/bin/activate && sphinx-build -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html
- uv run --group docs sphinx-build -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html
64 changes: 42 additions & 22 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,40 @@ dependencies = [
"typing-extensions; python_version < '3.11'",
]

[project.urls]
Changelog = "https://github.com/scientific-python/repo-review/releases"
Demo = "https://scientific-python.github.io/repo-review"
Documentation = "https://repo-review.readthedocs.io"
Homepage = "https://repo-review.readthedocs.io"
Source = "https://github.com/scientific-python/repo-review"

[project.scripts]
repo-review = "repo_review.__main__:main"

[project.entry-points."repo_review.fixtures"]
pyproject = "repo_review.fixtures:pyproject"
list_all = "repo_review.fixtures:list_all"

[project.entry-points."validate_pyproject.tool_schema"]
repo-review = "repo_review.schema:get_schema"

[project.optional-dependencies]
cli = [
"click >=8",
"rich >=12.2",
"rich-click",
]

[dependency-groups]
test = [
"pytest >=7",
"sp-repo-review >=2024.08.19",
"validate-pyproject >=0.14",
]
dev = [
"repo-review[test,cli]",
{ include-group = "test" },
"sp-repo-review[cli]",
"validate-pyproject-schema-store[all]",
]
docs = [
"furo",
Expand All @@ -63,24 +84,6 @@ docs = [
"sphinx-github-changelog",
]

[project.urls]
Changelog = "https://github.com/scientific-python/repo-review/releases"
Demo = "https://scientific-python.github.io/repo-review"
Documentation = "https://repo-review.readthedocs.io"
Homepage = "https://repo-review.readthedocs.io"
Source = "https://github.com/scientific-python/repo-review"

[project.scripts]
repo-review = "repo_review.__main__:main"

[project.entry-points."repo_review.fixtures"]
pyproject = "repo_review.fixtures:pyproject"
list_all = "repo_review.fixtures:list_all"

[project.entry-points."validate_pyproject.tool_schema"]
repo-review = "repo_review.schema:get_schema"


[tool.hatch]
version.source = "vcs"
build.hooks.vcs.version-file = "src/repo_review/_version.py"
Expand All @@ -89,7 +92,13 @@ build.hooks.vcs.version-file = "src/repo_review/_version.py"
installer = "uv"

[tool.hatch.envs.hatch-test]
features = ["test", "cli"]
features = ["cli"]
# duplicated since hatch doesn't support groups yet
dependencies = [
"pytest >=7",
"sp-repo-review >=2024.08.19",
"validate-pyproject >=0.14",
]
env-vars.PYTHONWARNDEFAULTENCODING = "1"

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

[tool.hatch.envs.docs]
features = ["docs"]
dependencies = ["sphinx-autobuild"]
# duplicated since hatch doesn't support groups yet
dependencies = [
"furo",
"myst_parser >=0.13",
"repo-review[cli]",
"sphinx >=4.0",
"sphinx-autodoc-typehints",
"sphinx-copybutton",
"sphinxcontrib-programoutput",
"sphinxext-opengraph",
"sphinx-github-changelog",
"sphinx-autobuild",
]
scripts.linkcheck = "sphinx-build -b=linkcheck docs docs/_build/linkcheck {args}"
scripts.html = "sphinx-build --keep-going -n -T -b=html docs docs/_build/html {args}"
scripts.serve = "sphinx-autobuild -n -T -b=html docs docs/_build/html {args}"
Expand Down
Loading