Skip to main content

Reasonable defaults for Click CLI applications.

Project description

Nob.py

Python version PyPI version License: MIT Read the wiki OS GitHub profile

Reasonable defaults for Click CLI applications with rich logging...
... and additional goodies.

  1. Installation
  2. Usage
  3. Contributing
  4. TODOs

Installation

uv add nob.py

Or:

pip install nob.py
Install from GitHub
uv add git+https://github.com/ThomasByr/nob.py --branch main

or lock a specific version:

uv add git+https://github.com/ThomasByr/nob.py --tag v0.1.0
Or if you are using pip
pip install git+https://github.com/ThomasByr/nob.py@main

You may directly also use @ with a tag, for example:

pip install git+https://github.com/ThomasByr/nob.py@v0.1.0
Available extras
  • ipc - for inter-process communication with posix_ipc (Linux and MacOS only).

Usage

[!Note] Get more usage examples in the Wiki.

import logging

from nob import cli


@cli.cmd()
@cli.opt("--name", required=True, help="Greet someone.")
def hello(lg: logging.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.

Contributing

[!Important] Sign your commits.

Clone the repository if you have direct right access or clone your fork:

git clone git@github.com:ThomasByr/nob.py nob

Then:

  1. Install uv if you haven't already (or run uv self update):

    Linux Bash
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
    Windows Powershell
    powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
    
  2. Install just:

    cargo install --locked just just-lsp
    

    List all available recipes by typing just.

  3. Sync the codebase dependencies

    Without explicit --all-extras syncing, some recipes will not evaluate on optional dependencies and functionalities.

    just sync
    

Run the following recipes before committing.

We (I) work with ruff, ty and pytest.

just format check ty test

[!TIP] Install pre-commit hooks: just pc-install.
To keep hooks somewhat fast enough, they will only check (not forcibly fix) for typing and formatting.

TODOs

  • workflow to publish to PyPI
  • update the progress module to use human count~~ and duration~~ (you shouldn't use progress bars for tasks shorter than a few seconds, basic h:m:s formatting is good enough for that)
  • add NamedSharedMemory and NamedMessageQueue to ipc module

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nob_py-1.0.0.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nob_py-1.0.0-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

Details for the file nob_py-1.0.0.tar.gz.

File metadata

  • Download URL: nob_py-1.0.0.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for nob_py-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8930cf86a787755842a76cbcbd926f907c9d839504babe394d456d8e8bc0c43c
MD5 91cd2659abc427175e2ba8e4bd3501f4
BLAKE2b-256 7411d640d220dd11d970a411ebf6a8e99fc7e3c0e806f05fcb9941d1ec641401

See more details on using hashes here.

File details

Details for the file nob_py-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: nob_py-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 27.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for nob_py-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 87d108f5942ce8c92e458b77e1fb5d7f56e4b0436d054d84cdb4f3cbd59aaf1e
MD5 69ce1eeb8ef3985488d20cd1a40f37b1
BLAKE2b-256 7225de6a35e28220b167de768c08e81cce2aff947fd9f76376ac71121443ea28

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page