Skip to main content

termapp

CI Status Releases PyPi Wheel Python Versions

Create terminal applications with python.

Installation

pip install termapp

Usage

import asyncio

from termapp import __version__
from termapp.styles import BOLD
from termapp.asyncio import create_app

app = create_app()


async def start():
    await app.write_line(f"termapp demo app v{__version__}", BOLD)
    await app.write_line('This app demonstrates the capabilities of the termapp module.')

    await app.info('info is used to introduce an important step in the app.')
    await app.details('details can be used to add additional informationen.')

    await app.warn('warn shows a warning')
    await app.details('which can also be enhanced with a details message.')

    await app.danger('error reports an error message')
    await app.details('which can also be enhanced with a details message.')

    await app.start_progress(show_completion=True)
    await asyncio.sleep(5)
    await app.stop_progress()
    await app.details('Longer operation finished.')

    await app.success('success is used to indicate success')

    await app.failure('failure is used to indicate the operation failed')


async def warn_later():
    await asyncio.sleep(0.5)
    await app.update_progress(completion=0.3, message='Some task to be done')
    await asyncio.sleep(0.5)
    await app.update_progress(completion=0.6)
    await asyncio.sleep(0.5)
    await app.update_progress(message='Another task to be done')
    await asyncio.sleep(0.5)
    await app.update_progress(completion=0.9)
    await asyncio.sleep(1)
    await app.warn('Something unexpected happened')


async def main():
    return await asyncio.gather(start(), warn_later())

asyncio.run(main())

License

Copyright 2022 Alexander Metzner.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Release files for termapp 0.1.2

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

Source distribution (sdist)

Source distribution for termapp 0.1.2
File Size Uploaded
termapp-0.1.2.tar.gz 11.0 kB Details

Built distribution (wheel)

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

Total release size: 23.4 kB

Release files / termapp-0.1.2.tar.gz

Download URL termapp-0.1.2.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
104b9bbe147e09cea3319d7fd56b1abc0ac84b3335c7c1c6b3c2f2e0075497e2
BLAKE2b-256 checksum
How to use checksums
1adb6e6d8ad85aaf329d713d327edfd78939fcc82aee0be7adbdde14f8df86d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / termapp-0.1.2-py3-none-any.whl

Download URL termapp-0.1.2-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
079ead174d73cb902d47f724da480f693264cf3df640eb99f146de36cad7d5be
BLAKE2b-256 checksum
How to use checksums
ecd57a037d8751f7e4e4166b262248530627cc52e187fba87351ce830a62148b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.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