From 8e862ae2312a5446cda0ce73c5d982018b6afd81 Mon Sep 17 00:00:00 2001 From: Yorick van Pelt Date: Thu, 4 Jul 2024 11:59:48 +0200 Subject: [PATCH] Fix website, reorganize modules --- default.nix | 2 +- examples/gte-small/default.nix | 2 + modules/cog/README.md | 6 + modules/{ => cog}/cuda.nix | 0 modules/{cog.nix => cog/default.nix} | 8 +- .../{cog-interface.nix => cog/interface.nix} | 0 modules/{ => cog}/nix.nix | 0 modules/cog/torch-cuda.json | 1164 +++++++++++++++++ modules/pip-uv/README.md | 8 + modules/{uv-solver.nix => pip-uv/default.nix} | 7 +- modules/stream-layered-image/README.md | 6 + .../coalesce-layers.py | 0 .../default.nix} | 0 modules/weights/README.md | 23 + website/flake-part.nix | 288 ++-- website/mkdocs.yml | 62 + website/render_options.py | 127 ++ website/src/.pages | 8 + website/src/SUMMARY.md | 9 - website/src/{intro.md => index.md} | 0 20 files changed, 1540 insertions(+), 180 deletions(-) create mode 100644 modules/cog/README.md rename modules/{ => cog}/cuda.nix (100%) rename modules/{cog.nix => cog/default.nix} (98%) rename modules/{cog-interface.nix => cog/interface.nix} (100%) rename modules/{ => cog}/nix.nix (100%) create mode 100644 modules/cog/torch-cuda.json create mode 100644 modules/pip-uv/README.md rename modules/{uv-solver.nix => pip-uv/default.nix} (94%) create mode 100644 modules/stream-layered-image/README.md rename modules/{ => stream-layered-image}/coalesce-layers.py (100%) rename modules/{stream-layered-image.nix => stream-layered-image/default.nix} (100%) create mode 100644 modules/weights/README.md create mode 100644 website/mkdocs.yml create mode 100644 website/render_options.py create mode 100644 website/src/.pages delete mode 100644 website/src/SUMMARY.md rename website/src/{intro.md => index.md} (100%) diff --git a/default.nix b/default.nix index 9e48488..c0b7ecd 100644 --- a/default.nix +++ b/default.nix @@ -41,5 +41,5 @@ args: package: dream2nix.lib.evalModules { packageSets.nixpkgs = pkgs; modules = - [ ./modules/cog.nix ./modules/weights args (packageModule package) ]; + [ ./modules/cog ./modules/weights args (packageModule package) ]; } diff --git a/examples/gte-small/default.nix b/examples/gte-small/default.nix index e472a13..5e28f86 100644 --- a/examples/gte-small/default.nix +++ b/examples/gte-small/default.nix @@ -1,4 +1,6 @@ { cog.build.python_snapshot_date = "2023-10-05"; cog.build.cog_version = "0.8.6"; + cognix.includeNix = true; + cognix.fake_pip = true; } diff --git a/modules/cog/README.md b/modules/cog/README.md new file mode 100644 index 0000000..8e44983 --- /dev/null +++ b/modules/cog/README.md @@ -0,0 +1,6 @@ +--- +title: "cognix" +state: released +maintainers: + - YorickvP +--- diff --git a/modules/cuda.nix b/modules/cog/cuda.nix similarity index 100% rename from modules/cuda.nix rename to modules/cog/cuda.nix diff --git a/modules/cog.nix b/modules/cog/default.nix similarity index 98% rename from modules/cog.nix rename to modules/cog/default.nix index 7aab19b..4796f19 100644 --- a/modules/cog.nix +++ b/modules/cog/default.nix @@ -6,7 +6,7 @@ let # conditional overrides: only active when a lib is in use pipOverridesModule = { config, lib, ... }: let - overrides = import ./../overrides.nix; + overrides = import ./../../overrides.nix; metadata = config.lock.content.fetchPipMetadata.sources; in { pip.drvs = lib.mapAttrs (name: info: overrides.${name} or { }) metadata; @@ -73,9 +73,9 @@ let in { imports = [ dream2nix.modules.dream2nix.core - ./cog-interface.nix + ./interface.nix ./cuda.nix - ./stream-layered-image.nix + ../stream-layered-image ./nix.nix ]; config = { @@ -161,7 +161,7 @@ in { dream2nix.modules.dream2nix.pip pipOverridesModule (proxyLockModule config.lock.content) - ./uv-solver.nix + ../pip-uv ]; paths = { inherit (config.paths) projectRoot package; }; name = "cog-docker-env"; diff --git a/modules/cog-interface.nix b/modules/cog/interface.nix similarity index 100% rename from modules/cog-interface.nix rename to modules/cog/interface.nix diff --git a/modules/nix.nix b/modules/cog/nix.nix similarity index 100% rename from modules/nix.nix rename to modules/cog/nix.nix diff --git a/modules/cog/torch-cuda.json b/modules/cog/torch-cuda.json new file mode 100644 index 0000000..9a3215e --- /dev/null +++ b/modules/cog/torch-cuda.json @@ -0,0 +1,1164 @@ +[ + { + "Torch": "2.1.0+cpu", + "Torchvision": "0.16.0", + "Torchaudio": "2.1.0", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cpu", + "CUDA": null, + "Pythons": [ + "3.10", + "3.11", + "3.8", + "3.9" + ] + }, + { + "Torch": "2.1.0+cu118", + "Torchvision": "0.16.0", + "Torchaudio": "2.1.0", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cu118", + "CUDA": "11.8", + "Pythons": [ + "3.10", + "3.11", + "3.8", + "3.9" + ] + }, + { + "Torch": "2.1.0+cu121", + "Torchvision": "0.16.0", + "Torchaudio": "2.1.0", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cu121", + "CUDA": "12.1", + "Pythons": [ + "3.10", + "3.11", + "3.8", + "3.9" + ] + }, + { + "Torch": "2.0.1", + "Torchvision": "0.15.2", + "Torchaudio": "2.0.2", + "FindLinks": "", + "ExtraIndexURL": "", + "CUDA": "11.7", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "2.0.1", + "Torchvision": "0.15.2", + "Torchaudio": "2.0.2", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cu118", + "CUDA": "11.8", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "2.0.1", + "Torchvision": "0.15.2", + "Torchaudio": "2.0.2", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cpu", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "2.0.0", + "Torchvision": "0.15.1", + "Torchaudio": "2.0.1", + "FindLinks": "", + "ExtraIndexURL": "", + "CUDA": "11.7", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "2.0.0", + "Torchvision": "0.15.1", + "Torchaudio": "2.0.1", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cu118", + "CUDA": "11.8", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "2.0.0", + "Torchvision": "0.15.1", + "Torchaudio": "2.0.1", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cpu", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.13.1+cu116", + "Torchvision": "0.14.1+cu116", + "Torchaudio": "0.13.1", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cu116", + "CUDA": "11.6", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.13.1+cu117", + "Torchvision": "0.14.1+cu117", + "Torchaudio": "0.13.1", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cu117", + "CUDA": "11.7", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.13.1+cpu", + "Torchvision": "0.14.1+cpu", + "Torchaudio": "0.13.1", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cpu", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.13.0+cu116", + "Torchvision": "0.14.0+cu116", + "Torchaudio": "0.13.0", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cu116", + "CUDA": "11.6", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.13.0+cu117", + "Torchvision": "0.14.0+cu117", + "Torchaudio": "0.13.0", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cu117", + "CUDA": "11.7", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.13.0+cpu", + "Torchvision": "0.14.0+cpu", + "Torchaudio": "0.13.0", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cpu", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.12.1+cu116", + "Torchvision": "0.13.1+cu116", + "Torchaudio": "0.12.1", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cu116", + "CUDA": "11.6", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.12.1+cu113", + "Torchvision": "0.13.1+cu113", + "Torchaudio": "0.12.1", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cu113", + "CUDA": "11.3", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.12.1+cu102", + "Torchvision": "0.13.1+cu102", + "Torchaudio": "0.12.1", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cu102", + "CUDA": "10.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.12.1+cpu", + "Torchvision": "0.13.1+cpu", + "Torchaudio": "0.12.1", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cpu", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.12.0+cu116", + "Torchvision": "0.13.0+cu116", + "Torchaudio": "0.12.0", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cu116", + "CUDA": "11.6", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.12.0+cu113", + "Torchvision": "0.13.0+cu113", + "Torchaudio": "0.12.0", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cu113", + "CUDA": "11.3", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.12.0+cu102", + "Torchvision": "0.13.0+cu102", + "Torchaudio": "0.12.0", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cu102", + "CUDA": "10.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.12.0+cpu", + "Torchvision": "0.13.0+cpu", + "Torchaudio": "0.12.0", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cpu", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.11.0+cu113", + "Torchvision": "0.12.0+cu113", + "Torchaudio": "0.11.0", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cu113", + "CUDA": "11.3", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.11.0+cu102", + "Torchvision": "0.12.0+cu102", + "Torchaudio": "0.11.0", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cu102", + "CUDA": "10.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.11.0+cpu", + "Torchvision": "0.12.0+cpu", + "Torchaudio": "0.11.0", + "FindLinks": "", + "ExtraIndexURL": "https://download.pytorch.org/whl/cpu", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.10.1+cu111", + "Torchvision": "0.11.2+cu111", + "Torchaudio": "0.10.1", + "FindLinks": "https://download.pytorch.org/whl/cu111/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "11.1", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.10.1+cu102", + "Torchvision": "0.11.2+cu102", + "Torchaudio": "0.10.1", + "FindLinks": "https://download.pytorch.org/whl/cu102/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "10.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.10.1+cpu", + "Torchvision": "0.11.2+cpu", + "Torchaudio": "0.10.1", + "FindLinks": "https://download.pytorch.org/whl/cpu/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.10.0+cu111", + "Torchvision": "0.11.0+cu111", + "Torchaudio": "0.10.0", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "11.1", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.10.0+cu102", + "Torchvision": "0.11.0+cu102", + "Torchaudio": "0.10.0", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "10.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.10.0+cpu", + "Torchvision": "0.11.0+cpu", + "Torchaudio": "0.10.0", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.9.1+cu111", + "Torchvision": "0.10.1+cu111", + "Torchaudio": "0.9.1", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "11.1", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.9.1+cu102", + "Torchvision": "0.10.1+cu102", + "Torchaudio": "0.9.1", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "10.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.9.1+cpu", + "Torchvision": "0.10.1+cpu", + "Torchaudio": "0.9.1", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.9.0+cu111", + "Torchvision": "0.10.0+cu111", + "Torchaudio": "0.9.0", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "11.1", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.9.0+cu102", + "Torchvision": "0.10.0+cu102", + "Torchaudio": "0.9.0", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "10.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.9.0+cpu", + "Torchvision": "0.10.0+cpu", + "Torchaudio": "0.9.0", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.8.1+cu111", + "Torchvision": "0.9.1+cu111", + "Torchaudio": "0.8.1", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "11.1", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.8.1+cu102", + "Torchvision": "0.9.1+cu102", + "Torchaudio": "0.8.1", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "10.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.8.1+cu101", + "Torchvision": "0.9.1+cu101", + "Torchaudio": "0.8.1", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "10.1", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.8.1+cpu", + "Torchvision": "0.9.1+cpu", + "Torchaudio": "0.8.1", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.8.0+cu111", + "Torchvision": "0.9.0+cu111", + "Torchaudio": "0.8.0", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "11.1", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.8.0", + "Torchvision": "0.9.0", + "Torchaudio": "0.8.0", + "FindLinks": "", + "ExtraIndexURL": "", + "CUDA": "10.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.8.0+cpu", + "Torchvision": "0.9.0+cpu", + "Torchaudio": "0.8.0", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.7.1+cu110", + "Torchvision": "0.8.2+cu110", + "Torchaudio": "0.7.2", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "11.0", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.7.1", + "Torchvision": "0.8.2", + "Torchaudio": "0.7.2", + "FindLinks": "", + "ExtraIndexURL": "", + "CUDA": "10.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.7.1+cu101", + "Torchvision": "0.8.2+cu101", + "Torchaudio": "0.7.2", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "10.1", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.7.1+cu92", + "Torchvision": "0.8.2+cu92", + "Torchaudio": "0.7.2", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "9.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.7.1+cpu", + "Torchvision": "0.8.2+cpu", + "Torchaudio": "0.7.2", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.7.0+cu110", + "Torchvision": "0.8.1+cu110", + "Torchaudio": "0.7.0", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "11.0", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.7.0", + "Torchvision": "0.8.1", + "Torchaudio": "0.7.0", + "FindLinks": "", + "ExtraIndexURL": "", + "CUDA": "10.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.7.0+cu101", + "Torchvision": "0.8.1+cu101", + "Torchaudio": "0.7.0", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "10.1", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.7.0+cu92", + "Torchvision": "0.8.1+cu92", + "Torchaudio": "0.7.0", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "9.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.7.0+cpu", + "Torchvision": "0.8.1+cpu", + "Torchaudio": "0.7.0", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.6.0", + "Torchvision": "0.7.0", + "Torchaudio": "", + "FindLinks": "", + "ExtraIndexURL": "", + "CUDA": "10.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.6.0+cu101", + "Torchvision": "0.7.0+cu101", + "Torchaudio": "", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "10.1", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.6.0+cu92", + "Torchvision": "0.7.0+cu92", + "Torchaudio": "", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "9.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.6.0+cpu", + "Torchvision": "0.7.0+cpu", + "Torchaudio": "", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.5.1", + "Torchvision": "0.6.1", + "Torchaudio": "", + "FindLinks": "", + "ExtraIndexURL": "", + "CUDA": "10.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.5.1+cu101", + "Torchvision": "0.6.1+cu101", + "Torchaudio": "", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "10.1", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.5.1+cu92", + "Torchvision": "0.6.1+cu92", + "Torchaudio": "", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "9.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.5.1+cpu", + "Torchvision": "0.6.1+cpu", + "Torchaudio": "", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.5.0", + "Torchvision": "0.6.0", + "Torchaudio": "", + "FindLinks": "", + "ExtraIndexURL": "", + "CUDA": "10.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.5.0+cu101", + "Torchvision": "0.6.0+cu101", + "Torchaudio": "", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "10.1", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.5.0+cu92", + "Torchvision": "0.6.0+cu92", + "Torchaudio": "", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "9.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.5.0+cpu", + "Torchvision": "0.6.0+cpu", + "Torchaudio": "", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.4.0", + "Torchvision": "0.5.0", + "Torchaudio": "", + "FindLinks": "", + "ExtraIndexURL": "", + "CUDA": "10.1", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.4.0+cu92", + "Torchvision": "0.5.0+cu92", + "Torchaudio": "", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "9.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.4.0+cpu", + "Torchvision": "0.5.0+cpu", + "Torchaudio": "", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.2.0", + "Torchvision": "0.4.0", + "Torchaudio": "", + "FindLinks": "", + "ExtraIndexURL": "", + "CUDA": "10.0", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.2.0+cu92", + "Torchvision": "0.4.0+cu92", + "Torchaudio": "", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": "9.2", + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + }, + { + "Torch": "1.2.0+cpu", + "Torchvision": "0.4.0+cpu", + "Torchaudio": "", + "FindLinks": "https://download.pytorch.org/whl/torch_stable.html", + "ExtraIndexURL": "", + "CUDA": null, + "Pythons": [ + "3.6", + "3.7", + "3.8", + "3.9", + "3.10", + "3.11" + ] + } +] diff --git a/modules/pip-uv/README.md b/modules/pip-uv/README.md new file mode 100644 index 0000000..35f6d76 --- /dev/null +++ b/modules/pip-uv/README.md @@ -0,0 +1,8 @@ +--- +title: "pip-uv" +state: released +maintainers: + - YorickvP +--- + +We use `uv` to resolve python dependencies instead of `pip`. This is faster and has slightly more features. diff --git a/modules/uv-solver.nix b/modules/pip-uv/default.nix similarity index 94% rename from modules/uv-solver.nix rename to modules/pip-uv/default.nix index 2795a31..0decf7c 100644 --- a/modules/uv-solver.nix +++ b/modules/pip-uv/default.nix @@ -1,4 +1,4 @@ -{ lib, config, packageSets, ... }: +{ lib, config, dream2nix, packageSets, ... }: let cfg = config.pip; pkgs = packageSets.nixpkgs; @@ -49,6 +49,11 @@ in { default = [ ]; }; }; + imports = [ + dream2nix.modules.dream2nix.assertions + dream2nix.modules.dream2nix.deps + dream2nix.modules.dream2nix.lock + ]; config = lib.mkMerge [ { assertions = [{ diff --git a/modules/stream-layered-image/README.md b/modules/stream-layered-image/README.md new file mode 100644 index 0000000..a10a1e4 --- /dev/null +++ b/modules/stream-layered-image/README.md @@ -0,0 +1,6 @@ +--- +title: "dockerTools.streamLayeredImage" +state: released +maintainers: + - YorickvP +--- diff --git a/modules/coalesce-layers.py b/modules/stream-layered-image/coalesce-layers.py similarity index 100% rename from modules/coalesce-layers.py rename to modules/stream-layered-image/coalesce-layers.py diff --git a/modules/stream-layered-image.nix b/modules/stream-layered-image/default.nix similarity index 100% rename from modules/stream-layered-image.nix rename to modules/stream-layered-image/default.nix diff --git a/modules/weights/README.md b/modules/weights/README.md new file mode 100644 index 0000000..d0e1b9d --- /dev/null +++ b/modules/weights/README.md @@ -0,0 +1,23 @@ +--- +title: "weights" +state: released +maintainers: + - YorickvP +--- + +This module facilitates getting weights (mainly from huggingface) into your cog image. It can do this in two different ways: +1. Embedding into the image. This is suitable for small weights. +2. Loaded from replicate.delivery using [pget](https://github.com/replicate/pget). Your script should call the `download-weights` binary to do this during `setup`. + +To use this, add a section to your `cog.yaml`: + +```yaml + +weights: + - src: thenlper/gte-large + download_include: ["model.safetensors"] +``` + +Then, run `cognix lock` to write the weight information into the `lock.json` file. +Call `cognix push` to push the weights to replicate.delivery. + diff --git a/website/flake-part.nix b/website/flake-part.nix index eb88e7a..9cea9ef 100644 --- a/website/flake-part.nix +++ b/website/flake-part.nix @@ -9,44 +9,56 @@ system, ... }: let - modules' = self.inputs.dream2nix.modules.dream2nix; - modules = (lib.filterAttrs (name: _: ! lib.elem name excludes) modules') // { - stream-layered-image = ../modules/stream-layered-image.nix; - cognix = ../modules/cog-interface.nix; - # uv-solver = ../modules/uv-solver.nix; - weights = ../modules/weights/interface.nix; - }; - dream2nixRoot = ./..; - # dream2nix = import dream2nixRoot; - excludes = [ - # NOT WORKING - # TODO: fix those - "core" - "ui" - "docs" - "assertions" - "nixpkgs-overrides" - "WIP-python-pdm" - - # doesn't need to be rendered - "_template" - ]; - public = lib.genAttrs [ - "pip" - "cognix" - "stream-layered-image" - "weights" - ] (name: null); +# modules' = self.inputs.dream2nix.modules.dream2nix; +# modules = (lib.filterAttrs (name: _: ! lib.elem name excludes) modules') // { +# stream-layered-image = ../modules/stream-layered-image.nix; +# cognix = ../modules/cog-interface.nix; +# # uv-solver = ../modules/uv-solver.nix; +# weights = ../modules/weights/interface.nix; +# }; +# public = lib.genAttrs [ +# "pip" +# "cognix" +# "weights" +# ] (name: null); + isDirectory = path: + let + dirName = builtins.dirOf path; + baseName = builtins.baseNameOf path; + dirContent = builtins.readDir dirName; + in + builtins.hasAttr baseName dirContent && + dirContent.${baseName} == "directory"; - # interface - # sourcePathStr = toString inputs.dream2nix; - sourcePathStr = "${inputs.dream2nix}/modules/"; - sourcePathStr2 = "${self}/modules/"; +# let + inherit (inputs) dream2nix; + dream2nixRoot = ./..; baseUrl = "https://github.com/nix-community/dream2nix/blob/master"; - specialArgs = { - inherit (inputs) dream2nix; - packageSets.nixpkgs = pkgs; + cognixUrl = "https://github.com/datakami/cognix/blob/main"; + + getOptions = {modules}: let + options = lib.flip lib.mapAttrs modules ( + name: module: let + evaluated = lib.evalModules { + specialArgs = { + inherit dream2nix; + packageSets.nixpkgs = pkgs; + }; + modules = [module]; + }; + in + evaluated.options + ); + docs = lib.flip lib.mapAttrs options (name: options: + pkgs.nixosOptionsDoc { + inherit options; + inherit transformOptions; + warningsAreErrors = false; + }); + in { + inherit options docs; }; + transformOptions = opt: opt // { @@ -54,153 +66,99 @@ map ( decl: let - subpath = lib.removePrefix sourcePathStr2 (lib.removePrefix sourcePathStr (toString decl)); + declstr = toString decl; in { - url = baseUrl + subpath; - name = subpath; + url = lib.replaceStrings [ (toString dream2nix) (toString self) ] [ baseUrl cognixUrl ] declstr; + name = lib.replaceStrings [ (toString dream2nix) (toString self) ] [ "dream2nix" "cognix" ] declstr; } ) opt.declarations; }; - # 0 = no chapters, 1 = one level of chapters, 2 = two levels of chapters ... - chaptersNesting = 1; - # A tree where nodes are (sub)chapters and leafs are options. - # Nesting can be arbitrary - chaptersTree = { - "Modules" = - lib.filterAttrs (name: _: public ? ${name}) optionsTree; - "Modules (Internal + Experimental)" = - lib.filterAttrs (name: _: ! public ? ${name}) optionsTree; + modules = { + inherit (dream2nix.modules.dream2nix) + buildPythonPackage + builtins-derivation + mkDerivation + overrides + pip; + cognix = ../modules/cog; + stream-layered-image = ../modules/stream-layered-image; + pip-uv = ../modules/pip-uv; + weights = ../modules/weights/interface.nix; }; - optionsTree = lib.flip lib.mapAttrs modules ( - name: module: let - evaluated = lib.evalModules { - inherit specialArgs; - modules = [module]; - }; - in - # lib.trace "Rendering Module ${name}" - (builtins.removeAttrs evaluated.options ["_module"]) - ); - # implementation - highlight-js = let - highlight-core = pkgs.fetchurl { - url = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"; - hash = "sha256-g3pvpbDHNrUrveKythkPMF2j/J7UFoHbUyFQcFe1yEY="; - }; - highlight-nix = pkgs.fetchurl { - url = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/nix.min.js"; - hash = "sha256-BLoZ+/OroDAxMsdZ4GFZtQfsg6ZJeLVNeBzN/82dYgk="; - }; - in - pkgs.runCommand "highlight-js" {} '' - cat ${highlight-core} > $out - cat ${highlight-nix} >> $out - ''; - highlight-style = pkgs.fetchurl { - url = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/vs.min.css"; - hash = "sha256-E1kfafj5iO+Tw/04hxdSG+OnvczojOXK2K0iCEYfzSw="; + options = getOptions { + inherit modules; }; - optionsToMdFile = options: let - docs = pkgs.nixosOptionsDoc { - inherit options; - inherit transformOptions; - warningsAreErrors = false; - }; - in - docs.optionsCommonMark; - - mdFiles = nesting: chapters: - if nesting == 0 - then lib.mapAttrs (name: optionsToMdFile) chapters - else lib.concatMapAttrs (name: mdFiles (nesting - 1)) chapters; - - mdFilesDir = pkgs.runCommand "md-files-dir" {} '' - mkdir -p $out - cp -r ${lib.concatStringsSep "\n cp -r " (lib.mapAttrsToList (name: file: "${file} $out/${name}.md") (mdFiles chaptersNesting chaptersTree))} - ''; - - spacing = depth: - if depth == 0 - then "- " - else " " + spacing (depth - 1); - # returns "" for chapters with nesting or an md file for chapters with options - chapterUrl = nesting: name: - if nesting == 0 - then "options/${name}.md" - else ""; - - renderChapters = depth: nesting: chapters: - lib.concatStringsSep "\n" - (lib.flip lib.mapAttrsToList chapters ( - name: chapter: - "${spacing depth}[${name}](${chapterUrl nesting name})" - + lib.optionalString (nesting > 0) ("\n" + (renderChapters (depth + 1) (nesting - 1) chapter)) - )); - - summaryMdFile = - pkgs.writeText "summary.md" - (renderChapters 0 chaptersNesting chaptersTree); - - mdBookSource = pkgs.runCommand "website-src" {} '' - mkdir -p $out/options - cp ${summaryMdFile} $out/SUMMARY.md - cp -r ${mdFilesDir}/* $out/options/ - - # add table of contents for each md file - for file in $out/options/*.md; do - name="$(basename "$file")" - name="''${name%.md}" - echo "# $name - options" > "$file.tmp" - echo '' | cat - "$file" >> "$file.tmp" - mv $file.tmp $file - done - ''; + optionsReference = let + + toSource = sourcePath: if isDirectory sourcePath then sourcePath else dirOf sourcePath; + publicModules = + lib.filterAttrs + (n: v: lib.pathExists ((toSource v) + "/README.md")) + modules; + createReference = name: sourcePath: '' + target_dir="$out/${name}/" + mkdir -p "$target_dir" + ln -s ${toSource sourcePath}/README.md "$target_dir/index.md" + ln -s ${options.docs.${name}.optionsJSON}/share/doc/nixos/options.json "$target_dir" + cat > "$target_dir/.pages" <' - pkgs.mdbook-toc - # inputs.mdbook-toc.defaultPackage.${system} + pkgs.python3.pkgs.mkdocs + pkgs.python3.pkgs.mkdocs-material + dream2nix.packages.${system}.mkdocs-awesome-pages-plugin + optionsReference ]; } '' - cp -rL --no-preserve=mode ${dream2nixRoot}/website/* ./ - cp -r ${mdBookSource}/* src/ - - # insert highlight.js - cp ${highlight-js} ./src/highlight.js - cp ${highlight-style} ./src/highlight.css - - # merge original and generated SUMMARY.md - cp ${dream2nixRoot}/website/src/SUMMARY.md SUMMARY.md.orig - { - while read ln; do - case "$ln" in - "# Modules Reference") - echo "# Modules Reference" - cat ${mdBookSource}/SUMMARY.md - ;; - *) - echo "$ln" - ;; - esac - done - } < SUMMARY.md.orig > src/SUMMARY.md - - # insert icon - mkdir -p ./theme - # cp {../../../modules/dream2nix/core/docs/theme/favicon.png} ./theme/favicon.png - - ${pkgs.mdbook}/bin/mdbook build --dest-dir out - mv out/html $out + cp -rL --no-preserve=mode ${./.}/* . + cp -rL --no-preserve=mode ${inputs.dream2nix}/docs/ d2n + cp -rL --no-preserve=mode ${inputs.dream2nix}/docs/src/style.css src/ + ln -sfT ${optionsReference} ./src/reference + mkdocs build ''; in { + packages.optionsReference = optionsReference; packages.website = website; - packages.docs-generated-mdbook-src = mdBookSource; + devShells.website = let + pythonWithDeps = pkgs.python3.withPackages ( + ps: [ + ps.ipython + ps.black + ps.pytest + ps.pytest-cov + ] + ); + in + pkgs.mkShell { + inputsFrom = [self.packages.${system}.website]; + packages = [ + pythonWithDeps + ]; + + shellHook = '' + cd $PRJ_ROOT/website + if [ ! -d src/reference ]; then + echo "linking .#reference to src/reference, you need to update this manually\ + and remove it before a production build" + ln -sfT $(nix build ..#optionsReference --no-link --print-out-paths) src/reference + ln -sfT ${inputs.dream2nix}/docs/ d2n + ln -sfT ${inputs.dream2nix}/docs/src/style.css src/style.css + fi + ''; + }; }; } diff --git a/website/mkdocs.yml b/website/mkdocs.yml new file mode 100644 index 0000000..b9c2a0e --- /dev/null +++ b/website/mkdocs.yml @@ -0,0 +1,62 @@ +site_name: Cognix +docs_dir: "src" +site_url: "https://datakami.github.io/cognix" +site_dir: !ENV out + +repo_url: https://github.com/datakami/cognix +repo_name: datakami/cognix +edit_uri: edit/main/website/src/ + +plugins: + - search + - awesome-pages + +hooks: + - render_options.py + +extra_css: + - style.css + +markdown_extensions: + - toc: + permalink: true + - tables + - admonition + - pymdownx.escapeall + - pymdownx.highlight: + anchor_linenums: true + - pymdownx.inlinehilite + - pymdownx.snippets + - pymdownx.superfences + - pymdownx.tasklist + - pymdownx.details + +validation: + omitted_files: warn + absolute_links: warn + unrecognized_links: warn + +theme: + custom_dir: d2n/theme + name: material + # favicon: favicon.png + # logo: favicon.png + features: + - search.suggest + - search.highlight + - instant + - navigation.instant + - navigation.instant.prefetch + - navigation.instant.progress + - navigation.tracking + - navigation.path + - navigation.top + - toc.follow + - content.code.copy + - content.code.annotate + +extra: + social: + - icon: fontawesome/brands/github + link: https://github.com/datakami/cognix + name: Cognix on Github diff --git a/website/render_options.py b/website/render_options.py new file mode 100644 index 0000000..670ac70 --- /dev/null +++ b/website/render_options.py @@ -0,0 +1,127 @@ +# file copied from dream2nix +import logging +import json +from pathlib import Path +from collections import OrderedDict +from typing import Dict, Tuple +from urllib.request import UnknownHandler + +from mkdocs.structure.pages import Page +from mkdocs.structure.nav import Navigation, Section +from mkdocs.structure.files import Files +from mkdocs.config.defaults import MkDocsConfig +from mkdocs.plugins import event_priority + +from pygments import highlight +from pygments.lexers import get_lexer_by_name +from pygments.formatters import HtmlFormatter + + +log = logging.getLogger("mkdocs") + + +def is_reference_page(page: Page) -> bool: + return page.file.src_path.startswith("reference/") + + +def pygments(code: str, lang: str) -> str: + return highlight(code, get_lexer_by_name(lang), HtmlFormatter()) + + +def sort_options(item: Tuple[str, Dict], module_name: str) -> int: + """ + Sort the modules. First the one the page is about, + then single options, then the rest, alphabetically + """ + name, option = item + print(name, module_name) + if name == module_name: + return "" + elif len(option["children"]) == 0: + return " " + name + else: + return name + + +def preprocess_options(options, module_name): + tree = dict() + for name, option in options.items(): + if name.startswith("_module"): + continue + cursor = tree + parts = name.split(".") + for index, part in enumerate(parts): + if index + 1 == len(parts): + # We're at the last part, add the option here + if part not in cursor: + cursor[part] = dict(children=dict()) + cursor[part].update(**option) + else: + # We're not at the last part, ensure the path exists + if part not in cursor: + cursor[part] = dict(children=dict()) + cursor = cursor[part]['children'] + + return OrderedDict(sorted(tree.items(), key=lambda i: sort_options(i, module_name))) + + +def on_page_markdown( + markdown: str, page: Page, config: MkDocsConfig, files: Files +) -> str | None: + """Check whether the source path starts with "reference/". + If it does: + - render a header template, containing values from the source markdown file + - render the source markdown file + - render an options.json file containing nixos option definitions from the + same directory where the source file is found. Then render those options. + """ + if not is_reference_page(page): + return markdown + src_path = Path(config.docs_dir) / page.file.src_path + module_name = src_path.parent.stem + env = config.theme.get_env() + env.filters["pygments"] = pygments + + header = env.get_template("reference_header.html").render(meta=page.meta) + + options_path = src_path.parent / "options.json" + if not options_path.exists(): + log.error(f"{options_path} does not exist") + return None + with open(options_path, "r") as f: + options = preprocess_options(json.load(f), module_name) + reference = env.get_template("reference_options.html").render(options=options) + + return "\n\n".join([header, markdown, reference]) + + +@event_priority(-100) +def on_nav(nav: Navigation, config: MkDocsConfig, files: Files) -> Navigation | None: + """Customize the navigation: If a reference section is found, + filter for a "state" variable defined in a markdown files front-matter. + Leave all items where "state" equals "released" as-is, but put + all others in an "experimental" section below that.""" + try: + reference_section = next(filter(lambda i: i.title == "Reference", nav.items)) + reference_index = nav.items.index(reference_section) + except StopIteration: + # Return the navigation as-is if we don't find + # a reference section + return nav + + released = [] + experimental = [] + for page in reference_section.children: + # to have metadata from the yaml front-matter available + page.read_source(config) + state = page.meta.get("state") + if state == "released": + released.append(page) + else: + experimental.append(page) + + experimental_section = Section("Experimental Modules", experimental) + reference_section.children = released + [experimental_section] + + nav.items[reference_index] = reference_section + return nav diff --git a/website/src/.pages b/website/src/.pages new file mode 100644 index 0000000..ea5f16f --- /dev/null +++ b/website/src/.pages @@ -0,0 +1,8 @@ +nav: + - "Home": index.md + - "Getting Started": gettingstarted.md + - "Contact": contact.md + - Examples: + - examples: examples.md + - Reference: reference + \ No newline at end of file diff --git a/website/src/SUMMARY.md b/website/src/SUMMARY.md deleted file mode 100644 index 757b50d..0000000 --- a/website/src/SUMMARY.md +++ /dev/null @@ -1,9 +0,0 @@ -- [Introduction](./intro.md) -- [Getting started](./gettingstarted.md) -- [Contact](./contact.md) - -# Examples -- [Examples](./examples.md) -# Concepts - -# Modules Reference diff --git a/website/src/intro.md b/website/src/index.md similarity index 100% rename from website/src/intro.md rename to website/src/index.md