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.6.tar.gz (19.6 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.6-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for libjam-0.1.6.tar.gz
Algorithm Hash digest
SHA256 5b507b2bb2b592bfe0a80926e58bfec614e3516bf489e88cb34d84073338feb7
MD5 2526db3e2d7aef6c8baed9b5837f06b4
BLAKE2b-256 4d8b25a3c01460c12ed27d17cfa14f8a57d89115e270e0ca46be9ce096188c70

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for libjam-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 dfe2ddef5647784553bda3de3141d3e432e1d20a9e3c0457d4f957e119a22981
MD5 cf3c17072747b76b631f9f1411167661
BLAKE2b-256 50d94af51017b9c670b84e5c27d29f4403698441083c2846d0a262d37ffa3e82

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