clan-core/pkgs/clan-cli
Jörg Thalheim 18627baa9c
All checks were successful
checks-impure / test (pull_request) Successful in 1m37s
checks / test (pull_request) Successful in 2m48s
only enable corsmiddleware when in dev mode and allow all origins
2023-11-14 15:32:03 +01:00
..
.vscode API: Added Path validators. api/flake/create inits git repo. Fixed vscode interpreter problem 2023-10-27 19:11:27 +02:00
bin generate openapi 2023-08-25 11:39:46 +02:00
clan_cli only enable corsmiddleware when in dev mode and allow all origins 2023-11-14 15:32:03 +01:00
tests Merge pull request 'add module for meshnamed' (#499) from Mic92-sops-nix into main 2023-11-14 12:01:26 +00:00
.envrc Added repro_env_break debugging command. This spawn a terminal inside the temp home folder with the same environment as the python test 2023-10-27 19:20:17 +02:00
default.nix moving deal dependencies to tests only 2023-11-10 12:39:24 +01:00
deps-flake.nix clan-cli: use dependency flake instead of registry 2023-09-06 14:47:28 +02:00
enter_nix_sandbox.sh Fixed test_webui only failing in nix_sandbox 2023-10-29 19:35:29 +01:00
flake-module.nix rename luispkgs to nixpkgs-for-deal 2023-11-10 13:14:06 +01:00
pyproject.toml Fixed wrong examples 2023-11-08 21:40:17 +01:00
README.md Fixed test_webui only failing in nix_sandbox 2023-10-29 19:35:29 +01:00
shell.nix api/machines: init put_machine replacing create_machine and set_machine_config 2023-11-13 20:25:52 +07:00

clan-cli

The clan-cli contains the command line interface as well as the graphical webui through the clan webui command.

Hacking on the cli

We recommend setting up direnv to load the developement with nix. If you do not have it set up you can also use nix develop directly like this:

use flake .#clan-cli --builders ''

After you can use the local bin wrapper to test things in the cli:

./bin/clan

Hacking on the webui

By default the webui is build from a tarball available https://git.clan.lol/clan/-/packages/generic/ui/. To start a local developement environment instead, use the --dev flag:

./bin/clan webui --dev

This will spawn two webserver, a python one to for the api and a nodejs one that rebuilds the ui on the fly.

Run webui directly

Useful for vscode run and debug option

python -m clan_cli.webui --reload --no-open

Add this launch.json to your .vscode directory to have working breakpoints in your vscode editor.

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Clan Webui",
      "type": "python",
      "request": "launch",
      "module": "clan_cli.webui",
      "justMyCode": true,
      "args": ["--reload", "--no-open", "--log-level", "debug"]
    }
  ]
}

Run locally single-threaded for debugging

By default tests run in parallel using pytest-parallel. pytest-parallel however breaks breakpoint(). To disable it, use this:

pytest -n0 -s

You can also run a single test like this:

pytest -n0 -s tests/test_secrets_cli.py::test_users

Run tests in nix container

Run all impure checks

nix run .#impure-checks

Run all checks

nix flake check

Debugging functions

Debugging functions can be found under src/debug.py quite interesting is the function breakpoint_shell() which drops you into a shell with the test environment loaded.