Skip to main content

pyauto

A task running tool

What is this?

PyAuto provides a minimalist project structure for capturing configuration and orchestrating tasks.

What is a Task?

A python function.

# deployment_tasks.py

# this needs to be imported so that the config class will be registered
import deployment_config


def deploy_app(config, app_name):
    # implement deployment here
    print('deploying {0}...'.format(app_name))
    app = config.apps.get_tag(app_name)
    print(app)

How is it configured?

YAML + Python Class.

# config.yml
task_modules:
- deployment_tasks
apps:
- id: my_app
  name: My Application
  source_dir: ./my_app
tasks:
  deploy_my_app:
  - deploy_app,my_app
# deployment_config.py

from pyauto import config
import os


class App(config.Config):
    def get_source_dir(self):
        return os.path.abspath(self.source_dir)


config.set_config_class('apps', App.wrap)

How is it used?

As a CLI tool.

Run the task

$ python -m pyauto.deploy -c config.yml deploy,my_app

Outputs

----- deployment_tasks.deploy_app ( my_app  ) -----
deploying my_app...
OrderedDict([('id', 'my_app'), ('name', 'My Application'), ('source_dir', './my_app')])
deploy_app,my_app = None

The “,” separates the function from the string arguments. All task functions must accept string only arguments.

Run a sequence of tasks

$ python -m pyauto.deploy -c config.yml deploy_my_app

Outputs

----- deployment_tasks.deploy_app ( my_app  ) -----
deploying my_app...
OrderedDict([('id', 'my_app'), ('name', 'My Application'), ('source_dir', './my_app')])
deploy_app,my_app = None

Line 1 of the output indicates the function invoked, with the arguments passed to it. Lines 2-3 of the output indicate the standard output of the function’s execution Last line of the output indicates 1) the original function invocation string and 2) the return value of the function.

If you wish to suppress output of line 1 and last line, you can pass the -q option to have PyAuto omit those lines.

The task sequence deploy_my_app is looked up from the tasks section of the config. A task sequence may list as many tasks or task sequences as desired. Every item will always be executed when the task sequence is invoked.

Dry-run a sequence of tasks

$ python -m pyauto.deploy -c config.yml deploy_my_app -i

Outputs

deploy_my_app (  )
    deployment_tasks.deploy_app ( my_app )

This shows the sequence of tasks that will be run. This is a trivial example, but you may also invoke other task sequences from a task sequence, which can lead to a complex order of tasks. This feature allows you to inspect what a given task sequence will execute before you execute it.

Metadata

Release files for pyauto.core 0.2.0

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

Source distribution (sdist)

Source distribution for pyauto.core 0.2.0
File Size Uploaded Provenance
pyauto.core-0.2.0.tar.gz 20.8 kB Without provenance Details

Release files / pyauto.core-0.2.0.tar.gz

Download URL pyauto.core-0.2.0.tar.gz
Size 20.8 kB
Tags Source
SHA-256 checksum
How to use checksums
15865dcd06fd62fcc451ae2e7c57525047859a994c7bf4bf4927923ac134e259
BLAKE2b-256 checksum
How to use checksums
20db6ed9c4106c34f482f8f6a3428e2da877a125bd4782e8baa8b5f0c76448ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pyauto.core 0.2.0

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file No provenance

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