A modern Python task automation and multi-repository orchestration tool
Project description
Job Runner
Multi-repository task automation with intelligent dependency management.
Features
- Dependency Resolution: Automatically handles job dependencies with circular dependency protection
- Template System: Reusable job templates with inheritance
- Git Integration: Clone and manage multiple repositories
- Task-Level Execution: Run specific tasks within jobs
- Dependency Graphs: Visualize job dependencies with Mermaid
- Conditional Configuration: Use
whenclauses for dynamic configs - Environment Management: Isolated environment variables per job
Installation
pip install job-runner
For development:
pip install job-runner[dev]
Quick Start
1. Create a jobs.yml file:
variables:
build_dir: /tmp/builds
user: ${USER}
jobs:
build-frontend:
type: build
description: Build the frontend application
repo:
server: https://github.com/
group: myorg/
name: frontend
directory: ${build_dir}
script:
- npm install
- npm run build
build-backend:
type: build
description: Build the backend service
repo:
server: https://github.com/
group: myorg/
name: backend
directory: ${build_dir}
script:
- go mod download
- go build -o server
deploy:
type: run
description: Deploy all services
dependencies:
- build-frontend
- build-backend
script:
- echo "Deploying services..."
- ./deploy.sh
2. Run a job:
# Run a job with all its dependencies
job-runner run deploy
# Run a specific task within a job
job-runner run build-frontend test
# Run multiple tasks in sequence
job-runner run build-frontend clean,default,test
# Use "default" to refer to the main script
job-runner run build-frontend default # Same as: job-runner run build-frontend
# Limit dependency depth
job-runner run deploy --depth 1
# Fetch (clone) a repository without running scripts
job-runner fetch build-frontend
# Run all jobs (or filtered subset)
job-runner run-all # Run all jobs
job-runner run-all --type build # Run all build jobs only
job-runner run-all --pattern "lib*" # Run jobs matching pattern
job-runner run-all -t build -p "amx*" # Combine filters
job-runner run-all --dry-run # Preview without executing
3. List available jobs:
job-runner list
4. Visualize dependencies:
job-runner graph deploy
Configuration
Job Types
- build: Clone a repository and run build scripts
- run: Execute scripts in a specified directory
Templates
Create reusable job configurations:
templates:
python-build:
type: build
script:
- python -m pip install -r requirements.txt
- python -m pytest
- python -m build
jobs:
my-python-app:
template: python-build
repo:
server: https://github.com/
group: myorg/
name: my-app
Conditional Configuration
Use when clauses for dynamic configurations:
jobs:
deploy:
type: run
script:
- echo "Base script"
when:
- condition: "variables.get('ENVIRONMENT') == 'production'"
data:
script:
- echo "Production deployment"
- ./deploy-prod.sh
Tasks
Define multiple tasks within a job:
jobs:
myapp:
type: build
repo:
server: https://github.com/
group: myorg/
name: app
script:
- make build
tasks:
test:
script:
- make test
clean:
script:
- make clean
deploy:
dependencies:
- myapp:test
script:
- make deploy
Run specific tasks:
# Run a single task
job-runner run myapp test
# Run multiple tasks in sequence
job-runner run myapp clean,default,test
# The "default" task refers to the job's main script
job-runner run myapp default # Runs: make build
job-runner run myapp clean,default # Runs: make clean, then make build
# Run tasks with dependencies
job-runner run myapp deploy # Runs test first, then deploy
CLI Commands
| Command | Description |
|---|---|
job-runner list |
List all available jobs |
job-runner run JOB [TASKS] |
Run a job or specific tasks (comma-separated) |
job-runner run-all [OPTIONS] |
Run all jobs or filtered subset (see options below) |
job-runner fetch JOB |
Clone repository for build job without running scripts |
job-runner info JOB [FIELD] |
Show job information |
job-runner validate |
Validate configuration |
job-runner dump JOB |
Export job definition |
job-runner graph JOB |
Generate dependency graph |
run-all Options
| Option | Description |
|---|---|
--type, -t |
Filter by job type: build or run |
--pattern, -p |
Filter by name pattern (wildcards: *, ?) |
--depth |
Maximum dependency depth |
--dry-run |
Preview execution without running |
Advanced Features
Environment Variables
jobs:
myapp:
type: run
env:
NODE_ENV: production
DEBUG: "false"
script:
- npm start
Variable Substitution
variables:
version: "1.0.0"
output: /tmp/builds
jobs:
build:
script:
- echo "Building version {version}"
- cp output {output}/app-{version}
Multiple Configuration Files
Organize jobs across multiple files:
# jobs.yml
jobs-dir: ./jobs
# jobs/frontend.yml
jobs:
frontend:
type: build
# ...
# jobs/backend.yml
jobs:
backend:
type: build
# ...
Development
# Clone the repository
git clone https://gitlab.com/proj_amx_01/tools/job-runner.git
cd job-runner
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest
# Format code
black deprun tests
# Lint
ruff check deprun tests
# Type check
mypy deprun
# Build wheel package
python -m build
# Or use the Makefile
make build
# Clean build artifacts
make clean
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
License
MIT License - see LICENSE file for details.
Credits
Created by Peter De Herdt
Support
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
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 deprun-0.2.0.tar.gz.
File metadata
- Download URL: deprun-0.2.0.tar.gz
- Upload date:
- Size: 23.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94cfa4f712e8bff7712e54056f9c46f8aac9ff495f470f25f6e4459f76cf4c3c
|
|
| MD5 |
31cda974c3eba79a06d2ff8586cea885
|
|
| BLAKE2b-256 |
a90dbf6aca80f685ace4e4e8a8bda12571c36095478b440d73589032b63308aa
|
File details
Details for the file deprun-0.2.0-py3-none-any.whl.
File metadata
- Download URL: deprun-0.2.0-py3-none-any.whl
- Upload date:
- Size: 24.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7558290524ed937c2ef81068ec51e1b97c78bc624fdfcf7a7ca1e02e0f205b4e
|
|
| MD5 |
d62eb1c71e15482858ccc40ba9198766
|
|
| BLAKE2b-256 |
695bcfea935f5fda0f79eec2117809e4f2924ab4b133e28029b2965e9b7777d7
|