Skip to main content

a framework for interactive, page-based console applications

Project description

almanac logo

a framework for interactive, page-based console applications

linux build status windows build status pypi python version


The almanac framework aims to serve as an intuitive interface for spinning up interactive, page-based console applications. Think of it as a Python metaprogramming layer on top of Python Prompt Toolkit and Pygments.


almanac turns this:

"""Welcome to a simple interactive HTTP client.

The current URL to request is the application's current path. Directories will be
created as you cd into them.

import aiohttp
import asyncio

from almanac import highlight_for_mimetype, make_standard_app, PagePath

app = make_standard_app()

async def runs_at_start_up():

    app.bag.session = aiohttp.ClientSession()'Session opened!')

async def runs_at_shut_down():
    await app.bag.session.close()'Session closed!')

def custom_prompt():
    stripped_path = str(app.page_navigator.current_page.path).lstrip('/')
    return f'{stripped_path}> '

async def cd_hook_before(path: PagePath):
    if path not in app.page_navigator:

async def handle_aiohttp_errors(exc: aiohttp.ClientError):'{exc.__class__.__name__}: {str(exc)}')

@app.arg.method(choices=['GET', 'POST', 'PUT'], description='HTTP verb for request.')
@app.arg.proto(choices=['http', 'https'], description='Protocol for request.')
async def request(method: str, *, proto: str = 'https', **params: str):
    """Send an HTTP or HTTPS request."""
    path = str(app.current_path).lstrip('/')
    url = f'{proto}://{path}''Sending {method} request to {url}...')

    resp = await app.bag.session.request(method, url, params=params)
    async with resp:
        text = await resp.text()
        highlighted_text = highlight_for_mimetype(text, resp.content_type)'Status {resp.status} response from {resp.url}')'Here\'s the content:')

if __name__ == '__main__':

Into this:


You can download the latest packaged version from PyPI:

pip install almanac

Alternatively, you can get the bleeding-edge version from version control:

pip install


The original content of this repository is licensed under the MIT License, as per the LICENSE.txt file.

Some of the parsing logic is borrowed from the python-nubia project and is licensed under that project's BSD License. For more information, please see the comment in almanac/parsing/


Development dependencies can be installed with:

pip install -r deps/dev-requirements.txt

To run the tests, use:

python test

To lint and type check the code, use:

flake8 .
mypy .

When it's time to cut a release, use:

python bdist_wheel sdist
twine check dist/*.whl dist/*.gz
twine upload dist/*.whl dist/*.gz

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

almanac-0.1.0.tar.gz (45.7 kB view hashes)

Uploaded source

Built Distribution

almanac-0.1.0-py3-none-any.whl (71.8 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page