Skip to main content

FlameWok

Very tiny framework to quickly create python terminal apps.

The purpose of this package is to get you rid as much as possible of the tedious part of creating menus, forms, and CLI, and to help to keep the code clean.

Installation

pip install flamewok

Create forms

from flamewok import Form

my_form = Form([
    ("name", "what is your name ?"),
    ("age", "how old are you ?"),
    ])

response = my_form.ask()

Create menus

from flamewok import Menu

menu = Menu()

def hello():
    print("Hi there ! here is the callback hello !")
    menu.ask()

def how():
    print("I'm quite fine, thank you :)")
    menu.ask()

def exit():
    print("Good Bye folks !")
    quit()

menu.add_boxes([
    "\nChoose an option:\n",
    (1, "hello !", hello),
    (2, "how are you ?", how),
    ("x", "exit", exit),
])

menu.ask()

yes, that simple !

Create very quickly a CLI

from flamewok.cli import cli


def main():
    print("main program lanched")


def see(*args):
    """the types are defined in the cli.route"""
    for arg in args:
        print(type(arg), arg)

def multi(*args):
    """the types are not defined in the cli.route, so the args are all str"""
    numbers = [float(arg) for arg in args]
    result = 1
    for num in numbers:
        result *= num
    print(result)


if __name__ == "__main__":
    cli.route(
        "This is a CLI test\n", # this will appear in the help
        ("", main, "Launches the main programm"),
        ("-h", cli.help, "displays this help"),
        ("--help", cli.help, 'Idem'),
        ("see <int:a> <bool:> <str:> <float:>", see, "Show the arguments given in the CLI"),
        ("multi <some_numbers>", multi, "multiply the numbers"),
    )

Fancy titles

from flamewok import big_text
from flamewok import color as c

print(big_text(
        "Example", on="@", off=".", spacing=2, underline=True, color=c.success))

# Output (the color can only be seen in a real terminal):
@@@@@...............................@@...........
@....................................@...........
@......@...@...@@@...@@.@...@@@@.....@.....@@@...
@@@@....@.@.......@..@.@.@..@...@....@....@...@..
@........@.....@@@@..@.@.@..@...@....@....@@@@@..
@.......@.@...@...@..@.@.@..@@@@.....@....@......
@@@@@..@...@...@@@@..@.@.@..@.......@@@....@@@...
.................................................
.................................................
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# or with default settings:

print(big_text("Example"))

# Output:
#####                          ##
#                               #
#     #   #  ###  ## #  ####    #    ###
####   # #      # # # # #   #   #   #   #
#       #    #### # # # #   #   #   #####
#      # #  #   # # # # ####    #   #
##### #   #  #### # # # #      ###   ###

check the wiki to get a better idea of what you can do.

flamewok, docs and exemples are available here: https://github.com/byoso/flamewok

Metadata

Release files for flamewok 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flamewok 1.2.1
File Size Uploaded
flamewok-1.2.1.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flamewok 1.2.1
File Interpreter ABI Platform
flamewok-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 25.7 kB

Release files / flamewok-1.2.1.tar.gz

Download URL flamewok-1.2.1.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0fe453c8195ce38dcf6f4bbc412bfa06dcf497476c1f6835a2344ac8fbe529f1
BLAKE2b-256 checksum
How to use checksums
e6eb82d0cbaf2c08ab2cbb9ca6ee4a0903250f37b474d844558140985b9c1569
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release files / flamewok-1.2.1-py3-none-any.whl

Download URL flamewok-1.2.1-py3-none-any.whl
Size 13.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
95cf74bbfaa1e93dbfc92c7d24178556634acf7088cb8cb9ff2d7707805bdf78
BLAKE2b-256 checksum
How to use checksums
6f45b24dcdc3c55fb103645bbef76e68f5ba05a8c2748def56bd917872ce12cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page