Skip to main content

Python Development CLI

Project description

PIB CLI

A development environment CLI, complete with tooling.

Project Documentation

Master Branch

pib_cli-automation

Production Branch

pib_cli-automation

Supported Python Versions

Tested to work under the following python version:

  • Python 3.7
  • Python 3.8
  • Python 3.9

Installation

This is a development environment CLI, with a customizable yaml config.

It's built into this Cookie Cutter template:

To install, simply use:

  • pip install pib_cli
  • pip install pib_cli[docs] (Adds Sphinx support.)
  • pip install pib_cli[types] (Adds MyPy support.)

Usage

  • use the dev command for details once installed

Container

python:3.7-slim

License

MPL-2

Included Packages

After using pib_cli on a number of projects I realized there is not a one size fits all solution.

  • Some projects require extensive documentation, some projects require typing, some do not.
  • At the suggestion of a friend, I've grouped the installable packages into "extras", that you can choose to install alongside the core pib_cli install.

Core Installed Packages:

package Description
bandit Finds common security issues
commitizen Standardizes commit messages
isort Sorts imports
poetry Python Package Manager
pydocstyle PEP 257 enforcement
pylint Static Code Analysis
pytest Test suite
pytest-cov Coverage support for pytest
safety Dependency vulnerability scanning
wheel Package distribution tools
yamllint Lint yaml configuration files
yapf Customizable Code Formatting
  • poetry install to install only these dependencies.
  • This is the base install, and you'll always get these dependencies installed.

'types' extras:

package Description
mypy Static type checker
  • poetry install -E types to add these dependencies to the core installation.

'docs' extras:

package Description
sphinx Generating documentation
sphinx-autopackagesummary Template nested module content
  • poetry install -E docs to add these dependencies to the core installation.

'pib_docs' extras:

package Description
sphinx Generating documentation
sphinx-autopackagesummary Template nested module content
sphinx-click Generate cli documentation
sphinx-jsonschema Generate schema documentation
  • poetry install -E pib_docs to add these dependencies to the core installation.
  • These extras exist only to support building pib_cli's documentation- they aren't meant to be consumed by user projects.

Installing Multiple Extras:

This is straight-forward to do:

  • poetry install -E docs -E types

Customizing the Command Line Interface

The CLI has some defaults built in, but is customizable by setting the PIB_CONFIG_FILE_LOCATION environment variable. The default config file can be found here.

Each command is described by a yaml key in this format :

- name: "command-name"
  path_method: "location_string"
  commands:
    - "one or more"
    - "shell commands"
    - "each run in a discrete environment"
  success: "Success Message"
  failure: "Failure Message"

where location_string is one of:

  • project_root (/app)
  • project_docs (/app/documentation)
  • project_home (/app/${PROJECT_HOME})

Installing a virtual environment, and the CLI on your host machine

The scripts/extras.sh script does this for you.

First install poetry on your host machine:

  • pip install poetry

Then source this script, setup the extras, and you can use the dev command on your host:

  • source scripts/extras.sh
  • pib_setup_hostmachine (to install the poetry dependencies)
  • dev --help (to run the cli outside the container)

This is most useful for making an IDE like pycharm aware of what's installed in your project.

It is still recommended to work inside the container, as you'll have access to the full managed python environment, as well as any additional services you are running in containers.

If you wish to use the cli outside the container for all tasks, tomll and gitleaks will also need to be installed, or the cli.yml configuration will need to be customized to remove these commands.

Development Guide for pib_cli

Please see the documentation here.

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

pib_cli-0.1.3.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

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

pib_cli-0.1.3-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file pib_cli-0.1.3.tar.gz.

File metadata

  • Download URL: pib_cli-0.1.3.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.7.10 Linux/5.8.0-1033-azure

File hashes

Hashes for pib_cli-0.1.3.tar.gz
Algorithm Hash digest
SHA256 20d5cf485cdf75a1ad240101ec4c1846668d219a5d4ddc3760980ee487e2b67d
MD5 ae071578259430c79e9944a926d26343
BLAKE2b-256 164e891393f3ee59a892381bc44d9528febf9a9f41d9312206a82432b6b5cf19

See more details on using hashes here.

File details

Details for the file pib_cli-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: pib_cli-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.7.10 Linux/5.8.0-1033-azure

File hashes

Hashes for pib_cli-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8ab0be5f3e5c20f877ed20801864a78505537c095bd5b1af4b561c906278473a
MD5 dcd1c205a71e5455c40b8153a3795be1
BLAKE2b-256 a1bf3556ac69a3c184befbb85dd2cb838fdc69e336bbe9183e87ccd2de387ccf

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