Skip to main content

edwh

PyPI - Version PyPI - Python Version


Table of Contents

Installation

pipx install edwh
# or: uvenv install edwh

# or with all plugins:
pipx install[plugins]
# or with specific plugins: 
pipx install[multipass,restic]

# managing plugins later:
edwh plugins
edwh plugin.add multipass
edwh plugin.remove multipass

Usage

# to see all available commands:
ew # or `edwh`
# to see help about a specific namespace:
ew help <namespace> # e.g. `ew help plugin`
# to see help about a specific command:
ew help <command> # e.g. `ew help plugin.list` 

Sudo authentication

edwh sudo verifies your sudo password and safely stores it temporarily so commands that require sudo can run without prompting again.

By default, EDWH uses the operating system keyring (for example, GNOME Secret Service on Linux). This is the preferred backend when the desktop session and its keyring are available.

When the system keyring is locked, edwh sudo offers an SSH-agent fallback. If you accept, EDWH lists the public keys available through ssh-add -L; select the key whose agent should unlock the encrypted EDWH keyring. The selection is recorded in ~/.config/ssh-agent-keyring/config.json, the SSH-agent backend's documented configuration file, and later EDWH commands automatically use that backend.

The SSH-agent backend requires a reachable agent, SSH_AUTH_SOCK, and the selected key loaded in that agent. For a remote development machine, connect with agent forwarding (ssh -A or ForwardAgent yes). The sudo password remains encrypted on disk; access depends on the selected SSH agent rather than a second keyring password.

Linting

edwh lint runs Ruff and Ty by default. Disable either tool for a specific project in its pyproject.toml:

[tool.edwh.lint]
ruff = false
ty = false

edwh fmt sorts imports and reformats Python code with Ruff.

Releasing plugins

edwh plugin.release warns when a project still uses Hatchling or when its --hatch build fallback is selected. It also warns when a project's uv_build requirement no longer matches edwh's current recommendation. Silence any of these warnings for a project:

[tool.edwh.release]
warn-hatchling = false
warn-hatch-build = false
warn-uv-build = false

Testing

edwh test.run runs pytest with coverage by default. It prefers ./venv/bin/pytest, falls back to pytest from PATH, and requires pytest-cov in the selected environment.

edwh test.run
edwh test.run -k test_specific_behavior
edwh test.run --html
edwh test.run --no-coverage

If a project provides its own test.tasks.py, edwh warns about the override and that local test.run replaces the built-in task.

Task Load Order

Commands are loaded in the following order:

  1. EDWH Package:

    • Loaded into the global namespace and its own namespaces (like ew plugins.).
  2. Plugins:

    • Loaded into their own namespaces (like ew mp.).
  3. Current Directory:

    • Loaded into the local. namespace. If it doesn't exist, it traverses up the directory tree
    • (e.g., ../tasks.py, ../../tasks.py).
  4. Other Local Tasks:

    • Other local tasks with their own namespace are loaded (e.g., namespace.tasks.py) and can be invoked with edwh namespace.command.
  5. Personal Global Tasks:

    • Personal global tasks (e.g., ~/.config/edwh/tasks.py) are also loaded into the global namespace, useful for shortcuts, custom aliases, etc. (+ add_alias).
  6. Personal Namespaced Tasks:

    • Personal tasks with their own namespace (e.g., ~/.config/edwh/namespace.tasks.py). Similar to a plugin, but for personal use.

Plugins

Multipass

Restic

Pip Compile

Bundler

Server Provisioning

b2

Locust

sshkey

sshfs

files

whitelabel

devdb

Improvements to @task

The edwh.improved_task decorator enhances the functionality of the standard @task decorator from Invoke by introducing additional features:

  • Flags: You can now specify custom flags for command line arguments. This allows you to define aliases, rename arguments (e.g., using --json for an argument named as_json), and create custom short flags (e.g., --exclude can also be represented as -x).

  • Hookable: The improved task supports hooks that allow you to run additional tasks after the main task execution. If the hookable option is set to True, any tasks found across namespaces with the same name will be executed in sequence, passing along the context and any provided arguments.

The return value of a hookable task will be available in the context under the key result. Using a dictionary as the return value is recommended, as it allows you to merge the results of multiple cascading tasks.

Example Usage

from edwh import improved_task as task


@task(flags={"exclude": ["--exclude", "-x"], "as_json": ["--json"]}, hookable=True)
def process_data(ctx, exclude: str, as_json: bool = False):
    # Task implementation here
    return {
        "data": [],
    }


# other plugin (or local tasks.py) can now also specify 'process_data':
@task()
def process_data(ctx, exclude: str):
    # the cascading function can choose whether to include the arguments `exclude` and `as_json` or not.
    # this can be cherry-picked as long as the names match the arguments of the main function.
    print(
        ctx["result"]  # will contain {"data": []}
    )

License

edwh is distributed under the terms of the MIT license.

Changelog

See CHANGELOG.md

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

edwh-1.14.2.tar.gz (63.6 kB view details)

Uploaded Source

Built Distribution

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

edwh-1.14.2-py3-none-any.whl (66.8 kB view details)

Uploaded Python 3

File details

Details for the file edwh-1.14.2.tar.gz.

File metadata

  • Download URL: edwh-1.14.2.tar.gz
  • Upload date:
  • Size: 63.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.4 {"installer":{"name":"uv","version":"0.12.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for edwh-1.14.2.tar.gz
Algorithm Hash digest
SHA256 67a91413a2f402a9b4f7e9be90bdd90488c49507a7aaa5f8bbcccbd6ff77e51e
MD5 b579adef4fd6d7a8d8b8d41f4fca2a04
BLAKE2b-256 80bc7e80292e5a2767b7bbabae547819fdeca245d9eb4ec05fddfc2955960f48

See more details on using hashes here.

File details

Details for the file edwh-1.14.2-py3-none-any.whl.

File metadata

  • Download URL: edwh-1.14.2-py3-none-any.whl
  • Upload date:
  • Size: 66.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.4 {"installer":{"name":"uv","version":"0.12.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for edwh-1.14.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ec2467fefbda786f183656f819c539260b90c371b8cc259dea24b84c7b5e57fd
MD5 d66273ab5a29fbf61b6c5827c8497648
BLAKE2b-256 d7effcfbf0a6e6dc5ba0b8e1165f5b39f142d7d0585ac56f639afed680406015

See more details on using hashes here.

Release history Release notifications | RSS feed

Supported by

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