Cement is an advanced Application Framework for Python, with a primary focus on CLI

Overview

Cement Framework

Built on Cement™ Continuous Integration Status Code Quality: Python Total Alerts

Cement is an advanced Application Framework for Python, with a primary focus on Command Line Interfaces (CLI). Its goal is to introduce a standard, and feature-full platform for both simple and complex command line applications as well as support rapid development needs without sacrificing quality. Cement is flexible, and it's use cases span from the simplicity of a micro-framework to the complexity of a mega-framework. Whether it's a single file script, or a multi-tier application, Cement is the foundation you've been looking for.

The first commit to Git was on Dec 4, 2009. Since then, the framework has seen several iterations in design, and has continued to grow and improve since it's inception. Cement is the most stable, and complete framework for command line and backend application development.

Core Features

Cement core features include (but are not limited to):

  • Core pieces of the framework are customizable via handlers/interfaces
  • Handler system connects implementation classes with Interfaces
  • Extension handler interface to easily extend framework functionality
  • Config handler supports parsing multiple config files into one config
  • Argument handler parses command line arguments and merges with config
  • Log handler supports console and file logging
  • Plugin handler provides an interface to easily extend your application
  • Output handler interface renders return dictionaries to console
  • Cache handler interface adds caching support for improved performance
  • Controller handler supports sub-commands, and nested controllers
  • Hook support adds a bit of magic to apps and also ties into framework
  • Zero external dependencies* (not including optional extensions)
  • 100% test coverage (pytest)
  • 100% PEP8 compliant (flake8)
  • Extensive API Reference (sphinx)
  • Tested on Python 3.5+
  • Does not support Python 2.x

Some optional extensions that are shipped with the mainline Cement sources do require external dependencies. It is the responsibility of the application developer to include these dependencies along with their application, as Cement explicitly does not include them.

More Information

License

The Cement CLI Application Framework is Open Source and is distributed under the BSD License (three clause). Please see the LICENSE file included with this software.

Development

Docker

This project includes a docker-compose configuration that sets up all required services, and dependencies for development and testing. This is the recommended path for local development, and is the only fully supported option.

The following creates all required docker containers, and launches an BASH shell within the cement dev container for development.

$ make dev

|> cement <| src #

The above is the equivalent of running:

$ docker-compose up -d

$ docker-compose exec cement /bin/bash

Testing Alternative Versions of Python

The latest stable version of Python 3 is the default, and target version accessible as the cement container within Docker Compose. For testing against alternative versions of python, additional containers are created (ex: cement-py37, cement-py38, etc). You can access these containers via:

$ docker-compose ps
        Name                      Command               State     Ports
-------------------------------------------------------------------------
cement_cement-py35_1   /bin/bash                        Up
cement_cement-py36_1   /bin/bash                        Up
cement_cement-py37_1   /bin/bash                        Up
cement_cement-py38_1   /bin/bash                        Up
cement_cement-py39_1   /bin/bash                        Up
cement_cement_1        /bin/bash                        Up
cement_memcached_1     docker-entrypoint.sh memcached   Up      11211/tcp
cement_redis_1         docker-entrypoint.sh redis ...   Up      6379/tcp


$ docker-compose exec cement-py37 /bin/bash

|> cement-py37 <| src #

VirtualENV

An traditional VirtualENV helper is available:

$ make virtualenv

$ source env/bin/activate

|> cement <| $

Vagrant

An alternative option is included to run Vagrant for development. This is partially supported, primarily for the purpose of developing/testing on Windows as well as testing specific issues on target operating systems.

To see a list of configured systems:

$ vagrant status

Linux

$ vagrant up linux

$ vagrant ssh linux

[email protected] $ cd /vagrant

[email protected] $ bash scripts/vagrant/bootstrap.sh

[email protected] $ make virtualenv

v[email protected] $ source env/bin/activate

|> cement >| $

Windows

Windows development and support is not 100% complete. Cement is known to run and work on Windows, however it is not a primary target for development and as such the setup is not as streamlined and currently has several known errors.

The following assumes you're running these two initial commands from a unix based system:

$ make clean

$ vagrant up windows

RDP or Login to Desktop/Console, and open a PowerShell terminal:

C:\> cd C:\Vagrant

C:\Vagrant> powershell.exe scripts\vagrant\bootstrap.ps1

C:\Vagrant> make virtualenv-windows

C:\Vagrant> .\env-windows\Scripts\activate.ps1

C:\Vagrant> make test-core

Note that only the core library is fully tested on Windows.

Running Tests and Compliance

Cement has a strict policy that all code and tests meet PEP8 guidelines, therefore flake8 is called before any unit tests run. All code submissions require 100% test coverage and PEP8 compliance:

Execute the following to run all compliance and unit tests:

$ make test

A coverage report is printed to console, as well as the HTML version created in coverage-report:

$ open coverage-report/index.html

See Makefile for all other common development actions.

plotting in the terminal

bashplotlib plotting in the terminal what is it? bashplotlib is a python package and command line tool for making basic plots in the terminal. It's a

Greg Lamp 1.7k Jan 02, 2023
Python library that measures the width of unicode strings rendered to a terminal

Introduction This library is mainly for CLI programs that carefully produce output for Terminals, or make pretend to be an emulator. Problem Statement

Jeff Quast 305 Dec 25, 2022
A fast, stateless http slash commands framework for scale. Built by the Crunchy bot team.

Roid 🤖 A fast, stateless http slash commands framework for scale. Built by the Crunchy bot team. 🚀 Installation You can install roid in it's default

Harrison Burt 7 Aug 09, 2022
Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object.

Python Fire Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object. Python Fire is a s

Google 23.6k Dec 31, 2022
Cement is an advanced Application Framework for Python, with a primary focus on CLI

Cement Framework Cement is an advanced Application Framework for Python, with a primary focus on Command Line Interfaces (CLI). Its goal is to introdu

Data Folk Labs, LLC 1.1k Dec 31, 2022
A module for parsing and processing commands.

cmdtools A module for parsing and processing commands. Installation pip install --upgrade cmdtools-py install latest commit from GitHub pip install g

1 Aug 14, 2022
Corgy allows you to create a command line interface in Python, without worrying about boilerplate code

corgy Elegant command line parsing for Python. Corgy allows you to create a command line interface in Python, without worrying about boilerplate code.

Jayanth Koushik 7 Nov 17, 2022
Python composable command line interface toolkit

$ click_ Click is a Python package for creating beautiful command line interfaces in a composable way with as little code as necessary. It's the "Comm

The Pallets Projects 13.3k Dec 31, 2022
Terminalcmd - a Python library which can help you to make your own terminal program with high-intellegence instruments

Terminalcmd - a Python library which can help you to make your own terminal program with high-intellegence instruments, that will make your code clear and readable.

Dallas 0 Jun 19, 2022
Clint is a module filled with a set of awesome tools for developing commandline applications.

Clint: Python Command-line Interface Tools Clint is a module filled with a set of awesome tools for developing commandline applications. C ommand L in

Kenneth Reitz Archive 82 Dec 28, 2022
Library for building powerful interactive command line applications in Python

Python Prompt Toolkit prompt_toolkit is a library for building powerful interactive command line applications in Python. Read the documentation on rea

prompt-toolkit 8.1k Dec 30, 2022
Python library to build pretty command line user prompts ✨Easy to use multi-select lists, confirmations, free text prompts ...

Questionary ✨ Questionary is a Python library for effortlessly building pretty command line interfaces ✨ Features Installation Usage Documentation Sup

Tom Bocklisch 990 Jan 01, 2023
A CLI tool to build beautiful command-line interfaces with type validation.

Piou A CLI tool to build beautiful command-line interfaces with type validation. It is as simple as from piou import Cli, Option cli = Cli(descriptio

Julien Brayere 310 Dec 07, 2022
prompt_toolkit is a library for building powerful interactive command line applications in Python.

Python Prompt Toolkit prompt_toolkit is a library for building powerful interactive command line applications in Python. Read the documentation on rea

prompt-toolkit 8.1k Jan 04, 2023
emoji terminal output for Python

Emoji Emoji for Python. This project was inspired by kyokomi. Example The entire set of Emoji codes as defined by the unicode consortium is supported

Taehoon Kim 1.6k Jan 02, 2023
Pythonic command line arguments parser, that will make you smile

docopt creates beautiful command-line interfaces Video introduction to docopt: PyCon UK 2012: Create *beautiful* command-line interfaces with Python N

7.7k Dec 30, 2022
A minimal and ridiculously good looking command-line-interface toolkit

Proper CLI Proper CLI is a Python package for creating beautiful, composable, and ridiculously good looking command-line-user-interfaces without havin

Juan-Pablo Scaletti 2 Dec 22, 2022
Simple cross-platform colored terminal text in Python

Colorama Makes ANSI escape character sequences (for producing colored terminal text and cursor positioning) work under MS Windows. PyPI for releases |

Jonathan Hartley 3k Jan 01, 2023
Typer, build great CLIs. Easy to code. Based on Python type hints.

Typer, build great CLIs. Easy to code. Based on Python type hints. Documentation: https://typer.tiangolo.com Source Code: https://github.com/tiangolo/

Sebastián Ramírez 10.1k Jan 02, 2023
A cross platform package to do curses-like operations, plus higher level APIs and widgets to create text UIs and ASCII art animations

ASCIIMATICS Asciimatics is a package to help people create full-screen text UIs (from interactive forms to ASCII animations) on any platform. It is li

3.2k Jan 09, 2023