diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 24a148d..b12f6a7 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -22,7 +22,9 @@ jobs: run: pdm install - name: Build Docs - run: pdm run make docs + run: | + make svgs + make docs - name: Upload artifact uses: actions/upload-pages-artifact@v2 diff --git a/Makefile b/Makefile index 2a24ac9..c1c570f 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,9 @@ dev-install: docs: docs/index.md docs/viv.py ## build docs pdm run mkdocs build +svgs: ## build svgs for docs + pdm run python ./scripts/generate-svgs.py + docs/viv.py: src/viv/viv.py cp $< $@ diff --git a/docs/svgs/viv-cache-help.svg b/docs/svgs/viv-cache-help.svg deleted file mode 100644 index ec3d67a..0000000 --- a/docs/svgs/viv-cache-help.svg +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - viv cache --help - - - - - - - - - - usage: viv cache [-h] <sub-cmd> ... - -manage the viv vivenv cache - -options: --h--help    show this help message and exit - -subcommand: -<sub-cmd> -info (i)    get metadata about a vivenv -remove (r)  remove a vivenv - - - - diff --git a/docs/svgs/viv-cache-info-help.svg b/docs/svgs/viv-cache-info-help.svg deleted file mode 100644 index 3a91bc9..0000000 --- a/docs/svgs/viv-cache-info-help.svg +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - viv cache info --help - - - - - - - - - - usage: viv cache info [-h] [-p] [--json] vivenv - -get metadata about a vivenv - -positional arguments: -vivenv        name/hash of vivenv - -options: --h--help    show this help message and exit --p--path    print the absolute path to the vivenv ---json        name:metadata json for vivenvs - - - - diff --git a/docs/svgs/viv-cache-remove-help.svg b/docs/svgs/viv-cache-remove-help.svg deleted file mode 100644 index 58a80f8..0000000 --- a/docs/svgs/viv-cache-remove-help.svg +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - viv cache remove --help - - - - - - - - - - usage: viv cache remove [-h] [vivenv ...] - -remove a vivenv - -positional arguments: -vivenv        name/hash of vivenv - -options: --h--help    show this help message and exit - - - - diff --git a/docs/svgs/viv-exe-help.svg b/docs/svgs/viv-exe-help.svg deleted file mode 100644 index cbf6eaf..0000000 --- a/docs/svgs/viv-exe-help.svg +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - viv exe --help - - - - - - - - - - usage: viv exe [-h] vivenv cmd - -run binary/script in existing vivenv - -examples: -    viv exe <vivenv> python -- script.py -    viv exe <vivenv> python -- -m http.server - -positional arguments: -vivenv        name/hash of vivenv -cmd           command to to execute - -options: --h--help    show this help message and exit - - - - diff --git a/docs/svgs/viv-freeze-help.svg b/docs/svgs/viv-freeze-help.svg deleted file mode 100644 index f15f337..0000000 --- a/docs/svgs/viv-freeze-help.svg +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - viv freeze --help - - - - - - - - - - usage: viv freeze [-h] [-p {abs,rel}] [-s] [-r <path>] [-k] [reqs ...] - -create import statement from package spec - -positional arguments: -reqs                         requirements specifiers - -options: --h--help                   show this help message and exit --p--path {abs,rel}         generate line to add viv to sys.path --s--standalone             generate standalone activation function --r--requirements <path>    path/to/requirements.txt file --k--keep                   preserve environment - - - - diff --git a/docs/svgs/viv-help.svg b/docs/svgs/viv-help.svg deleted file mode 100644 index 22ed303..0000000 --- a/docs/svgs/viv-help.svg +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - viv  --help - - - - - - - - - - usage: viv [-h] [-V] <sub-cmd> ... - -vivisn'tvenv -command line: `viv run typer rich-click -s ./script.py` -python api: __import__("viv").use("typer", "rich-click") - -options: --h--help       show this help message and exit --V--version    show program's version number and exit - -subcommands: -<sub-cmd> -list (l)       list vivenvs -shim (s)       generate viv-powered cli apps -run (r)        run an app/script with an on-demand venv -exe (e)        run binary/script in existing vivenv -cache (c)      manage the viv vivenv cache -freeze (f)     create import statement from package spec -manage (m)     manage viv itself - - - - diff --git a/docs/svgs/viv-list-help.svg b/docs/svgs/viv-list-help.svg deleted file mode 100644 index 57eb106..0000000 --- a/docs/svgs/viv-list-help.svg +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - viv list --help - - - - - - - - - - usage: viv list [-h] [-v] [-q] [-f <key:value>] [--json] - -list vivenvs - -examples: -  `viv list \ -      --filter "accessed-after:2023-08-01"` -  `viv list -q --filter \ -    "created-before:$(date -d '2 weeks ago' +'%Y-%m-%d')"` -  `viv list --filter "files:./script.py"` -  `viv list --filter "files:None"` - -options: --h--help                  show this help message and exit --v--verbose               pretty print full metadata for vivenvs --q--quiet                 show only ids --f--filter <key:value>    filter vivenvs based on key:val ---json                      name:metadata json for vivenvs - - - - diff --git a/docs/svgs/viv-manage-help.svg b/docs/svgs/viv-manage-help.svg deleted file mode 100644 index 254d133..0000000 --- a/docs/svgs/viv-manage-help.svg +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - viv manage --help - - - - - - - - - - usage: viv manage [-h] <sub-cmd> ... - -manage viv itself - -options: --h--help     show this help message and exit - -subcommand: -<sub-cmd> -show (s)     show current installation -install (i)  install fresh viv -update (u)   update viv version -purge (p)    remove traces of viv - - - - diff --git a/docs/svgs/viv-manage-install-help.svg b/docs/svgs/viv-manage-install-help.svg deleted file mode 100644 index eedcf58..0000000 --- a/docs/svgs/viv-manage-install-help.svg +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - viv manage install --help - - - - - - - - - - usage: viv manage install [-h] [-r <ref>] [-s <path>] [-c <path>] [-y] - -install fresh viv - -options: --h--help          show this help message and exit --r--ref <ref>     git reference (branch/tag/commit) --s--src <path>    path/to/source_file --c--cli <path>    path/to/cli (symlink to src) --y--yes           respond yes to all prompts - - - - diff --git a/docs/svgs/viv-manage-purge-help.svg b/docs/svgs/viv-manage-purge-help.svg deleted file mode 100644 index c9fc5f7..0000000 --- a/docs/svgs/viv-manage-purge-help.svg +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - viv manage purge --help - - - - - - - - - - usage: viv manage purge [-h] [-r <ref>] [-s <path>] [-c <path>] [-y] - -remove traces of viv - -options: --h--help          show this help message and exit --r--ref <ref>     git reference (branch/tag/commit) --s--src <path>    path/to/source_file --c--cli <path>    path/to/cli (symlink to src) --y--yes           respond yes to all prompts - - - - diff --git a/docs/svgs/viv-manage-show-help.svg b/docs/svgs/viv-manage-show-help.svg deleted file mode 100644 index a92163f..0000000 --- a/docs/svgs/viv-manage-show-help.svg +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - viv manage show --help - - - - - - - - - - usage: viv manage show [-h] [-p] - -show current installation - -options: --h--help          show this help message and exit --p--pythonpath    show the path/to/install - - - - diff --git a/docs/svgs/viv-manage-update-help.svg b/docs/svgs/viv-manage-update-help.svg deleted file mode 100644 index 6f1dfb0..0000000 --- a/docs/svgs/viv-manage-update-help.svg +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - viv manage update --help - - - - - - - - - - usage: viv manage update [-h] [-r <ref>] [-s <path>] [-c <path>] [-y] - -update viv version - -options: --h--help          show this help message and exit --r--ref <ref>     git reference (branch/tag/commit) --s--src <path>    path/to/source_file --c--cli <path>    path/to/cli (symlink to src) --y--yes           respond yes to all prompts - - - - diff --git a/docs/svgs/viv-run-help.svg b/docs/svgs/viv-run-help.svg deleted file mode 100644 index f14c3ae..0000000 --- a/docs/svgs/viv-run-help.svg +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - viv run --help - - - - - - - - - - usage: viv run [-h] [-s <path/url>] [-r <path>] [-k] [-b <bin>] [reqs  -...] - -run an app/script with an on-demand venv - -examples: -  viv r pycowsay -- "viv isn't venv\!" -  viv r rich -b python -- -m rich -  viv r -s <remote python script> - -positional arguments: -reqs                         requirements specifiers - -options: --h--help                   show this help message and exit --s--script <path/url>      script to execute --r--requirements <path>    path/to/requirements.txt file --k--keep                   preserve environment --b--bin <bin>              console_script/script to invoke - - - - diff --git a/docs/svgs/viv-shim-help.svg b/docs/svgs/viv-shim-help.svg deleted file mode 100644 index 0fc1117..0000000 --- a/docs/svgs/viv-shim-help.svg +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - viv shim --help - - - - - - - - - - usage: viv shim [-h] [-f] [-o <path>] [-p {abs,rel}] [-s] [-r <path>]  -[-b <bin>] [-y] [reqs ...] - -generate viv-powered cli apps - -examples: -  viv shim black -  viv shim yartsu -o ~/bin/yartsu --standalone - -positional arguments: -reqs                         requirements specifiers - -options: --h--help                   show this help message and exit --f--freeze                 freeze/resolve all dependencies --o--output <path>          path/to/output file --p--path {abs,rel}         generate line to add viv to sys.path --s--standalone             generate standalone activation function --r--requirements <path>    path/to/requirements.txt file --b--bin <bin>              console_script/script to invoke --y--yes                    respond yes to all prompts - - - - diff --git a/scripts/generate-svgs.py b/scripts/generate-svgs.py index d6306c7..5f33d4a 100755 --- a/scripts/generate-svgs.py +++ b/scripts/generate-svgs.py @@ -39,23 +39,22 @@ def yartsu(output: Path, args: Tuple[str, str] | str) -> None: if isinstance(args, str): args = (args,) cmd = [ - VIV, - "run", - "-k", - "yartsu", - "--", - "-w", - "70", - "-o", - output, - "--", "viv", *args, "--help", + "|", + "yartsu", + "-w", + "70", + "-o", + str(output), ] - run(cmd) + run(" ".join(cmd), shell=True) +if not SAVE_PATH.is_dir(): + SAVE_PATH.mkdir(exist_ok=True, parents=True) + yartsu(SAVE_PATH / "viv-help.svg", "") for cmd, subcmds in cmds.items(): p = SAVE_PATH / f"viv-{cmd}-help.svg"