pythonic task runner.
Project description
taskcond
taskcond is a Pythonic task runner that executes tasks based on dependencies and file modification times, similar to make.
Features
- Pythonic Task Definition: Define tasks as Python functions or shell commands in a
TaskFile.py. - Dependency Management: Specify dependencies between tasks to ensure they run in the correct order.
- Incremental Builds: Tasks are skipped if their output files are newer than their input files, saving execution time.
- Parallel Execution: Run independent tasks concurrently using threads or processes to speed up workflows.
- Command-Line Interface: A simple and intuitive CLI powered by
clickfor running and listing tasks. - Flexible Configuration: Configure default behaviors in your
pyproject.tomlfile. - Cycle Detection: Automatically detects and reports cyclic dependencies in your task graph.
- Hidden Tasks: Tasks can be hidden from the
listcommand by settingdisplayed=False, allowing for internal or helper tasks that don't clutter the task list.
Quick Start
-
Installation
pip install taskcond
-
Create a
TaskFile.pyCreate a file namedTaskFile.pyin your project root and define your tasks.from pathlib import Path from taskcond import Task, register # Define a task that creates a file register( Task( name="create_file", description="Create an output file.", shell_command="echo 'Hello, taskcond!' > output.txt", output_files=(Path("output.txt"),), ) ) # Define a task that depends on the first one register( Task( name="process_file", description="Process the created file.", shell_command="cat output.txt", depends=("create_file",), input_files=(Path("output.txt"),), ) )
-
Run Tasks Use the
taskcondCLI to run your tasks.# List available tasks taskcond list # Run a specific task and its dependencies taskcond run process_file # Run a task with arguments taskcond run "test --verbose"
The
process_filetask will only run ifoutput.txthas been modified or is missing.
Configuration
You can configure taskcond by adding a [tool.taskcond] section to your pyproject.toml:
[tool.taskcond]
taskfile = "TaskFile.py" # Path to the task definition file
force = false # Force execution of all tasks
n_jobs = 1 # Number of parallel jobs (-1 for all cores)
use_processes = false # Use ProcessPoolExecutor instead of ThreadPoolExecutor
visible_progressbar = true # Show a progress bar during execution
CLI options will always override the settings in pyproject.toml.
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.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file taskcond-0.2.0.tar.gz.
File metadata
- Download URL: taskcond-0.2.0.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07fc9e18bb288ec0c464bf402cecb4cc2cbd0480be4cc6e37ce63f95814fbd4e
|
|
| MD5 |
706ae0ab3055983ed293f33c34cb838d
|
|
| BLAKE2b-256 |
7e4199c8a461379ac2c40f56547262dce18be81b3c791731e4e3300b14fb7bbe
|
File details
Details for the file taskcond-0.2.0-py3-none-any.whl.
File metadata
- Download URL: taskcond-0.2.0-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e9aeab562e8d6b681be095edf987f632eb29bbc1c766a775f586eb84d5113c6
|
|
| MD5 |
ca073e9d5b0753e9e04ac13fbbb211f3
|
|
| BLAKE2b-256 |
5c6e25df5ea31a885a659ec709c9c646b36475955db20b1f5fc9f3bee1917165
|