Skip to main content

Chuda

PyPI PyPI - Python Version GitHub Documentation Status codecov CircleCI

Chuda is a very simple Python3 framework to create CLI (Command-Line-Interface) tools.

It will handle for you some basic stuff: parse configuration file, logging, argument parsing, signal handling etc...

Features

  • Represent commands and argparse arguments by Python classes
  • Handle parsing of a configuration file for you (INI, JSON, or YAML with pyyaml)
  • Provide you a configurable logger, and some basic options to quiet/verbose mode
  • Signals handling by decorator

Documentation

The documentation is accessible here

Example

import sys
import signal
from chuda import App, autorun, Command signal_handler, Option


class FooSubcommand(Command):
    command_name = "foo"
    description = "a foo subcommand"

    def main(self):
        self.logger.info("foo")
        self.app.subcommands["bar"].run()


class BarSubcommand(Command):
    command_name = "bar"
    description = "the ultimate bar subcommand"

    arguments = [
        Option(name=["--path"], default="~")
    ]

    def main(self):
        process = self.shell.run(
            "ls", cwd=self.arguments.path
        )
        self.logger.info(process.output)


@autorun()
class FooBarApp(App):
    app_name = "foobar"
    description = "Foobar application"

    config_path = ["./config.ini", "../config.ini"]

    subcommands = [FooSubcommand, BarSubcommand]

    @signal_handler(signal.SIGINT)
    def handle_ctrl_c(self, signum, frame):
        self.logger.info("Stopping...")
        sys.exit(2)

Release files for chuda 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chuda 0.1.1
File Size Uploaded
chuda-0.1.1.tar.gz 11.9 kB Details

Release files / chuda-0.1.1.tar.gz

Download URL chuda-0.1.1.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3064aaa4e01a5a9b132c8d3665458e4b8cca4a659a846019e47c58e65b3c364d
BLAKE2b-256 checksum
How to use checksums
14eb117ffe70d9c4071647ab3c13aedeb3e5eea56c83c89998b162a700e71dec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.1.0

1 release file

0.0.23

1 release file

0.0.22

1 release file

0.0.21

1 release file

0.0.20

1 release file

0.0.19

1 release file

0.0.18

1 release file

0.0.17

1 release file

0.0.15

1 release file

0.0.14

1 release file

0.0.13

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.7

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page