-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Use
uv
for managing Python and dependencies
Python packaging is in flux, but the old form of requirements (`requirements.txt`) is no longer recommended. The use of a more modern alternative (such as Poetry, PDM, Rye, or uv) is recommended as they also provide dependency lock files so that downstream dependencies are not updated on installation. For a project that is not written in Python, `uv` looks likely to be the best choice because it can also manage the Python installation, using a suitable existing Python installation if present. As `uv` does not currently support running tasks (unlike Poetry and pdm), we have added `taskipy` with useful shorthand tasks defined for this purpose: | name | command | | ----------- | -------------------------------------------- | | build-docs | mkdocs build -f assets/chezmoi.io/mkdocs.yml | | serve-docs | mkdocs serve -f assets/chezmoi.io/mkdocs.yml | | deploy-docs | cd assets/chezmoi.io && mkdocs gh-deploy | | lint | ruff check | | format | ruff format | | pycheck | task lint && task format --diff | | pyfix | task lint --fix && task format | | format-yaml | make format-yaml | These are run with `uv run task <name>`. Note that `make format-yaml` is the preferred way to format YAML documents, and it runs the `format-yaml.py` script directly.`
- Loading branch information
1 parent
e3e839f
commit 34f415c
Showing
9 changed files
with
821 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,43 @@ | ||
# Website | ||
|
||
The [website](https://chezmoi.io) is generated with [Material for | ||
MkDocs](https://squidfunk.github.io/mkdocs-material/) from the contents of the | ||
`assets/chezmoi.io/docs/` directory. It is hosted by [GitHub | ||
pages](https://pages.github.com/) from the [`gh-pages` | ||
branch](https://github.com/twpayne/chezmoi/tree/gh-pages). | ||
The [website](https://chezmoi.io) is generated with | ||
[Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) from the | ||
contents of the `assets/chezmoi.io/docs/` directory. It is hosted by | ||
[GitHub pages](https://pages.github.com/) from the | ||
[`gh-pages` branch](https://github.com/twpayne/chezmoi/tree/gh-pages). | ||
|
||
To build the website locally, both Go 1.22 (or later) and Python 3.10 (or later) | ||
must be installed. | ||
|
||
Change into the website directory: | ||
|
||
```console | ||
$ cd assets/chezmoi.io | ||
``` | ||
To build the website locally, Go 1.22 (or later) and | ||
[uv](https://docs.astral.sh/uv/getting-started/installation/) 0.4.15 (or later) | ||
must be installed. Python 3.10 (or later) is required, but may be installed with | ||
`uv`: | ||
|
||
!!! note "" | ||
|
||
=== "Default" | ||
|
||
Install the website dependencies: | ||
|
||
```console | ||
$ pip3 install --user -r requirements.txt | ||
``` | ||
If Python 3.10 (or later) is not currently installed, install it with `uv`: | ||
|
||
=== "virtualenv (Recommended)" | ||
```console | ||
$ uv python install 3.10 | ||
``` | ||
|
||
Create a virtualenv with: | ||
Install the dependencies (the `--frozen` is optional but recommended): | ||
|
||
```console | ||
$ python3 -m venv .venv | ||
``` | ||
|
||
and [activate it](https://docs.python.org/3/library/venv.html#how-venvs-work). | ||
|
||
Install the website dependencies: | ||
|
||
```console | ||
$ pip3 install -r requirements.txt | ||
``` | ||
```console | ||
$ uv sync --frozen | ||
``` | ||
|
||
Test the website locally by running: | ||
|
||
```console | ||
$ mkdocs serve | ||
$ uv run task serve-docs | ||
``` | ||
|
||
and visiting [http://127.0.0.1:8000/](http://127.0.0.1:8000/). | ||
|
||
Deploy the website with: | ||
## Maintainers | ||
|
||
The website is automatically deployed when new releases are created, but manual | ||
deployments can be triggered by maintainers with appropriate access using: | ||
|
||
```console | ||
$ mkdocs gh-deploy | ||
$ uv run task mkdocs gh-deploy | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
[project] | ||
name = "chezmoi" | ||
version = "2.52.2" | ||
requires-python = ">=3.10" | ||
license = { text = "MIT" } | ||
|
||
[tool.uv] | ||
dev-dependencies = [ | ||
"ruff==0.6.7", | ||
"mkdocs-material==9.5.34", | ||
"mkdocs-mermaid2-plugin==1.1.1", | ||
"mkdocs==1.6.1", | ||
"pymdown-extensions==10.10.1", | ||
"ruamel-yaml==0.18.6", | ||
"taskipy==1.13.0", | ||
] | ||
|
||
[tool.taskipy.tasks] | ||
build-docs = { cmd = "mkdocs build -f assets/chezmoi.io/mkdocs.yml" } | ||
serve-docs = { cmd = "mkdocs serve -f assets/chezmoi.io/mkdocs.yml" } | ||
deploy-docs = { cmd = "cd assets/chezmoi.io && mkdocs gh-deploy" } | ||
lint = { cmd = "ruff check" } | ||
format = { cmd = "ruff format" } | ||
pycheck = { cmd = "task lint && task format --diff" } | ||
pyfix = { cmd = "task lint --fix && task format" } | ||
format-yaml = { cmd = "./assets/scripts/format-yaml.py" } | ||
|
||
[tool.ruff] | ||
include = [ | ||
"pyproject.toml", | ||
"assets/chezmoi.io/docs/hooks.py", | ||
"assets/chezmoi.io/docs/shortcodes.py", | ||
"assets/scripts/format-yaml.py", | ||
] | ||
target-version = "py310" | ||
|
||
[tool.ruff.lint] | ||
extend-select = [ | ||
"A", | ||
"B", | ||
"E", | ||
"F", | ||
"I", | ||
"W", | ||
"ANN", | ||
"COM", | ||
"FA", | ||
"UP", | ||
"PL", | ||
"PTH", | ||
"SIM", | ||
] | ||
ignore = ["ANN003", "COM812"] | ||
|
||
[tool.ruff.format] | ||
quote-style = "single" | ||
|
||
[tool.uv.workspace] | ||
members = ["chezmoi"] |
Oops, something went wrong.