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

Uploaded Python 3

File details

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

File metadata

  • Download URL: libjam-0.1.7.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.7.tar.gz
Algorithm Hash digest
SHA256 97bca9610845967629648cb44c605aa0c8aba6d1a974c182b487adf047c844b4
MD5 f8ee2d058123a4c321f294b54e5ea66d
BLAKE2b-256 707e4c4723b60bdebbe7ef74dbfc3671875312c0c8c39b91df830171cb8ca469

See more details on using hashes here.

File details

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

File metadata

  • Download URL: libjam-0.1.7-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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 8f41b239aefdc628911554913c5e26132f6866e47f1e63ad6dd21177987ddaf4
MD5 6ba0a5594a92f9bc1a32a0529db91cff
BLAKE2b-256 55f64c56fac49f248302b249811170478f9ff75c987336bc92f50fab5844996b

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