textfmt 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
textfmt-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,57 @@
1
+ Metadata-Version: 2.4
2
+ Name: textfmt
3
+ Version: 0.1.0
4
+ Summary: A Python module for ANSI text formatting, word art, and table styling
5
+ Author-email: Rihaan Meher <meherrihaan@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/sharktide/textformat
8
+ Requires-Python: >=3.6
9
+ Description-Content-Type: text/markdown
10
+
11
+ # textfmt
12
+
13
+ A lightweight Python module for ANSI text formatting, customizable word art, and table rendering in CLI applications.
14
+
15
+ ## Features
16
+ - **ANSI Colors & Styles** – Easily format text using intuitive color mappings.
17
+ - **Customizable Word Art** – Generate banners with adjustable characters and widths.
18
+ - **Table Formatting** – Display structured data in a clean, readable format.
19
+
20
+ ## Installation
21
+ Install via PyPI:
22
+ ```sh
23
+ pip install textformat
24
+ ```
25
+
26
+ ## Usage
27
+
28
+ Basic Text Formatting
29
+
30
+ ```python
31
+ import textfmt
32
+
33
+ print(textfmt.TextFmt.style("Hello, World!", textfmt.TextFmt.BOLD, textfmt.TextFmt.COLORS["blue"]))
34
+ ```
35
+
36
+ Custom Word Art Banner
37
+ ```python
38
+ import textfmt.word_art
39
+
40
+ print(textfmt.word_art.WordArt.banner("TEXTFMT", char="*", width=40))
41
+ ```
42
+
43
+ Table Rendering
44
+ ```python
45
+ import textfmt.table
46
+
47
+ headers = ["Name", "Color", "Effect"]
48
+ data = [
49
+ ["Bold", "White", "Strong emphasis"],
50
+ ["Underline", "Blue", "Text decoration"],
51
+ ["Warning", "Yellow", "Cautionary message"],
52
+ ]
53
+
54
+ print(textfmt.table.TableFormatter.generate(headers, data))
55
+ ```
56
+ ## License
57
+ MIT License – Free to use and modify.
@@ -0,0 +1,47 @@
1
+ # textfmt
2
+
3
+ A lightweight Python module for ANSI text formatting, customizable word art, and table rendering in CLI applications.
4
+
5
+ ## Features
6
+ - **ANSI Colors & Styles** – Easily format text using intuitive color mappings.
7
+ - **Customizable Word Art** – Generate banners with adjustable characters and widths.
8
+ - **Table Formatting** – Display structured data in a clean, readable format.
9
+
10
+ ## Installation
11
+ Install via PyPI:
12
+ ```sh
13
+ pip install textformat
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ Basic Text Formatting
19
+
20
+ ```python
21
+ import textfmt
22
+
23
+ print(textfmt.TextFmt.style("Hello, World!", textfmt.TextFmt.BOLD, textfmt.TextFmt.COLORS["blue"]))
24
+ ```
25
+
26
+ Custom Word Art Banner
27
+ ```python
28
+ import textfmt.word_art
29
+
30
+ print(textfmt.word_art.WordArt.banner("TEXTFMT", char="*", width=40))
31
+ ```
32
+
33
+ Table Rendering
34
+ ```python
35
+ import textfmt.table
36
+
37
+ headers = ["Name", "Color", "Effect"]
38
+ data = [
39
+ ["Bold", "White", "Strong emphasis"],
40
+ ["Underline", "Blue", "Text decoration"],
41
+ ["Warning", "Yellow", "Cautionary message"],
42
+ ]
43
+
44
+ print(textfmt.table.TableFormatter.generate(headers, data))
45
+ ```
46
+ ## License
47
+ MIT License – Free to use and modify.
@@ -0,0 +1,19 @@
1
+ [build-system]
2
+ requires = ["setuptools>=42", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "textfmt"
7
+ version = "0.1.0"
8
+ description = "A Python module for ANSI text formatting, word art, and table styling"
9
+ authors = [{name = "Rihaan Meher", email = "meherrihaan@gmail.com"}]
10
+ license = {text = "MIT"}
11
+ readme = "README.md"
12
+ requires-python = ">=3.6"
13
+
14
+ [tool.setuptools]
15
+ packages = ["textformat"]
16
+
17
+ [project.urls]
18
+ "Homepage" = "https://github.com/sharktide/textformat"
19
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,57 @@
1
+ Metadata-Version: 2.4
2
+ Name: textfmt
3
+ Version: 0.1.0
4
+ Summary: A Python module for ANSI text formatting, word art, and table styling
5
+ Author-email: Rihaan Meher <meherrihaan@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/sharktide/textformat
8
+ Requires-Python: >=3.6
9
+ Description-Content-Type: text/markdown
10
+
11
+ # textfmt
12
+
13
+ A lightweight Python module for ANSI text formatting, customizable word art, and table rendering in CLI applications.
14
+
15
+ ## Features
16
+ - **ANSI Colors & Styles** – Easily format text using intuitive color mappings.
17
+ - **Customizable Word Art** – Generate banners with adjustable characters and widths.
18
+ - **Table Formatting** – Display structured data in a clean, readable format.
19
+
20
+ ## Installation
21
+ Install via PyPI:
22
+ ```sh
23
+ pip install textformat
24
+ ```
25
+
26
+ ## Usage
27
+
28
+ Basic Text Formatting
29
+
30
+ ```python
31
+ import textfmt
32
+
33
+ print(textfmt.TextFmt.style("Hello, World!", textfmt.TextFmt.BOLD, textfmt.TextFmt.COLORS["blue"]))
34
+ ```
35
+
36
+ Custom Word Art Banner
37
+ ```python
38
+ import textfmt.word_art
39
+
40
+ print(textfmt.word_art.WordArt.banner("TEXTFMT", char="*", width=40))
41
+ ```
42
+
43
+ Table Rendering
44
+ ```python
45
+ import textfmt.table
46
+
47
+ headers = ["Name", "Color", "Effect"]
48
+ data = [
49
+ ["Bold", "White", "Strong emphasis"],
50
+ ["Underline", "Blue", "Text decoration"],
51
+ ["Warning", "Yellow", "Cautionary message"],
52
+ ]
53
+
54
+ print(textfmt.table.TableFormatter.generate(headers, data))
55
+ ```
56
+ ## License
57
+ MIT License – Free to use and modify.
@@ -0,0 +1,10 @@
1
+ README.md
2
+ pyproject.toml
3
+ textfmt.egg-info/PKG-INFO
4
+ textfmt.egg-info/SOURCES.txt
5
+ textfmt.egg-info/dependency_links.txt
6
+ textfmt.egg-info/top_level.txt
7
+ textformat/__init__.py
8
+ textformat/table.py
9
+ textformat/textformat.py
10
+ textformat/word_art.py
@@ -0,0 +1 @@
1
+ textformat
@@ -0,0 +1,6 @@
1
+ # textfmt/__init__.py
2
+ from .textformat import TextFormat
3
+ from .word_art import WordArt
4
+ from .table import TableFormatter
5
+
6
+ __all__ = ["TextFormat", "WordArt", "TableFormatter"]
@@ -0,0 +1,13 @@
1
+ class TableFormatter:
2
+ """ Formats tables for CLI display """
3
+
4
+ @staticmethod
5
+ def generate(headers, data):
6
+ """ Creates a formatted table for structured output """
7
+ col_widths = [max(len(str(item)) for item in col) for col in zip(headers, *data)]
8
+ border = "+".join("-" * (w + 2) for w in col_widths)
9
+
10
+ def format_row(row):
11
+ return "| " + " | ".join(f"{str(item).ljust(w)}" for item, w in zip(row, col_widths)) + " |"
12
+
13
+ return f"{border}\n{format_row(headers)}\n{border}\n" + "\n".join(format_row(row) for row in data) + f"\n{border}"
@@ -0,0 +1,24 @@
1
+ class TextFormat:
2
+ """ ANSI Escape Code Formatting for Python CLI Output """
3
+ RESET = "\x1b[0m"
4
+
5
+ BOLD = "\x1b[1m" # Basic bold without a color
6
+
7
+ UNDERLINE = "\x1b[4m" # Add this line for underline support
8
+
9
+ COLORS = {
10
+ "black": "\x1b[30m", "blue": "\x1b[34m", "cyan": "\x1b[36m",
11
+ "green": "\x1b[32m", "grey": "\x1b[90m", "magenta": "\x1b[35m",
12
+ "red": "\x1b[31m", "white": "\x1b[37m", "yellow": "\x1b[33m"
13
+ }
14
+
15
+ BOLD_COLORS = {
16
+ "black": "\x1b[1;30m", "blue": "\x1b[1;34m", "cyan": "\x1b[1;36m",
17
+ "green": "\x1b[1;32m", "magenta": "\x1b[1;35m", "red": "\x1b[1;31m",
18
+ "white": "\x1b[1;37m", "yellow": "\x1b[1;33m"
19
+ }
20
+
21
+ @staticmethod
22
+ def style(text, *styles):
23
+ """ Applies ANSI styles to text """
24
+ return "".join(styles) + text + TextFormat.RESET
@@ -0,0 +1,9 @@
1
+ class WordArt:
2
+ """ Generates customizable word art banners """
3
+
4
+ @staticmethod
5
+ def banner(text, char="█", width=50):
6
+ """ Creates a formatted word art banner """
7
+ top = char * width
8
+ middle = f"{char} {text.center(width - 4)} {char}"
9
+ return f"{top}\n{middle}\n{top}"