Reasonable defaults for Click CLI applications with rich logging...
... and additional goodies.
uv add nob.pyOr:
pip install nob.pyInstall from GitHub
uv add git+https://github.com/ThomasByr/nob.py --branch mainor lock a specific version:
uv add git+https://github.com/ThomasByr/nob.py --tag v0.1.3Or if you are using pip
pip install git+https://github.com/ThomasByr/nob.py@mainYou may directly also use @ with a tag, for example:
pip install git+https://github.com/ThomasByr/nob.py@v0.1.3Available extras
ipc- for inter-process communication with posix_ipc (Linux and MacOS only).
Note
Get more usage examples in the Wiki.
from nob import cli
@cli.cmd()
@cli.opt("--name", required=True, help="Greet someone.")
def hello(lg: cli.Logger, name: str):
lg.info("Hello %s", name)
if __name__ == "__main__":
hello()run with:
uv run <file.py> --name "Eric Norbert"Replace uv run with python once your environment is activated - if you don't use uv.
Important
Sign your commits.
-
Install uv if you haven't already (or run
uv self update):Linux Bash
curl -LsSf https://astral.sh/uv/install.sh | shor
wget -qO- --content-disposition https://astral.sh/uv/install.sh | shWindows Powershell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
-
Install just:
With uv
uv tool install rust-just
Or if you have cargo
This way you can also install just-lsp.
cargo install --locked just just-lsp
List all available recipes
justSync the codebase dependencies
Without explicit --all-extras syncing, some recipes will not evaluate on optional dependencies and functionalities.
The sync recipe will also update the dependencies if possible.
just syncRelease a new version
This recipe uses release-it. You will need a working npx installation.
Install fnm with cargo
cargo install fnm --locked
fnm install --lts
fnm use --ltsjust releaseTip
Install pre-commit hooks: just pc-install.
To keep hooks somewhat fast enough, they will only check (not forcibly fix) for typing and formatting.