Skip to main content

Simple Console Application with Logging, Yaml Configuration and Argparse

Project description

This package aims to provide a simple common framework for console jobs in Python. There is nothing really new about the whole approach and everything can be done using existing tools and packages. SCALYCA just wraps it all together into a reusable class that should be easy to extend for use in batch jobs or simple pipeline stages.

It is supposed to be very lightweight and easily integrable. More complex tasks are probably better suited for custom solutions using the same modules. The programs are not supposed to be interactive, everything has to be initialized either from the command line or, in case of SCALYCA, also from a selectable configuration file.

SCALA -- Simple Console Application with Logging and Argparse

The main class is called Scala. It has two main components:

  • Logging, primarily to stdout during the execution of the program. This is implemented with the logging module, using just a single logger.
  • Parsing and processing command line arguments, that configure the initial state of the application and tell it what and where should exactly be done. The tool for the job is argparse.

SCALYCA -- Simple Console Application with Logging, YAML Configuration and Argparse

Scalyca is a subclass of Scala that adds persistent configuration to the program, which is read from a YAML file during the initialization process, then stored as a static DotMap from module dotmap. This is similar to a Python dictionary except that it allows for dot access, which is much more legible.

All of the properties can be overridden from the command line. The resulting object is accessible through the config variable of the class.

Usage

Just extend the Scala class:

  • Static attribute app_name sets the name of the application that will be displayed by argparse.
  • Static attribute description sets the long description for argparse.
  • In add_arguments you are supposed to add all arguments to the built-in ArgumentParser.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scalyca-0.2.6.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scalyca-0.2.6-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file scalyca-0.2.6.tar.gz.

File metadata

  • Download URL: scalyca-0.2.6.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.2 Linux/6.1.0-41-amd64

File hashes

Hashes for scalyca-0.2.6.tar.gz
Algorithm Hash digest
SHA256 9f737dc7ab0b0b72c23801815cb93f0cf639bdbf211b192083017d28541ffad6
MD5 4e1a09f4b9a77a679e8ef73eaa70852a
BLAKE2b-256 d26b60e1642d20acc899192bcdc906a6b75ec9ed0d52a34b833fad1a445edb31

See more details on using hashes here.

File details

Details for the file scalyca-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: scalyca-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.2 Linux/6.1.0-41-amd64

File hashes

Hashes for scalyca-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 4a7fa49ceb858e443d47b2439cff6eab9fd814c357ff34bfa8760339b5bcee28
MD5 2af01e57d796115aedf93e2bb9f96133
BLAKE2b-256 43dc6f60a9cc0e9d0a321778eac3153fbe79c5ad3671c72d0d2ca476e465da1e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page