Simple, composable command runner for Python projects.
Project description
A simple, composable command runner for Python projects.
Goals
“makefiles, but with pyproject.toml”
—author
thx should be capable of running one or more jobs or commands, configured via simple and obvious options in the PEP 517 standardized pyproject.toml. Jobs are defined as simple strings, or lists of strings, each representing a command to be run, with basic interpolation of values.
[tool.thx]
default = ["lint", "test"]
module = "thx"
[tool.thx.jobs]
lint = [
"flake8 {module}",
"ufmt check {module}",
]
test = "python -m unittest -v {module}.tests"
With the given configuration, the following commands are possible. Note the automatic replacement of {module} with thx:
$ thx lint
> flake8 thx
> ufmt check thx
$ thx test
> python -m unittest thx.tests
Without a command, thx will run the configured list of default jobs:
$ thx
> flake8 thx
> ufmt check thx
> python -m unittest thx.tests
Terminology
command refers to an individual program executed by thx as a subprocess, including any rendered template values. An example command could include running unit tests via python -m unittest thx.
step refers to a pending command, before any template values are rendered, and includes the configuration, environment, and any other values that may affect the final program and arguments that will be executed.
job refers to a named job, consisting of one or more steps, and a list of any other jobs that must be completed before this job can begin (“requires”). These are the primary unit defined in the project’s pyproject.toml.
Install
thx is not yet ready for production use. Check the Github repo for development status.
License
thx is copyright John Reese, and licensed under the MIT license. I am providing code in this repository to you under an open source license. This is my personal repository; the license you receive to my code is from me and not from my employer. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.