Catalog PyPI
PACKAGE EXPLORERView in registry

a4

PyPI

Minimal library for command-line applications.

Versions collected1
Direct dependencies0From release 0.2.7
Last observed20 Oct, 16:41 UTC

README

Version 0.2.7 documentation

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()

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.2.724 Jun 20240

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
sunyj/a4

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 16:41 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:5a3186f32987d1d9e607864d812d58c9f3a9f24fe5c02ff2ed6f2230bd30d109