Skip to main content

A library jam for Python.

Project description

libjam

A library jam for Python.

Installing

libjam is available on PyPI, and can be installed using pip.

pip install libjam

To install the latest bleeding edge:

pip install git+https://github.com/philippkosarev/libjam.git

Modules

Captain

Makes creating command line interfaces easy.

Drawer

Responsible for file operations. Accepts the '/' as the file separator, regardless the OS.

Typewriter

Transforms text and prints to the terminal.

Clipboard

Provides some useful and commonly used list operations.

Notebook

Simplifies and standardises reading and writing configuration files.

Flashcard

Useful for getting user input from the command line.

Example CLI project

example.py:

# Imports
from libjam import captain

# Defining function
def my_print(args: list, options: dict):
  text = ' '.join(args)
  if options.get('world'):
    text += ' world!'
  print(text)

# Setting commands and options
description = 'An example CLI for the libjam library'
commands = {
  'print': {
    'function': my_print,
    'description': 'Prints the given input',
    'arguments': ['*text'],
  },
}
options = {
  'world': {
    'long': ['world'], 'short': ['w'],
    'description': "Appends ' world!' to the end of the string",
  },
}

# Running
function, arguments, options = captain.sail(description, commands, options)
function(arguments, options)

Output:

$ ./example.py
No command specified.
Try 'example.py --help' for more information.
$ ./example.py print Hello
Hello
$ ./example.py print Hello --world
Hello world!
$ ./example.py help
Synopsis:
  example.py [OPTIONS] [COMMAND]
Description:
  An example CLI for the libjam library.
Commands:
  print - Prints the given input.
Options:
  -w, --world - Appends ' world!' to the end of the string.
  -h, --help  - Prints help.

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

libjam-0.1.5.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

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

libjam-0.1.5-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file libjam-0.1.5.tar.gz.

File metadata

  • Download URL: libjam-0.1.5.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for libjam-0.1.5.tar.gz
Algorithm Hash digest
SHA256 08079b6c243131f0bc5d31eb7eb3aad2b31be74cf58c2ef4159aa024fb20f466
MD5 36a1df97cc6ece2a20e1ab0dc3abdc9f
BLAKE2b-256 9744d4c875c402b456b7de3141d579d1e3c4023c25d8f620236d49f69701ed64

See more details on using hashes here.

File details

Details for the file libjam-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: libjam-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for libjam-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9b787d0f3c1d578b54c91799bec3950dae4ad662ed287a42ee5ee619f97a7f57
MD5 5b56230ff6fe59d3e5f56d6d1f6c2a4d
BLAKE2b-256 a1dad0e9b7b2b229d6b2f37e0cf7e8f5da9e55917f609a6ad4d93da36c22a0aa

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