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.3
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.3
Available extras
  • ipc - for inter-process communication with posix_ipc (Linux and MacOS only).

Usage

[!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.

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

    a github action publishes to pypi and creates a new release on new tags

  • update the progress module to use human count and duration

    you shouldn't use progress bars for tasks shorter than a few seconds, basic hh:mm:ss formatting is good enough

  • add NamedSharedMemory and NamedMessageQueue to ipc module

    new abstract class NamedIPC for common features and code between NamedSemaphore, NamedSharedMemory and NamedMessageQueue

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.1.0.tar.gz (22.3 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.1.0-py3-none-any.whl (32.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nob_py-1.1.0.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","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.1.0.tar.gz
Algorithm Hash digest
SHA256 32d32b19d517b57793df4f1e4fe69ce018120bcb0c802dc5faf178886b78cc24
MD5 f1f4c19b7bd726d15444ede90475e504
BLAKE2b-256 b46798d0485e77077e12978198b2bfc7c7d65a04f9e89bcc6fbd356b3147e8ed

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nob_py-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 32.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c44c0df5585fc6c9fd3d03c427f4f202ae2b3de5012f3a66f35f68a5c4c286d
MD5 08a69e5768d8ece96a3f81dd09c6b166
BLAKE2b-256 0abfae06266284be450248d9b0b4dd69e75aa6ff7d651a5a6ce50968d5f7ffa3

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