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

Modules

libjam consists of of 6 modules:

Captain

responsible for handling command-line arguments

Drawer

responsible for file operations

Typewriter

responsible for transforming and printing text

Clipboard

responsible for working with lists

Notebook

responsible for configuration

Flashcard

responsible for getting user input from the command line

Example project

#! /usr/bin/python

# Imports
import sys
from libjam import Captain

captain = Captain()

class CLI:
  def hello(self, text):
    print(text)
    if options.get('world').get('enabled'):
      print('world!')

cli = CLI()

# Inputs/Commands/Options configuration
app = "example"
description = "An example app for the libjam library"
# help = "" # If you wish to set your own help page text
commands = {
  'print':     {'function': cli.hello,
  'description': 'Prints given string'},
}
options = {
 'world': {'long': ['world'], 'short': ['w'],
 'description': 'Appends \'world\' after printing given input'},
}

# Getting program arguments
arguments = sys.argv
# Removing script name from arguments
arguments.remove(arguments[0])
# Generating help
help = captain.generate_help(app, description, commands, options)
# Interpreting user input
interpretation = captain.interpret(app, help, commands, arguments, options)
# Getting parsed output
function = interpretation.get('function')
options = interpretation.get('options')
# Executing function
exec(f"cli.{function}")

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.0.7.tar.gz (15.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.0.7-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for libjam-0.0.7.tar.gz
Algorithm Hash digest
SHA256 9d609f087c1cbf2937885944253618aa95ce1bbef9ab9b1e77d4f1b78fb9c845
MD5 c7c80050042c0eec724182603eb0f83e
BLAKE2b-256 665a1d4652eb2326e32bb5c3dcbd8fa49c9c4043447faa5af49f71069895a6b7

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for libjam-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 8ab01c49e86f41b8a9748bd18efd463aa1a9f8d833699224c9b963a1d078cd70
MD5 ede744c60c22f83e60e8feafe7ff52ec
BLAKE2b-256 a3514440482c1a5f01f2a7b458b241caf99cda9a7a945c14459d723315b4412d

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