Coquille


NameCoquille JSON
Version 1.2.2 PyPI version JSON
download
home_page
SummaryCoquille is a library that wraps terminal escape sequences as convenient functions.
upload_time2024-01-22 10:39:46
maintainer
docs_urlNone
authorQexat
requires_python>=3.9
licenseMIT License Copyright (c) 2023 Qexat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords terminal escape sequences
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:

- The Wikipedia page: <https://en.m.wikipedia.org/wiki/ANSI_escape_code>
- Some Microsoft documentation about console virtual terminal sequences: <https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences>

## Examples

Even though the examples are mostly showcasing [SGR escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters) (because they are pretty visible), Coquille can do more! See the [documentation](#documentation).

### Coquille context manager

```py
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](https://raw.githubusercontent.com/qexat/Coquille/main/examples/coquille_context/screenshot.png)

Source code: [examples/coquille_context/](https://github.com/qexat/Coquille/blob/main/examples/coquille_context/__main__.py)

### write()

```py
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](https://raw.githubusercontent.com/qexat/Coquille/main/examples/write/screenshot.png)

Source code: [examples/write/](https://github.com/qexat/Coquille/blob/main/examples/write/__main__.py)

### Coquille.write()

```py
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](https://raw.githubusercontent.com/qexat/Coquille/main/examples/coquille_write/screenshot.png)

Source code: [examples/coquille_write/](https://github.com/qexat/Coquille/blob/main/examples/coquille_write/__main__.py)

## Install

### Normal installation

```sh
pip install coquille
```

### Dev installation

```sh
pip install coquille[dev]
```

This allows you to run the tests:

```sh
coverage run -m pytest
```

Then check the coverage:

```sh
coverage report -m
```

## Documentation

Coming soon! 🚧

## Related projects

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

- [Colorama](https://github.com/tartley/colorama): a simple cross-platform colored terminal text in Python, by [Jonathan Hartley](https://github.com/tartley)
- [Rich_](https://github.com/Textualize/rich): a Python library for rich text and beautiful formatting in the terminal, by [Will McGugan](https://github.com/willmcgugan)
- [Dahlia](https://github.com/dahlia-lib/dahlia): a simple text formatting package, inspired by the game Minecraft, by [trag1c](https://github.com/trag1c/)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "Coquille",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "terminal,escape sequences",
    "author": "Qexat",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/a9/52/4e1c9f1ff579a8e138dc8bf091c8baf78024368b1565b1ce30fd30f1b797/Coquille-1.2.2.tar.gz",
    "platform": null,
    "description": "# Coquille\n\nCoquille (IPA: `/k\u0254.kij/`, english: 'shell' or 'typo') is a library that wraps terminal escape sequences to easily apply them to a stream.\n\n## Notes\n\nRequires Python 3.9 or higher.\n\nThis 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.\n\nThis library is based on the following resources:\n\n- The Wikipedia page: <https://en.m.wikipedia.org/wiki/ANSI_escape_code>\n- Some Microsoft documentation about console virtual terminal sequences: <https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences>\n\n## Examples\n\nEven though the examples are mostly showcasing [SGR escape sequences](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters) (because they are pretty visible), Coquille can do more! See the [documentation](#documentation).\n\n### Coquille context manager\n\n```py\nfrom coquille import Coquille\n\nprint(\"Hello World!\")\n\n# By default, the coquille wraps the standard output\nwith Coquille.new(\"fg_magenta\", \"italic\") as coquille:\n    print(\"Hello World, but in magenta and italic!\")\n    coquille.apply(\"bold\")\n    print(\"Now, with a touch of bold :D\")\n\nprint(\"Oh, we are back to normal now...\")\n\n```\n\n![screenshot.png](https://raw.githubusercontent.com/qexat/Coquille/main/examples/coquille_context/screenshot.png)\n\nSource code: [examples/coquille_context/](https://github.com/qexat/Coquille/blob/main/examples/coquille_context/__main__.py)\n\n### write()\n\n```py\nfrom coquille import write\n\nprint(\"Hello World!\")\n\nwrite(\"Hello World, but in magenta and italic!\", \"fg_magenta\", \"italic\")\n\nwith open(\"examples/write/output.txt\", \"w\") as my_file:\n    write(\"A pretty Hello World in a file!\", \"fg_blue\", \"bold\", file=my_file)\n\n```\n\n![screenshot.png](https://raw.githubusercontent.com/qexat/Coquille/main/examples/write/screenshot.png)\n\nSource code: [examples/write/](https://github.com/qexat/Coquille/blob/main/examples/write/__main__.py)\n\n### Coquille.write()\n\n```py\nfrom coquille import Coquille\nfrom coquille.sequences import fg_truecolor\n\nprint(\"Normal Hello World!\")\n\ncoquille = Coquille.new(fg_truecolor(128, 255, 0))\ncoquille.write(\"Colorful Hello World!\")\n\n```\n\n![screenshot.png](https://raw.githubusercontent.com/qexat/Coquille/main/examples/coquille_write/screenshot.png)\n\nSource code: [examples/coquille_write/](https://github.com/qexat/Coquille/blob/main/examples/coquille_write/__main__.py)\n\n## Install\n\n### Normal installation\n\n```sh\npip install coquille\n```\n\n### Dev installation\n\n```sh\npip install coquille[dev]\n```\n\nThis allows you to run the tests:\n\n```sh\ncoverage run -m pytest\n```\n\nThen check the coverage:\n\n```sh\ncoverage report -m\n```\n\n## Documentation\n\nComing soon! \ud83d\udea7\n\n## Related projects\n\nIf you like Coquille, you might want to check these projects as well:\n\n- [Colorama](https://github.com/tartley/colorama): a simple cross-platform colored terminal text in Python, by [Jonathan Hartley](https://github.com/tartley)\n- [Rich_](https://github.com/Textualize/rich): a Python library for rich text and beautiful formatting in the terminal, by [Will McGugan](https://github.com/willmcgugan)\n- [Dahlia](https://github.com/dahlia-lib/dahlia): a simple text formatting package, inspired by the game Minecraft, by [trag1c](https://github.com/trag1c/)\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Qexat  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Coquille is a library that wraps terminal escape sequences as convenient functions.",
    "version": "1.2.2",
    "project_urls": {
        "homepage": "https://github.com/qexat/Coquille",
        "repository": "https://github.com/qexat/Coquille"
    },
    "split_keywords": [
        "terminal",
        "escape sequences"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2f495cfb2937d05a5885139ac9cf9ffaa0775b602a9d4affe1c00a511b6343bf",
                "md5": "caad18e7d8fcb8237c562ebb135e8d2e",
                "sha256": "247479939b512ff1753e1d8c7f5c11b2c7c0d67d62ebac06f16bad7263d0afb8"
            },
            "downloads": -1,
            "filename": "Coquille-1.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "caad18e7d8fcb8237c562ebb135e8d2e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 10231,
            "upload_time": "2024-01-22T10:39:44",
            "upload_time_iso_8601": "2024-01-22T10:39:44.664141Z",
            "url": "https://files.pythonhosted.org/packages/2f/49/5cfb2937d05a5885139ac9cf9ffaa0775b602a9d4affe1c00a511b6343bf/Coquille-1.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a9524e1c9f1ff579a8e138dc8bf091c8baf78024368b1565b1ce30fd30f1b797",
                "md5": "ee289800739d2793b95ea6e4a03869b0",
                "sha256": "356e3dd722fc9b7708d9eb8ff985b1db6c6fbfbb0e846a6e430a53ed98d2634c"
            },
            "downloads": -1,
            "filename": "Coquille-1.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "ee289800739d2793b95ea6e4a03869b0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 187199,
            "upload_time": "2024-01-22T10:39:46",
            "upload_time_iso_8601": "2024-01-22T10:39:46.355973Z",
            "url": "https://files.pythonhosted.org/packages/a9/52/4e1c9f1ff579a8e138dc8bf091c8baf78024368b1565b1ce30fd30f1b797/Coquille-1.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-22 10:39:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "qexat",
    "github_project": "Coquille",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "coquille"
}
        
Elapsed time: 0.81372s