Skip to main content

Coquille

Coquille (IPA: /kɔ.kij/, english: 'shell' or 'typo') is a library that wraps terminal escape sequences to easily apply them to a stream.

Notes

Requires Python 3.9 or higher.

This library attempts to cover as many escape sequences as possible ; but it is not an exhaustive list, some might be missing. Also, you might find that few have no effect on your terminal emulator.

This library is based on the following resources:

Examples

Even though the examples are mostly showcasing SGR escape sequences (because they are pretty visible), Coquille can do more! See the documentation.

Coquille context manager

from coquille import Coquille

print("Hello World!")

# By default, the coquille wraps the standard output
with Coquille.new("fg_magenta", "italic") as coquille:
    print("Hello World, but in magenta and italic!")
    coquille.apply("bold")
    print("Now, with a touch of bold :D")

print("Oh, we are back to normal now...")

screenshot.png

Source code: examples/coquille_context/

write()

from coquille import write

print("Hello World!")

write("Hello World, but in magenta and italic!", "fg_magenta", "italic")

with open("examples/write/output.txt", "w") as my_file:
    write("A pretty Hello World in a file!", "fg_blue", "bold", file=my_file)

screenshot.png

Source code: examples/write/

Coquille.write()

from coquille import Coquille
from coquille.sequences import fg_truecolor

print("Normal Hello World!")

coquille = Coquille.new(fg_truecolor(128, 255, 0))
coquille.write("Colorful Hello World!")

screenshot.png

Source code: examples/coquille_write/

Install

Normal installation

pip install coquille

Dev installation

pip install coquille[dev]

This allows you to run the tests:

coverage run -m pytest

Then check the coverage:

coverage report -m

Documentation

Coming soon! 🚧

If you like Coquille, you might want to check these projects as well:

  • Colorama: a simple cross-platform colored terminal text in Python, by Jonathan Hartley
  • Rich_: a Python library for rich text and beautiful formatting in the terminal, by Will McGugan
  • Dahlia: a simple text formatting package, inspired by the game Minecraft, by trag1c

Release files for Coquille 1.3.0

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

Source distribution (sdist)

Source distribution for Coquille 1.3.0
File Size Uploaded
Coquille-1.3.0.tar.gz 188.7 kB Details

Built distribution (wheel)

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

Total release size: 201.8 kB

Release files / Coquille-1.3.0.tar.gz

Download URL Coquille-1.3.0.tar.gz
Size 188.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0341256e2bc6368a19e3ddb04386691f41d1f85e292cb0238230c4dd2c9cbf47
BLAKE2b-256 checksum
How to use checksums
96d7490bab12a5e0e7057e7b96ec916131f32c68acd4aa902f5ba5b77fb92ad2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / Coquille-1.3.0-py3-none-any.whl

Download URL Coquille-1.3.0-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d156efee36315adfe2eafea22746205267099a75c62ab9973b1f07815b97c6ae
BLAKE2b-256 checksum
How to use checksums
f01142c82ac3a35d41af567c982adcb7b8092d607930b5d6d6206886c41b081d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release history Release notifications | RSS feed

This release

1.3.0 This release

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

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