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

feat: Autogeneration of the CLI documentation. #3268

Merged
merged 65 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
df8f743
wip: add initial plumbing to get the command and print it from a binary
ruben-arts Mar 4, 2025
142e1b8
wip: recursive generation of command files
ruben-arts Mar 4, 2025
a9c2874
wip: cleanup flow
ruben-arts Mar 4, 2025
fcaa6da
feat: working version in the documentation pages
ruben-arts Mar 4, 2025
6a5e042
feat: make title a navigation in the cli
ruben-arts Mar 4, 2025
e1d10a3
fix: generation warnings
ruben-arts Mar 4, 2025
bc0a0c3
misc: add simple run instruction
ruben-arts Mar 4, 2025
e6c82ef
docs: improve about section
ruben-arts Mar 4, 2025
6fa9bd7
docs: full recursion and more info on positionals and arguments
ruben-arts Mar 4, 2025
20f02b4
misc: add the snippet logic with named parts
ruben-arts Mar 4, 2025
1ba3e78
docs: add some initial injected information
ruben-arts Mar 4, 2025
0837c95
docs: fix injection pixi add
ruben-arts Mar 4, 2025
c579849
fix: synopsis
ruben-arts Mar 5, 2025
0dbc1f7
fix: broken link
ruben-arts Mar 5, 2025
c529649
feat: use table for subcommands
ruben-arts Mar 5, 2025
8ab6101
feat: make the options linked to themselves
ruben-arts Mar 5, 2025
dbfec2b
Adapt task
Hofer-Julian Mar 6, 2025
719b483
fix: title display
ruben-arts Mar 6, 2025
e7f2cd7
fix: options display
ruben-arts Mar 6, 2025
ef7f27d
fix: option id's
ruben-arts Mar 6, 2025
646d322
fix: cli md abouts
ruben-arts Mar 6, 2025
4f177c6
refactor: generation location
ruben-arts Mar 6, 2025
c319309
Show old documentation
ruben-arts Mar 6, 2025
8dbc667
docs: clean up init command
ruben-arts Mar 6, 2025
1ff43e2
docs: add usage
ruben-arts Mar 6, 2025
522b5a9
Merge remote-tracking branch 'upstream/main' into feature/automated_c…
ruben-arts Mar 7, 2025
fb91da8
fix: cli docs looks subcommand
ruben-arts Mar 7, 2025
4e103d3
misc: rename the extender md
ruben-arts Mar 7, 2025
50155f8
refactor: make generated the default cli docs
ruben-arts Mar 7, 2025
20f1aed
ci: check generated documentation in ci
ruben-arts Mar 7, 2025
a5911d6
feat: add generated documentation to the repo
ruben-arts Mar 7, 2025
c1cdaca
fix: autogenerated result is lint compatible
ruben-arts Mar 7, 2025
edb98be
Merge remote-tracking branch 'upstream/main' into feature/automated_c…
ruben-arts Mar 7, 2025
dd27212
fix: mkdocs warning about links in autogenerated tables
ruben-arts Mar 7, 2025
1eb4b94
fix: mkdocs warning about links to cli docs
ruben-arts Mar 7, 2025
bd6eb90
fix: current platform default values
ruben-arts Mar 7, 2025
fb276b0
docs: update init and add
ruben-arts Mar 7, 2025
b879265
docs: update init, add and install
ruben-arts Mar 7, 2025
6166cd8
docs: update the update document
ruben-arts Mar 7, 2025
278796a
docs: update the upgrade document
ruben-arts Mar 7, 2025
0d7326e
docs: update the lock document
ruben-arts Mar 7, 2025
412d79b
docs: update the run document
ruben-arts Mar 7, 2025
692ab1f
docs: update the exec document
ruben-arts Mar 7, 2025
620fd8c
docs: update the remove document
ruben-arts Mar 7, 2025
1c585d2
docs: update the task documents
ruben-arts Mar 7, 2025
29e4f16
docs: update the tree and list documents
ruben-arts Mar 7, 2025
0c20da0
docs: update the shell documents
ruben-arts Mar 7, 2025
0673280
docs: update the shell-hook documents
ruben-arts Mar 7, 2025
adfefe9
docs: update the search documents
ruben-arts Mar 7, 2025
a578b2b
docs: update the self-update documents
ruben-arts Mar 7, 2025
97dd2c2
docs: update the info documents
ruben-arts Mar 7, 2025
20d9738
docs: update the cache documents
ruben-arts Mar 7, 2025
142ed9b
docs: update the upload documents
ruben-arts Mar 7, 2025
0ea9e8c
docs: update the auth documents
ruben-arts Mar 7, 2025
3209c90
docs: update the config documents
ruben-arts Mar 7, 2025
35bb768
docs: update the global documents
ruben-arts Mar 7, 2025
1ac5cae
docs: clean
ruben-arts Mar 7, 2025
91fc369
docs: update project channel docs
ruben-arts Mar 7, 2025
83161b0
Merge branch 'main' into feature/automated_cli_docs
ruben-arts Mar 7, 2025
2aa258b
docs: update project docs
ruben-arts Mar 10, 2025
3df870f
Merge remote-tracking branch 'upstream/main' into feature/automated_c…
ruben-arts Mar 10, 2025
3a78a8d
Move `generate-cli-docs` task
Hofer-Julian Mar 10, 2025
479cd95
ci: remove all generated files before regenerating
ruben-arts Mar 10, 2025
cf8a2e2
docs: remove old cli docs
ruben-arts Mar 10, 2025
1ea0f53
docs: fix link
ruben-arts Mar 10, 2025
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
9 changes: 9 additions & 0 deletions docs/reference/cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This directory contains the same structure as the autogenerated cli documentation.

In all the autogenerated files, there are `snippets` injected like `description` and `example`.

If you put a file with the same file name and path as the autogenerated companion file, the `snippets` will be injected into the file.

For example, `docs/autogenerated/pixi.md` is the autogenerated file and `docs/reference/cli/pixi.md` is the injecting file.

Snipped documentation can be found here: https://facelessuser.github.io/pymdown-extensions/extensions/snippets/
21 changes: 21 additions & 0 deletions docs/reference/cli/pixi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--8<-- [start:description]
## Description

The `pixi` command is the main entry point for the Pixi CLI.

--8<-- [end:description]


--8<-- [start:example]
## Examples

Set the verbosity of pixi with the multi level flag `-v` or `--verbose`:

```shell
pixi -v command # info
pixi -vv command # debug
pixi -vvv command # trace

pixi --verbose command # info
```
--8<-- [end:example]
75 changes: 75 additions & 0 deletions docs/reference/cli/pixi/add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

--8<-- [start:example]

## Examples

```shell
pixi add numpy # (1)!
pixi add numpy pandas "pytorch>=1.8" # (2)!
pixi add "numpy>=1.22,<1.24" # (3)!
pixi add --manifest-path ~/myproject/pixi.toml numpy # (4)!
pixi add --host "python>=3.9.0" # (5)!
pixi add --build cmake # (6)!
pixi add --platform osx-64 clang # (7)!
pixi add --no-install numpy # (8)!
pixi add --no-lockfile-update numpy # (9)!
pixi add --feature featurex numpy # (10)!
pixi add --git https://github.com/wolfv/pixi-build-examples boost-check # (11)!
pixi add --git https://github.com/wolfv/pixi-build-examples --branch main --subdir boost-check boost-check # (12)!
pixi add --git https://github.com/wolfv/pixi-build-examples --tag v0.1.0 boost-check # (13)!
pixi add --git https://github.com/wolfv/pixi-build-examples --rev e50d4a1 boost-check # (14)!

# Add a pypi dependency
pixi add --pypi requests[security] # (15)!
pixi add --pypi Django==5.1rc1 # (16)!
pixi add --pypi "boltons>=24.0.0" --feature lint # (17)!
pixi add --pypi "boltons @ https://files.pythonhosted.org/packages/46/35/e50d4a115f93e2a3fbf52438435bb2efcf14c11d4fcd6bdcd77a6fc399c9/boltons-24.0.0-py3-none-any.whl" # (18)!
pixi add --pypi "exchangelib @ git+https://github.com/ecederstrand/exchangelib" # (19)!
pixi add --pypi "project @ file:///absolute/path/to/project" # (20)!
pixi add --pypi "project@file:///absolute/path/to/project" --editable # (21)!
pixi add --git https://github.com/mahmoud/boltons.git boltons --pypi # (22)!
pixi add --git https://github.com/mahmoud/boltons.git boltons --branch main --pypi # (23)!
pixi add --git https://github.com/mahmoud/boltons.git boltons --rev e50d4a1 --pypi # (24)!
pixi add --git https://github.com/mahmoud/boltons.git boltons --tag v0.1.0 --pypi # (25)!
pixi add --git https://github.com/mahmoud/boltons.git boltons --tag v0.1.0 --pypi --subdir boltons # (26)!
```

1. This will add the `numpy` package to the project with the latest available for the solved environment.
2. This will add multiple packages to the project solving them all together.
3. This will add the `numpy` package with the version constraint.
4. This will add the `numpy` package to the project of the manifest file at the given path.
5. This will add the `python` package as a host dependency. There is currently no different behavior for host dependencies.
6. This will add the `cmake` package as a build dependency. There is currently no different behavior for build dependencies.
7. This will add the `clang` package only for the `osx-64` platform.
8. This will add the `numpy` package to the manifest and lockfile, without installing it in an environment.
9. This will add the `numpy` package to the manifest without updating the lockfile or installing it in the environment.
10. This will add the `numpy` package in the feature `featurex`.
11. This will add the `boost-check` source package to the dependencies from the git repository.
12. This will add the `boost-check` source package to the dependencies from the git repository using `main` branch and the `boost-check` folder in the repository.
13. This will add the `boost-check` source package to the dependencies from the git repository using `v0.1.0` tag.
14. This will add the `boost-check` source package to the dependencies from the git repository using `e50d4a1` revision.
15. This will add the `requests` package as `pypi` dependency with the `security` extra.
16. This will add the `pre-release` version of `Django` to the project as a `pypi` dependency.
17. This will add the `boltons` package in the feature `lint` as `pypi` dependency.
18. This will add the `boltons` package with the given `url` as `pypi` dependency.
19. This will add the `exchangelib` package with the given `git` url as `pypi` dependency.
20. This will add the `project` package with the given `file` url as `pypi` dependency.
21. This will add the `project` package with the given `file` url as an `editable` package as `pypi` dependency.
22. This will add the `boltons` package with the given `git` url as `pypi` dependency.
23. This will add the `boltons` package with the given `git` url and `main` branch as `pypi` dependency.
24. This will add the `boltons` package with the given `git` url and `e50d4a1` revision as `pypi` dependency.
25. This will add the `boltons` package with the given `git` url and `v0.1.0` tag as `pypi` dependency.
26. This will add the `boltons` package with the given `git` url, `v0.1.0` tag and the `boltons` folder in the repository as `pypi` dependency.

!!! tip
If you want to use a non default pinning strategy, you can set it using [pixi's configuration](/docs/reference/pixi_configuration.md#pinning-strategy).
```
pixi config set pinning-strategy no-pin --global
```
The default is `semver` which will pin the dependencies to the latest major version or minor for `v0` versions.
!!! note
There is an exception to this rule when you add a package we defined as non `semver`, then we'll use the `minor` strategy.
These are the packages we defined as non `semver`:
Python, Rust, Julia, GCC, GXX, GFortran, NodeJS, Deno, R, R-Base, Perl

--8<-- [end:example]
27 changes: 27 additions & 0 deletions docs/reference/cli/pixi/init.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--8<-- [start:description]

!!! info "Importing an environment.yml"
When importing an environment, the `pixi.toml` will be created with the dependencies from the environment file.
The `pixi.lock` will be created when you install the environment.
We don't support `git+` urls as dependencies for pip packages and for the `defaults` channel we use `main`, `r` and `msys2` as the default channels.


--8<-- [end:description]


--8<-- [start:example]

## Examples

```shell
pixi init myproject
pixi init ~/myproject
pixi init # Initializes directly in the current directory.
pixi init --channel conda-forge --channel bioconda myproject
pixi init --platform osx-64 --platform linux-64 myproject
pixi init --import environment.yml
pixi init --format pyproject
pixi init --format pixi --scm gitlab
```

--8<-- [end:example]
5 changes: 5 additions & 0 deletions docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@
height: 100%;
}

.md-typeset table td,
.md-typeset table th {
font-size: 0.8rem;
}

table code {
white-space: nowrap;
word-break: keep-all;
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ nav:
- Reference:
- Pixi Manifest: reference/pixi_manifest.md
- Pixi Configuration: reference/pixi_configuration.md
- CLI: reference/cli.md
- CLI: autogenerated/pixi.md
- Misc:
- Pixi vision: vision.md
- Packaging: packaging.md
Expand Down
1 change: 1 addition & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ test-specific-test = { cmd = "pytest", depends-on = ["build-release"] }
# e.g. "multiple_versions_channel_1"
update-test-channel = { cmd = "python update-channels.py", cwd = "tests/data/channels" }

generate-cli-docs = "cargo run --manifest-path pixi_docs/Cargo.toml -- --output-dir docs/autogenerated"

[feature.dev.dependencies]
# Needed for the citation
Expand Down
Loading
Loading