Skip to main content

Library and CLI for generating installation instructions from json schema and jinja templates.

Project description

installation-instruction

Library for checking and parsing installation instruction schemas.

GitHub License Documentation Status codecov FOSSA Status

Installation

pipx

pipx install installation_instruction

pip

python -m pip install installation_instruction

installation_instruction

(Don't try at home.)

name: installation_instruction
type: object
properties:
  method:
    enum:
      - pipx
      - pip
----------------------------------
{% if method == "pip" %}
  python -m pip
{% else %}
  pipx
{% endif %}
  install installation_instruction

CLI Usage

Usage: ibi [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  show  Shows installation instructions for your specified config file...

Options are dynamically created with the schema part of the config file.

[!TIP] Show help for a config file with: ibi show CONFIG_FILE --help.

Config

The config is comprised of a single file. (Currently there is no fixed filename.) For ease of use you should use the file extension .yml.jinja and develope said config file as two seperate files at first. The config file has two parts delimited by ------ (6 or more -).
The first part is the schema (What is valid user input?). The second part is the template (What is the actual command for said user input?). The first part must be a valid JSON Schema in JSON or to JSON capabilites restricted YAML and the second part must be a valid jinja2 template. The exception to this is that anyOf and oneOf are only usable for enum like behaviour on the schema side. Instead of an enum you might want to use anyOf with const and tile properties. The title of a property is used for the pretty print name, while the description is used for the help message. There exists a jinja2 macro called raise, which is usefull if there is actually no installation instruction for said user input. All lineends in the template are removed after render, which means that commands can be splitted within the template (conda install {{ "xyz" if myvar else "abc" }} ). This also means that multiple commands need to be chained via &&. For examples please look at the examples folder.

Development installation

If you want to contribute to the development of installation_instruction, we recommend the following editable installation from this repository:

python -m pip install --editable .[tests]

Having done so, the test suite can be run using pytest:

python -m pytest

Contributors

Acknowledgments

This repository was set up using the SSC Cookiecutter for Python Packages.

License Scan

FOSSA Status

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

installation_instruction-0.1.1.tar.gz (12.3 kB view details)

Uploaded Source

File details

Details for the file installation_instruction-0.1.1.tar.gz.

File metadata

File hashes

Hashes for installation_instruction-0.1.1.tar.gz
Algorithm Hash digest
SHA256 01dd7d75af77e227ce02a2bdc0945d84b47169cc1dcc9163ba25631877b03ca4
MD5 bd0eee81fb0caef26dd106ef4fa431c1
BLAKE2b-256 44ceb8ed54a537dc71c2189e0ce77a4ad3bf64be958d079320b8bc0ca14d95aa

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