A collection of command line helper scripts wrapping tools used during Python development.
Project description
🧰 Delfino 🧰
A collection of command line helper scripts wrapping tools used during Python development.
Table of content
Installation
- pip:
pip install delfino[all]
- Poetry:
poetry add -D delfino[all]
- Pipenv:
pipenv install -d delfino[all]
Optional dependencies
Each project may use different sub-set of commands. Therefore, dependencies of all commands are optional and checked only when the command is executed.
Using [all]
installs all the optional dependencies used by all the built-in commands. If you want only a sub-set of those dependencies, there are finer-grained groups available:
- For individual commands (matches the command names):
upload_to_pypi
build_docker
typecheck
format
- For groups of commands:
test
- for testing and coverage commandslint
- for all the linting commands
- For groups of groups:
verify_all
- same as[typecheck,format,test,lint]
all
- all optional packages
Configuration
Delfino will assume certain project structure. However, you can customize it to match your own by overriding the default values in the pyproject.toml
file. Here are the defaults that you can modify:
[tool.delfino]
reports_directory = "reports"
sources_directory = "src"
tests_directory = "tests"
test_types = ["unit", "integration"]
disable_commands = []
[tool.delfino.dockerhub]
username = ""
build_for_platforms = [
"linux/amd64",
"linux/arm64",
"linux/arm/v7",
]
Usage
Run delfino --help
to see all available commands and their usage.
Auto-completion
The auto-completion implementation is dynamic so that every time it is invoked, it uses the current project. Each project can have different plugins or disable certain commands it doesn't use. And dynamic auto-completion makes sure only the currently available commands will be suggested.
The downside of this approach is that evaluating what is available each time is slower than a static list of commands.
Bash
Put the following code into your ~/.bashrc
:
_complete_delfino() {
eval "$(_DELFINO_COMPLETE=bash_source delfino)";
}
complete -F _complete_delfino -o default invoke delfino
Zsh
TODO
Development
Delfino is a simple wrapper around Click. It allows you to add custom, project-specific commands. Let's call them plugins. Plugins are expected in the root of the project, in a Python package called commands
. Any sub-class of click.Command
in any .py
file in this folder will be automatically used by Delfino.
Minimal plugin
- Create the
commands
package:mkdir commands touch commands/__init__.py
- Create a file
commands/plugin_test.py
, with the following content:import click @click.command() def plugin_test(): """Tests commands placed in the `commands` folder are loaded.""" print("✨ This plugin works! ✨")
- See if Delfino loads the plugin. Open a terminal and in the root of the project, call:
delfino --help
. You should see something like this:Usage: delfino [OPTIONS] COMMAND [ARGS]... Options: --help Show this message and exit. Commands: ... plugin-test Tests commands placed in the `commands` folder... ...
- Run the plugin with
delfino plugin-test
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
File details
Details for the file delfino-0.9.0.tar.gz
.
File metadata
- Download URL: delfino-0.9.0.tar.gz
- Upload date:
- Size: 21.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.7.12 Linux/5.4.0-1060-aws
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd3169dd2e2e327e535b973f6e1770c466d8c6ea05f5b371bf47b08e7dd0ca29 |
|
MD5 | a9296db08c21f81fe6a1bbb4bf63a533 |
|
BLAKE2b-256 | 259b83ffaa21ed66d944f29790215c79ddfea09a4f778c16b2880f860be381e9 |
File details
Details for the file delfino-0.9.0-py3-none-any.whl
.
File metadata
- Download URL: delfino-0.9.0-py3-none-any.whl
- Upload date:
- Size: 22.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.7.12 Linux/5.4.0-1060-aws
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfdb9ee51e251a65006149455be7f57568f15e880023955648994e07d8d46171 |
|
MD5 | 67420e448a1ffd173d880d59fe04b55f |
|
BLAKE2b-256 | 717dfab6fdf2cd27ea74c7298b7ca0c7ab0669315047111c57063dcfcb7c503c |