manage.py
Human friendly CLI builder.
Installation
pip install manage.py
Quickstart
cat manage.py
from manager import Manager
manager = Manager()
@manager.command
def echo(text, capitalyze=False):
"""print the given <name>"""
if capitalyze:
text = text.upper()
return text
if __name__ == '__main__':
manager.main()
manage --help:
usage: manage [<namespace>.]<command> [<args>] positional arguments: command the command to run optional arguments: -h, --help show this help message and exit available commands: echo print the given <name>
manage echo --help:
$ manage echo --help usage: manage [-h] [--capitalyze] text print the given <name> positional arguments: text no description optional arguments: -h, --help show this help message and exit --capitalyze no description
Managers
Managers can be used together by merging them
from third_party import manager
my_app_manager.merge(manager)
# Merge within a new namespace:
my_app_manager.merge(manager, namespace='third_party')
Commands
Commands can be organized within namespaces
@manager.command(namespace='config')
def set(key, value):
# ...
Arguments
Currently the framework will assume that arguments with default values are key-value arguments (--arg value) while required arguments are positional ones.
In other words, this definition:
@manager.command
def create(user):
pass
will expect an invocation of the kind:
$ manage create foobar
and user in create() will take the value 'foobar'.
On the other hand, this:
@manager.command
def create(user=''):
pass
will expect an invocation of the kind:
$ manage create --user foobar
The downside is obviously that it’s not currently possible to have a required non-positional argument.
Argument definition can be overridden
@manager.arg('first_arg', help='this is help for first arg')
@manager.command
def my_command(first_arg):
# ...
Arguments can be prompted
@manager.prompt('password', hidden=True, confirm=True)
@manager.command
def connect(username, password):
# ...
Environment
Environment variables can be sourced from a .env file as key=value pair.
Environment variable can be enforce using Manager.env decorator
@manager.env('MY_ENV_VAR')
@manager.command
def my_command():
return os.environ['MY_ENV_VAR']
Metadata
Release files for manage.py 0.2.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| manage.py-0.2.10.tar.gz | 9.7 kB | Without provenance | Details for manage.py-0.2.10.tar.gz |
Release files / manage.py-0.2.10.tar.gz
| Download URL | manage.py-0.2.10.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3879bbe304794f36f98fd04af4c9f1ef2b8640fc76ee25572c591beef7cfb1c1
|
|
BLAKE2b-256 checksum How to use checksums |
8226e8a4f27502e1d394dac365ca57fe140d0c5ad442ae83d416dbc866877dec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for manage.py 0.2.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.