CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-invoke

Pythonic task execution library for managing shell-oriented subprocesses and organizing executable Python code into CLI-invokable tasks

Overall
score

96%

Overview
Eval results
Files

task.mdevals/scenario-1/

Configuration-Based Task Manager

Build a simple task automation script that uses configuration files to manage application settings.

Requirements

Create a Python script that defines tasks for managing application settings. The tool should:

  1. Load configuration from YAML files
  2. Allow configuration file overrides via command-line flag
  3. Access configuration values within tasks using both dictionary and attribute notation
  4. Display configuration values when tasks are executed

Configuration Files

Your solution should work with the following configuration files:

invoke.yaml (default configuration):

app:
  name: myapp
  port: 8000
  debug: true
deploy:
  timeout: 30
  backup: true

production.yaml (production overrides):

app:
  port: 80
  debug: false
deploy:
  timeout: 60

Tasks to Implement

Implement the following tasks in a file named tasks.py:

  1. show-config - Display the app name, port, and debug settings from configuration
  2. deploy - Print deployment message using the app name and port from configuration

Test Cases

  • Running show-config displays default values: name "myapp", port 8000, debug true @test
  • Running deploy with default config shows message with port 8000 @test
  • Running show-config with --config production.yaml shows port 80 and debug false @test
  • Configuration can be accessed using c.config.app.port attribute notation @test

Implementation

@generates

API

from invoke import task

@task
def show_config(c):
    """Display current application configuration."""
    pass

@task
def deploy(c):
    """Print deployment message using configuration."""
    pass

Dependencies { .dependencies }

invoke { .dependency }

Provides task execution and configuration management capabilities.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/pypi-invoke

tile.json