A4 – Minimal library for command-line applications.
The name comes from A4 paper. It provides absolutely minimal (but not lousy) support for command-line applications.
A4 is listed on PyPI.
Simple logging
a4.log implements minimal logging with three major features which, in my
highly opinionated opinion, should be included in all logging libraries:
- Levels.
- Colors.
- Timestamps.
You may print all logs to stderr with a4.log.fork=True (default False).
Yet another command-line application decorator
a4.app provides a decorator Runnable to convert a class into a runnable
command-line application. All class methods NOT starting with understore
are recognized as sub-commands. This pattern offers more convenience over
single-function decorators when multiple commands require shared resources.
import a4
from a4.app import AppBase, Runnable
@Runnable
class MyApp(AppBase):
def __init__(self):
AppBase.__init__(self)
def gen_calendar(self, args):
"""<yyyy> mmdd-mmdd [mmdd-mmdd ...]
Generate trading calendar for one year.
-c <cal_id> calendar ID, default 86
"""
opts, args = a4.get_opts('c:', args)
if len(args) < 2:
self._die_usage()
cal_id = int(opts['c'] or '86')
self._log(f'calendar id = {cal_id}')
if __name__ == '__main__':
MyApp().run()
Metadata
Release files for a4 0.2.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| a4-0.2.7-py3-none-any.whl | Python 3 | none | any | Details |
Release files / a4-0.2.7-py3-none-any.whl
| Download URL | a4-0.2.7-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4b241e355a20b5ad433e88ec9d34b6319f5ff616258ba3610c7f1399e4f51475
|
|
BLAKE2b-256 checksum How to use checksums |
ce0abba99c10bcb46f5f76b8cf3d2e1d7ca9efb48b04b97b1fcc0fe3d89ba791
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.8.2
|
Security for a4 0.2.7
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.