Education Warehouse maintenance tools
Project description
edwh
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`
Task Load Order
Commands are loaded in the following order:
-
EDWH Package:
- Loaded into the global namespace and its own namespaces (like
ew plugins.).
- Loaded into the global namespace and its own namespaces (like
-
Plugins:
- Loaded into their own namespaces (like
ew mp.).
- Loaded into their own namespaces (like
-
Current Directory:
- Loaded into the
local.namespace. If it doesn't exist, it traverses up the directory tree - (e.g.,
../tasks.py,../../tasks.py).
- Loaded into the
-
Other Local Tasks:
- Other local tasks with their own namespace are loaded (e.g.,
namespace.tasks.py) and can be invoked withedwh namespace.command.
- Other local tasks with their own namespace are loaded (e.g.,
-
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).
- Personal global tasks (e.g.,
-
Personal Namespaced Tasks:
- Personal tasks with their own namespace (e.g.,
~/.config/edwh/namespace.tasks.py). Similar to a plugin, but for personal use.
- Personal tasks with their own namespace (e.g.,
Plugins
Multipass
- pip name:
edwh-multipass-plugin - github:
educationwarehouse/edwh-multipass-plugin - plugin name:
edwh[multipass] - subcommand namespace:
mp
Restic
- pip name:
edwh-restic-plugin - github:
educationwarehouse/edwh-restic-plugin - plugin name:
edwh[restic] - subcommand namespace:
restic
Pip Compile
- pip name:
edwh-pipcompile-plugin - github:
educationwarehouse/edwh-pipcompile-plugin - plugin name:
edwh[pip] - subcommand namespace:
pip
Bundler
- pip name:
edwh-bundler-plugin - github:
educationwarehouse/edwh-bundler-plugin - plugin name:
edwh[bundler] - subcommand namespace:
bundle
Server Provisioning
- pip name:
edwh-server-provisioning-plugin - github:
educationwarehouse/server_provisioning - plugin name:
edwh[server-provisioning] - subcommand namespace:
remote
b2
- pip name:
edwh-b2-plugin - github:
educationwarehouse/edwh-b2-plugin - plugin name:
edwh[b2] - subcommand namespace:
b2
Locust
- pip name:
edwh-locust-plugin - github:
educationwarehouse/edwh-locust-plugin - plugin name:
edwh[locust] - subcommand namespace:
locust
sshkey
- pip name:
edwh-sshkey-plugin - github:
educationwarehouse/edwh-sshkey-plugin - plugin name
edwh[sshkey] - subcommand namespace
sshkey
sshfs
- pip name:
edwh-sshfs-plugin - github:
educationwarehouse/edwh-sshfs-plugin - plugin name
edwh[sshfs] - subcommand namespace
sshfs
files
- pip name:
edwh-files-plugin - github:
educationwarehouse/edwh-files-plugin - plugin name
edwh[files] - subcommand namespace
file
whitelabel
- pip name:
edwh-whitelabel-plugin - github:
educationwarehouse/edwh-whitelabel-plugin - plugin name
edwh[whitelabel] - subcommand namespace
wl
devdb
- pip name:
edwh-devdb-plugin - github:
educationwarehouse/edwh-devdb-plugin - plugin name
edwh[devdb] - subcommand namespace
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
--jsonfor an argument namedas_json), and create custom short flags (e.g.,--excludecan 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
hookableoption is set toTrue, 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
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 edwh-1.8.0.tar.gz.
File metadata
- Download URL: edwh-1.8.0.tar.gz
- Upload date:
- Size: 79.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89a0485268f4ca591f93392d5a630f2c8bde64d1b4e32c8908c898d6ab403453
|
|
| MD5 |
0eacaf180500be17ad8b80ccffea48fc
|
|
| BLAKE2b-256 |
a788ba349882f742f1fdb66eb9dba4d2a413429d330a8e3484f908606eb71242
|
File details
Details for the file edwh-1.8.0-py3-none-any.whl.
File metadata
- Download URL: edwh-1.8.0-py3-none-any.whl
- Upload date:
- Size: 53.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00d2431802aa0b9159b453c23a82a5f6e4c2435c93080c3c9d4b2b85f4bfb369
|
|
| MD5 |
598ebee3c81d20765924a119a84bdbd3
|
|
| BLAKE2b-256 |
c6940e6dbc24e8cdcb65374d90c0f46882cf7110ea653b922316051ba4d24ed5
|