Skip to main content

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.

CircleCI Codecov GitHub tag (latest SemVer) Maintenance GitHub last commit

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 top-level parameters:
    • completion - for --show-completion and --install-completion
  • For individual commands (matches the command names):
    • upload_to_pypi
    • build_docker
    • typecheck
    • format
  • For groups of commands:
    • test - for testing and coverage commands
    • lint - 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 = []
verify_commands = ["format", "lint", "typecheck", "test-all"]
disable_pre_commit = false


[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

You can either attempt to install completions automatically with:

delfino --install-completion

or generate it with:

delfino --show-completion

and manually put it in the relevant RC file.

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.

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

  1. Create the commands package:
    mkdir commands
    touch commands/__init__.py
    
  2. 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! ✨")
    
  3. 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...
      ...
    
  4. Run the plugin with delfino plugin-test

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

delfino-0.17.1.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

delfino-0.17.1-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

Details for the file delfino-0.17.1.tar.gz.

File metadata

  • Download URL: delfino-0.17.1.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.7.12 Linux/5.13.0-1023-aws

File hashes

Hashes for delfino-0.17.1.tar.gz
Algorithm Hash digest
SHA256 cb1de30db14622e676abc41599f8591e283f0591a9f2266efc2b2e44043656a2
MD5 31ccc8806ecdc06b83fa8d544475385b
BLAKE2b-256 7672ebff71babc6bb649cfa94dd9f833fe29d8f6c88ba854bba0853c9bb481ae

See more details on using hashes here.

File details

Details for the file delfino-0.17.1-py3-none-any.whl.

File metadata

  • Download URL: delfino-0.17.1-py3-none-any.whl
  • Upload date:
  • Size: 26.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.7.12 Linux/5.13.0-1023-aws

File hashes

Hashes for delfino-0.17.1-py3-none-any.whl
Algorithm Hash digest
SHA256 54d55bb8910e1ca7efae34d39a59d9aca5b5da6982efe185507a6cf5cbf9c875
MD5 95f54466e6e17a651c9cf75d6857102e
BLAKE2b-256 d67e900c215d16a1f8965c4480446ccbdbd419a0a8b3c72a40d4e94fbd8d3a6c

See more details on using hashes here.

Supported by

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