Skip to main content

Lightweight Python task runner that just gets it

Project description

🍥️ dony

A lightweight Python command runner with simple and consistent workflow for managing project commands. A Justfile alternative.

How it works

Define your commands in dony/ in the root of your project.

# dony/commands/hello_world.py
import dony

@dony.command()
def hello_world(name: str = "John"):
    print(f"Hello, {name}!")	

Run dony to fuzzy-search your commands from anywhere in your project.

Common use cases: build, release, publish, test, deploy, configure, format, run static analyzers, manage databases, generate documentation, run benchmarks, get useful links, create release notes and much more

Defining Commands

Create commands as Python functions. All parameters MUST have defaults to allow invocation without explicit arguments. Use prompts to get inputs from the user

import dony

@dony.command()
def greet(
	greeting: str = 'Hello', 
	suffix: str = lambda: ',',
	real_greeting: str = lambda kwargs: kwargs['greeting'] + kwargs['suffix'],
	name: str = lambda: dony.input('What is your name?')
):
    dony.shell(f"echo {real_greeting}, {name}!")
  • All arguments should have to be str or List[str] for now. Support for other types may come later
  • Default values may be literals or callables:
    • Simple defaults ('Hello')
    • Lazily-evaluated callables (lambda: ... or lambda kwargs: ...)
    • Interactive prompts via dony.input, dony.select, dony.confirm, etc.
    • dony.shell(...) runs shell commands from the directory, where dony/ is located

Running commands

Run commands interactively:

dony

Run commands directly:

dony <command_name> [--arg1 value --arg2 value]

Installation

Ensure you have the following prerequisites:

  • Python 3.8 or higher
  • pipx for isolated installation (brew install pipx on macOS)
  • fzf for fuzzy command selection (brew install fzf on macOS)

Then install the package with pipx:

pipx install dony

Initialize your project:

dony --init

This creates a dony/ directory containing:

  • A commands/ directory containing a sample command
  • A uv virtual environment

Dony directory structure

dony/
... (uv environment) 
├── commands/
│   ├── my_global_command.py # one command per file
│   ├── my-service/         
│   │   ├── service_command.py  # will be displayed as `my-service/service_command`
│   │   └── _helper.py       # private module (ignored)

License

MIT License. See LICENSE for details.

Author

Mark Lidenberg marklidenberg@gmail.com

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

dony-0.1.1.tar.gz (76.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dony-0.1.1-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file dony-0.1.1.tar.gz.

File metadata

  • Download URL: dony-0.1.1.tar.gz
  • Upload date:
  • Size: 76.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for dony-0.1.1.tar.gz
Algorithm Hash digest
SHA256 47141b1ac9b33c7398f47031755339574a657d7651f20cac30ae47048f33b9f7
MD5 ec0811952cd3ad4ae7bde516ac93b165
BLAKE2b-256 37de33f0a62103268efc884cef193802459ebd85b594f13f9e8b1de59c71ce59

See more details on using hashes here.

File details

Details for the file dony-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: dony-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for dony-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c1f908c414551580856b43ef397f04a65fa4fc30f5d2ea511beb867af0083800
MD5 e166750f0ef4100f19611c9aa3e0e08f
BLAKE2b-256 b1e92d4859df06676930d6ad8ff04ccec59b9fe20295bf5774d4130bae8cf75c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page