A humane CLI application framework
Project description
lionscliapp
A framework for building small command-line tools that remember things.
lionscliapp is a humane CLI application framework for Python. It makes it easy to build stateful developer tools quickly — tools that have persistent configuration, multiple sub-commands, and native support for paths and JSON files, without any argument-parsing boilerplate.
What It Provides
- Persistence — Each project gets a hidden directory (e.g.
.mytool/) with aconfig.json. Users set values once; the tool remembers them. - Automatic CLI parsing — Declare keys; the framework parses, persists, and merges values into
app.ctx. No argparser to write. - Multiple commands — Bind as many sub-commands as you like, or declare a default handler for bare invocations.
- Paths are native — Any key prefixed with
path.becomes apathlib.Path, expanded and resolved automatically. - JSON is native —
read_json()andwrite_json()handle path resolution and formatting. Reading or writing a named JSON file is a one-liner. - Built-in commands —
set,get,keys, andhelpare always available for free.
What It Doesn't Do
lionscliapp is deliberately simple. Configuration values are strings (except path.* keys, which become pathlib.Path). There is no built-in type system for integers, booleans, or enums — coerce from app.ctx yourself if you need them. This is a trade-off in favour of a smaller mental model.
Installation
Requires Python 3.10+.
pip install -e .
Quick Start
import lionscliapp as app
app.declare_app("mytool", "1.0")
app.describe_app("A tool that does useful things")
app.declare_projectdir(".mytool")
app.declare_key("path.output", "~/output")
app.declare_key("path.input", "~/input")
def cmd_run():
output = app.ctx["path.output"] # pathlib.Path, fully resolved
print(f"Output will go to: {output}")
app.declare_cmd("run", cmd_run)
app.describe_cmd("run", "Run the main process")
app.main()
mytool run # uses defaults
mytool set path.output ~/my-output # persist a value
mytool --path.output /tmp run # override for this invocation only
mytool help
mytool keys
Status
Version: 0.1.2 (v0 specification)
Core framework is complete: lifecycle management, command dispatch, built-in commands, configuration layering and persistence, path coercion, JSON I/O utilities.
License
See LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lionscliapp-0.1.2.tar.gz.
File metadata
- Download URL: lionscliapp-0.1.2.tar.gz
- Upload date:
- Size: 43.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0739e3b89a07724c8258b3844b4aeb003e9ae24a50fb712c40d216ec4d9c802
|
|
| MD5 |
7f2c62a965940f904562d3cb6ad05904
|
|
| BLAKE2b-256 |
ed480e974948e8b2fa9e63b9a6cc288dfd35110df15bda35c5865bfe7c17a85f
|
File details
Details for the file lionscliapp-0.1.2-py3-none-any.whl.
File metadata
- Download URL: lionscliapp-0.1.2-py3-none-any.whl
- Upload date:
- Size: 30.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
696d0b548a550aaf1d42a20365475e5c4fb8ee1f7999e257044c9446e1da9488
|
|
| MD5 |
001f791c2ecc9ded76455d40275a1d17
|
|
| BLAKE2b-256 |
3faba7f93964697d86dc807cc71312e46318993c7df4bccd6b2988cf3c55255b
|