Skip to main content

Summary

This project is a base class for running various commands in python from the command line.

see sample/toolbox_app.py for an example use.

see doc/api.md for the API available.

how to run

Don't specify a command gives you help. Note that you can use check() in toolbox_runner.py or run() in toolbox_app.py to specify a default command.

./doit 
WARN no command chosen, nothing to do
     py-runner-base: v0.1.0
     Choose one of these:
        task1               : run task1
        task2a              : run task2 step-a
        task2b              : run task2 step-b
        task3               : run task3
        task4               : run task4

Note: that there are several sorting orders available, see property sort_order in base_runner.py or cmd_map.py.

  • Add an argument arg1:
$ ./doit task1 arg1
==== doit: starting...
     running Task1 args:['arg1']
     doit: run_it rc=0
  • Run a command "task1" that has no prerequisites:
./doit task1
==== doit: starting...
     running Task1 args:[]
     doit: run_it rc=0
  • Run a command "task2b" that has a prerequisite:
./doit task2b
==== doit: starting...
     running Task2 step-a
     running Task2 step-b
     doit: run_it rc=0

how to add commands

See the sample/taskxx.py files for example tasks. Note register() functions that allow you to specify command names for any tasks you want to add.

    # --------------------
    def register(self, runner):
        self._runner = runner
        self._runner.add_cmd('task2a', self._run_step_a, 'run task2 step-a')
        self._runner.add_cmd('task2b', self._run_step_b, 'run task2 step-b', prereqs=['task2a'])

Download files

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

Source Distribution

py_runner_base-1.1.0.tar.gz (8.9 kB view details)

Uploaded Source

File details

Details for the file py_runner_base-1.1.0.tar.gz.

File metadata

  • Download URL: py_runner_base-1.1.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for py_runner_base-1.1.0.tar.gz
Algorithm Hash digest
SHA256 7b2bcaaaa226814a9eb9fbefd0d0ae6322450cd12b98b2fe622efaad2a39ca62
MD5 2835755e2b08f67362ebec5657804c75
BLAKE2b-256 e247dd7125b90126711db0eb96a9c4ba77edcc93196621d58afc1ce12aa224ca

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1.0 This release

1 file

1.0.0

1 file

0.1.0

1 file

Supported by

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