Skip to main content

jk_argparsing_textprimitive

Introduction

This module jk_argparsing_textprimitive provides a small, composable data model for creating structured terminal output.

Its primary purpose is to support CLI tools that need to display information such as commands, arguments, options, descriptions, and other structured data in a readable, optionally colored format. By doing so it assists jk_argparsing.

Rather than constructing terminal output directly, applications build a hierarchy of text components. These components describe the content and its structure independently of the final output. A layout process then determines the dimensions and positioning of the individual components and produces lines of text ready for console output.

Information about this module can be found here:

How to use this module

Import

To import this module use the following statement:

import jk_argparsing_textprimitive

Class Hierarchy

The data model is based on two fundamental interfaces:

  • ITextBlock – Base interface for all text components. Defines the common properties and operations required for measuring, laying out, and retrieving text.
  • ITextBlockContainer (inheriting from ITextBlock) – Specialized interface for components that contain other text blocks. Provides access to their child components and allows hierarchical composition.

The concrete implementations are:

  • ITextBlock - Base interface for all blocks.
    • TextBlock - Represents a paragraph or other continuous piece of text. Supports automatic word wrapping, indentation, list-item prefixes, and optional foreground/background coloring.
    • TextEmpty - Represents a sequence of empty lines. Useful for introducing vertical spacing between components.
    • ITextBlockContainer - Base interface for all block containers
      • TextBlockSequence - Combines multiple text blocks into a vertical sequence. Supports indentation and configurable vertical spacing between consecutive blocks.
      • TextGridBlock - Arranges text blocks in rows and columns. Supports configurable horizontal and vertical spacing, column width distribution, and individual column wrapping modes.
      • TextPrefixBlock - Wraps another text block and adds a prefix to each output line. Useful for introducing labels, markers, or other repeated line prefixes.

Layout and Output

All components follow a common processing model:

  1. Build the data model: Create primitive components and combine them into larger structures using container components.
  2. Perform layout: Invoke layout(availableWidth) to determine the dimensions and line structure of the components. Containers recursively distribute available space to their children.
  3. Generate output: Invoke getLines(bColor) to retrieve the resulting lines as XLineFragment instances.

The layout process considers indentation, minimum and maximum widths, wrapping behavior, and spacing requirements. If the available width is insufficient to accommodate the minimum required width, components may exceed the requested width rather than violating their minimum width requirements.

Output Representation

XLineFragment represents a positioned fragment of a terminal output line. It stores the indentation, text content, and text length, allowing fragments produced by different components to be combined into complete output lines.

The resulting fragments can contain ANSI color escape sequences and are intended for direct console output.

The separation between the data model, layout process, and output representation allows applications to construct complex terminal presentations from a small set of reusable building blocks.

Author(s)

License

This software is provided under the following license:

  • Apache Software License 2.0

Metadata

Release files for jk_argparsing_textprimitive 0.2026.11.10

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

Source distribution (sdist)

Source distribution for jk_argparsing_textprimitive 0.2026.11.10
File Size Uploaded Provenance Actions
jk_argparsing_textprimitive-0.2026.11.10.tar.gz 14.1 kB Without provenance Details for jk_argparsing_textprimitive-0.2026.11.10.tar.gz

Built distribution (wheel)

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

Total release size: 33.2 kB

Release files / jk_argparsing_textprimitive-0.2026.11.10.tar.gz

Download URL jk_argparsing_textprimitive-0.2026.11.10.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c1b0bb85dbb86cf742efa15a6b8b1b21d59967c2935fcd57f0be71d7673fd601
BLAKE2b-256 checksum
How to use checksums
667095bc4f8702ec648663f7145e7558d12496faa8613bee965455f5e9713eb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.34.2

Release files / jk_argparsing_textprimitive-0.2026.11.10-py3-none-any.whl

Download URL jk_argparsing_textprimitive-0.2026.11.10-py3-none-any.whl
Size 19.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c8748c1dd0b29228a4dce53ab648ceaf61abc1ecebbb2fe4cf122b94983be90
BLAKE2b-256 checksum
How to use checksums
b76841cda0859be0cf5716ca2dad05ff05b4079e23d7661a1104e58c268353a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.34.2

Security for jk_argparsing_textprimitive 0.2026.11.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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