Skip to main content

cuifw_c

C extension for CuiFW — Console User Interface FrameWork.

This package contains the C core used by CuiFW: UTF-8 terminal setup, ANSI helpers, canvas primitives, keyboard and mouse input, and process management. If the extension is not built, Python falls back to the pure Python implementation.

Features

  • UTF-8 enforcement on Windows and POSIX
  • ANSI-aware length and truncation
  • Raw keyboard input (termios / msvcrt)
  • SGR mouse parsing
  • Canvas primitives
  • Process management
  • Zero external dependencies
  • Portable: Linux, macOS, Windows, Termux

Installation

From source:

pip install .

From sdist:

pip install dist/cuifw_c-1.0.0.tar.gz

Development mode:

pip install -e .

Building

sdist only:

python -m build --sdist

sdist + wheel:

python -m build

Result:

dist/
├── cuifw_c-1.0.0.tar.gz
└── cuifw_c-1.0.0-cp311-cp311-linux_x86_64.whl

Requirements

  • Python >= 3.7
  • C compiler (gcc / clang / MSVC)
  • Optional: build (pip install build)

Usage

import cuifw_c

cuifw_c.setup_utf8()

text = "\033[31mhello\033[0m"
print(cuifw_c.visible_len(text))

canvas = cuifw_c.Canvas(80, 24)
canvas.set(5, 5, ord("*"))
canvas.rect(0, 0, 10, 10)
print(canvas.render())

Exact API depends on the C module implementation. See cuifw_c/cuifw_c.c for exported symbols.

Project layout

cuifw_c_project/
├── setup.py
├── pyproject.toml
├── MANIFEST.in
├── README.md
├── LICENSE
└── cuifw_c/
    ├── __init__.py
    └── cuifw_c.c

Compatibility

Platforms: Linux, macOS, Windows, Termux.

Python: 3.7, 3.8, 3.9, 3.10, 3.11, 3.12.

Development

python setup.py build_ext --inplace

License

MIT — see LICENSE.

Author

Suleiman

Changelog

1.7.0

  • Initial release
  • UTF-8 setup
  • ANSI helpers
  • Canvas primitives
  • Process management
  • Keyboard and mouse input

Metadata

Release files for cuifw-c 1.7.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 cuifw-c 1.7.0
File Size Uploaded
cuifw_c-1.7.0.tar.gz 438.9 kB Details

Release files / cuifw_c-1.7.0.tar.gz

Download URL cuifw_c-1.7.0.tar.gz
Size 438.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c4b4ab9f30d994641eb6bf4769113f812fd09c0127220aebf4bbe25ffc450880
BLAKE2b-256 checksum
How to use checksums
fc63fc726d173c2b7ac132de39c40cf4474ac3e3077ab1044af79bc1c65ddd95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release history Release notifications | RSS feed

This release

1.7.0 This release

1 release file

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