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

Use uv workspaces instead of pip #12622

Closed
wants to merge 5 commits into from
Closed
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
14 changes: 8 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,28 +294,30 @@ Finally, regenerate the documentation and generated code with `cargo dev generat

To preview any changes to the documentation locally:

1. Install the [Rust toolchain](https://www.rust-lang.org/tools/install).
1. Install the [Rust toolchain](https://www.rust-lang.org/tools/install).]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems off... Isn't that mismatched now?


1. Install MkDocs and Material for MkDocs with:
1. Install [uv](https://docs.astral.sh/uv/installation/)

1. Install the dependencies

```shell
pip install -r docs/requirements.txt
uv sync
```

1. Generate the MkDocs site with:

```shell
python scripts/generate_mkdocs.py
uv run scripts/generate_mkdocs.py
```

1. Run the development server with:

```shell
# For contributors.
mkdocs serve -f mkdocs.public.yml
uv run -- mkdocs serve -f mkdocs.public.yml

# For members of the Astral org, which has access to MkDocs Insiders via sponsorship.
mkdocs serve -f mkdocs.insiders.yml
uv run --with-requirements docs/requirements-insiders.txt -- mkdocs serve -f mkdocs.insiders.yml
```

The documentation should then be available locally at
Expand Down
20 changes: 20 additions & 0 deletions docs/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[project]
name = "ruff-docs"
version = "0.0.0"
dependencies = [
"PyYAML>=6.0.1",
"mkdocs>=1.5.0",
"mdformat>=0.7.17",
"mdformat-mkdocs>=2.0.4",
"mdformat-admon>=2.0.3",
"mkdocs-material>=9.1.18",
"mkdocs-redirects>=1.2.1",
]
requires-python = ">=3.8"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/ruff_docs"]
7 changes: 0 additions & 7 deletions docs/requirements-insiders.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
PyYAML==6.0.1
black==23.10.0
mkdocs==1.5.0
mkdocs-material @ git+ssh://git@github.com/astral-sh/mkdocs-material-insiders.git@38c0b8187325c3bab386b666daf3518ac036f2f4
mkdocs-redirects==1.2.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to keep it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use a custom version of mkdocs but external contributors don't have access to that repository. I don't know if there's a better way to support this?

mdformat==0.7.17
mdformat-mkdocs==2.0.4
mdformat-admon==2.0.2
8 changes: 0 additions & 8 deletions docs/requirements.txt

This file was deleted.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ Repository = "https://github.com/astral-sh/ruff"
Documentation = "https://docs.astral.sh/ruff/"
Changelog = "https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md"

[tool.uv.workspace]
members = ["docs", "python/ruff-ecosystem"]

[tool.maturin]
bindings = "bin"
manifest-path = "crates/ruff/Cargo.toml"
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate_mkdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def main() -> None:
# Format rules docs
add_no_escape_text_plugin()
for rule_doc in Path("docs/rules").glob("*.md"):
mdformat.file(rule_doc, extensions=["mkdocs", "admonition", "no-escape-text"])
mdformat.file(rule_doc, extensions=["mkdocs", "admon", "no-escape-text"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a breaking change in mdformat-admon, in the 2.0.3 release: KyleKing/mdformat-mkdocs@6a32997


with Path("mkdocs.template.yml").open(encoding="utf8") as fp:
config = yaml.safe_load(fp)
Expand Down
778 changes: 778 additions & 0 deletions uv.lock

Large diffs are not rendered by default.

Loading