micron-builder


Namemicron-builder JSON
Version 0.1.2 PyPI version JSON
download
home_pageNone
SummaryFluent string builder for micron markup
upload_time2025-08-19 22:13:43
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT
keywords micron builder colors ansi terminal
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # micron-builder

**micron-builder** is a small Python library for building micron markup strings programmatically.  
It provides a fluent API for composing text fragments, headers, separators, and styles without manually handling all the Micron markup symbols.

---

## ✨ Features

- Fluent API for building Micron markup strings
- Support for:
  - **Text fragments** with color, background color, and formatting (bold, italic, underline)
  - **Headers** with indent levels
  - **Separators** and line breaks
  - **Links** (address + page)
  - **Alignment** (center, right)
  - **Padding** around text
- Works with raw strings or the built-in `Color` enum
- Easy to extend and compose

---

## πŸ“¦ Installation

```bash
pip install micron-builder
```

## πŸš€ Usage

Here’s a quick example of how to use `MicronBuilder`:

```python
from micron import MicronBuilder
from micron.colors import Color

builder = (
    MicronBuilder()
    .header("Welcome!", indent_level=1)
    .text(
        "This is bold red text",
        bold=True,
        color=Color.RED,
    )
    .breakline()
    .text("Centered and underlined", center=True, underline=True)
    .separator("=")
    .text(
        "Clickable link",
        address_link="example.com",
        page_link="index.mu",
        italic=True,
    )
)

print(builder.build())
```

This would output Micron markup like:

```
>Welcome!

`!`Ff00This is bold red text`f`!

`c
_`Centered and underlined`_
`a

-=

`[*`Clickable link`example.com:/page/index.mu]
```

Which renders appropriately in Micron-compatible renderers.

## 🎨 Colors

Colors can be specified as:
- A **3-digit hex string** (e.g. `"f00"`, `"0ff"`)
- A `Color` enum value:

    ```python
    from micron.colors import Color

    MicronBuilder().text("Hello", color=Color.AQUA)
    ```

## πŸ›  Development

Clone the repo and install in editable mode:
```bash
git clone https://github.com/neoemit/micron-builder.git
cd micron-builder
pip install -e .
```

Run tests (if you add them later):
```bash
pytest
```

## πŸ“œ License

MIT License.

Feel free to use in your own projects.

## πŸ™Œ Contributing

Pull requests, bug reports, and suggestions are welcome!

Open an issue or submit a PR on [GitHub](https://github.com/neoemit/micron).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "micron-builder",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "micron, builder, colors, ansi, terminal",
    "author": null,
    "author_email": "Thomas La Mendola <thomas.lamendola@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/cb/84/08c0d5cf6947822b752a370d74123b2a14654b8997b619c06782aefeffee/micron_builder-0.1.2.tar.gz",
    "platform": null,
    "description": "# micron-builder\n\n**micron-builder** is a small Python library for building micron markup strings programmatically.  \nIt provides a fluent API for composing text fragments, headers, separators, and styles without manually handling all the Micron markup symbols.\n\n---\n\n## \u2728 Features\n\n- Fluent API for building Micron markup strings\n- Support for:\n  - **Text fragments** with color, background color, and formatting (bold, italic, underline)\n  - **Headers** with indent levels\n  - **Separators** and line breaks\n  - **Links** (address + page)\n  - **Alignment** (center, right)\n  - **Padding** around text\n- Works with raw strings or the built-in `Color` enum\n- Easy to extend and compose\n\n---\n\n## \ud83d\udce6 Installation\n\n```bash\npip install micron-builder\n```\n\n## \ud83d\ude80 Usage\n\nHere\u2019s a quick example of how to use `MicronBuilder`:\n\n```python\nfrom micron import MicronBuilder\nfrom micron.colors import Color\n\nbuilder = (\n    MicronBuilder()\n    .header(\"Welcome!\", indent_level=1)\n    .text(\n        \"This is bold red text\",\n        bold=True,\n        color=Color.RED,\n    )\n    .breakline()\n    .text(\"Centered and underlined\", center=True, underline=True)\n    .separator(\"=\")\n    .text(\n        \"Clickable link\",\n        address_link=\"example.com\",\n        page_link=\"index.mu\",\n        italic=True,\n    )\n)\n\nprint(builder.build())\n```\n\nThis would output Micron markup like:\n\n```\n>Welcome!\n\n`!`Ff00This is bold red text`f`!\n\n`c\n_`Centered and underlined`_\n`a\n\n-=\n\n`[*`Clickable link`example.com:/page/index.mu]\n```\n\nWhich renders appropriately in Micron-compatible renderers.\n\n## \ud83c\udfa8 Colors\n\nColors can be specified as:\n- A **3-digit hex string** (e.g. `\"f00\"`, `\"0ff\"`)\n- A `Color` enum value:\n\n    ```python\n    from micron.colors import Color\n\n    MicronBuilder().text(\"Hello\", color=Color.AQUA)\n    ```\n\n## \ud83d\udee0 Development\n\nClone the repo and install in editable mode:\n```bash\ngit clone https://github.com/neoemit/micron-builder.git\ncd micron-builder\npip install -e .\n```\n\nRun tests (if you add them later):\n```bash\npytest\n```\n\n## \ud83d\udcdc License\n\nMIT License.\n\nFeel free to use in your own projects.\n\n## \ud83d\ude4c Contributing\n\nPull requests, bug reports, and suggestions are welcome!\n\nOpen an issue or submit a PR on [GitHub](https://github.com/neoemit/micron).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Fluent string builder for micron markup",
    "version": "0.1.2",
    "project_urls": null,
    "split_keywords": [
        "micron",
        " builder",
        " colors",
        " ansi",
        " terminal"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "77efc9101c647c2272920879310a658106fed5ed39ad39747b436786f8cd6cc5",
                "md5": "4a38f128c06d7471bbaa3bcc64e50fbb",
                "sha256": "8a8eea2d5cdd8fb1bdf8b3a0fde9e329b63d2fbf7026f9904b821a1b94867297"
            },
            "downloads": -1,
            "filename": "micron_builder-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4a38f128c06d7471bbaa3bcc64e50fbb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 6355,
            "upload_time": "2025-08-19T22:13:42",
            "upload_time_iso_8601": "2025-08-19T22:13:42.624357Z",
            "url": "https://files.pythonhosted.org/packages/77/ef/c9101c647c2272920879310a658106fed5ed39ad39747b436786f8cd6cc5/micron_builder-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cb8408c0d5cf6947822b752a370d74123b2a14654b8997b619c06782aefeffee",
                "md5": "9bea7e01586dff31933c8532819cecd6",
                "sha256": "cb0031edd983ba2ba54343d97aadf598edc75a47ea35466b9c67cf30c86aefa7"
            },
            "downloads": -1,
            "filename": "micron_builder-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "9bea7e01586dff31933c8532819cecd6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 7235,
            "upload_time": "2025-08-19T22:13:43",
            "upload_time_iso_8601": "2025-08-19T22:13:43.354130Z",
            "url": "https://files.pythonhosted.org/packages/cb/84/08c0d5cf6947822b752a370d74123b2a14654b8997b619c06782aefeffee/micron_builder-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-19 22:13:43",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "micron-builder"
}
        
Elapsed time: 0.44352s