rich-gradient-cli 0.3.0__tar.gz → 0.4.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.
Files changed (27) hide show
  1. rich_gradient_cli-0.4.0/LICENSE +21 -0
  2. rich_gradient_cli-0.4.0/PKG-INFO +105 -0
  3. rich_gradient_cli-0.4.0/README.md +80 -0
  4. {rich_gradient_cli-0.3.0 → rich_gradient_cli-0.4.0}/pyproject.toml +23 -20
  5. {rich_gradient_cli-0.3.0 → rich_gradient_cli-0.4.0}/pyproject.toml.orig +25 -15
  6. rich_gradient_cli-0.4.0/src/rich_gradient_cli/__init__.py +36 -0
  7. rich_gradient_cli-0.4.0/src/rich_gradient_cli/cli.py +314 -0
  8. rich_gradient_cli-0.4.0/src/rich_gradient_cli/export.py +49 -0
  9. rich_gradient_cli-0.4.0/src/rich_gradient_cli/options.py +92 -0
  10. rich_gradient_cli-0.4.0/src/rich_gradient_cli/render.py +505 -0
  11. rich_gradient_cli-0.4.0/src/rich_gradient_cli/resource.py +148 -0
  12. rich_gradient_cli-0.4.0/src/rich_gradient_cli/telemetry.py +111 -0
  13. rich_gradient_cli-0.3.0/PKG-INFO +0 -153
  14. rich_gradient_cli-0.3.0/README.md +0 -132
  15. rich_gradient_cli-0.3.0/src/rich_gradient_cli/__init__.py +0 -142
  16. rich_gradient_cli-0.3.0/src/rich_gradient_cli/common.py +0 -189
  17. rich_gradient_cli-0.3.0/src/rich_gradient_cli/gradient_command.py +0 -139
  18. rich_gradient_cli-0.3.0/src/rich_gradient_cli/help.py +0 -242
  19. rich_gradient_cli-0.3.0/src/rich_gradient_cli/markdown_command.py +0 -213
  20. rich_gradient_cli-0.3.0/src/rich_gradient_cli/panel_command.py +0 -331
  21. rich_gradient_cli-0.3.0/src/rich_gradient_cli/renderable_commands.py +0 -443
  22. rich_gradient_cli-0.3.0/src/rich_gradient_cli/rule_command.py +0 -190
  23. rich_gradient_cli-0.3.0/src/rich_gradient_cli/spectrum_command.py +0 -82
  24. rich_gradient_cli-0.3.0/src/rich_gradient_cli/text_command.py +0 -200
  25. rich_gradient_cli-0.3.0/src/rich_gradient_cli/view_command.py +0 -590
  26. {rich_gradient_cli-0.3.0 → rich_gradient_cli-0.4.0}/src/rich_gradient_cli/__main__.py +0 -0
  27. {rich_gradient_cli-0.3.0 → rich_gradient_cli-0.4.0}/src/rich_gradient_cli/py.typed +0 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Maxwell O. Ludden
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the “Software”), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,105 @@
1
+ Metadata-Version: 2.4
2
+ Name: rich-gradient-cli
3
+ Version: 0.4.0
4
+ Summary: Render files, URLs, stdin, and text with rich-gradient from the command line.
5
+ Author: Maxwell Ludden
6
+ Author-email: Maxwell Ludden <maxludden@me.com>
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Requires-Dist: typer>=0.21.1
10
+ Requires-Dist: rich>=15.0.0
11
+ Requires-Dist: rich-color-ext>=3.0.0
12
+ Requires-Dist: rich-gradient>=0.4.1
13
+ Requires-Dist: amplitude-analytics>=1.3.0
14
+ Requires-Dist: rich-rst>=2.2.0
15
+ Requires-Dist: mypy>=1.18.2 ; extra == 'dev'
16
+ Requires-Dist: pytest>=8.4.2 ; extra == 'dev'
17
+ Requires-Dist: ruff>=0.15.0 ; extra == 'dev'
18
+ Requires-Dist: mkdocstrings>=1.0.8 ; extra == 'docs'
19
+ Requires-Dist: mkdocstrings-python>=2.0.2 ; extra == 'docs'
20
+ Requires-Dist: zensical>=0.0.68 ; extra == 'docs'
21
+ Requires-Python: >=3.11
22
+ Provides-Extra: dev
23
+ Provides-Extra: docs
24
+ Description-Content-Type: text/markdown
25
+
26
+ # rich-gradient-cli
27
+
28
+ `gradient` is a single-command CLI for [`rich-gradient`](https://github.com/maxludden/rich-gradient), modeled on [`rich-cli`](https://github.com/Textualize/rich-cli): point it at a file, a URL, `-` for stdin, or literal text and it renders the result with a gradient.
29
+
30
+ ```text
31
+ gradient [OPTIONS] [PATH,TEXT,URL, or '-']
32
+ ```
33
+
34
+ ## Installation
35
+
36
+ ```shell
37
+ uv tool install rich-gradient-cli # or: pip install rich-gradient-cli
38
+ ```
39
+
40
+ Or with [Homebrew](https://brew.sh):
41
+
42
+ ```shell
43
+ brew install maxludden/tap/rich-gradient-cli
44
+ ```
45
+
46
+ Requires Python 3.11+.
47
+
48
+ ## Usage
49
+
50
+ The renderable is chosen from the file extension (`.md`, `.rst`, `.ipynb`, `.json`, `.csv`/`.tsv`, source code) or by a mode flag, exactly like `rich-cli`. Literal text and stdin are printed as gradient text.
51
+
52
+ ```bash
53
+ gradient --colors 'red,#ff9900,#ffff00' "Gradient text that runs red, orange, yellow!"
54
+ gradient README.md # Markdown, auto-detected
55
+ gradient pyproject.toml -n -g # syntax with line numbers and guides
56
+ gradient data.csv --colors cyan,magenta # table
57
+ gradient notebook.ipynb # Jupyter notebook
58
+ cat doc.rst | gradient - --rst # reStructuredText from stdin
59
+ gradient https://example.com/page.md # URL
60
+ gradient "Title" --rule --colors blue,cyan
61
+ gradient "Heads up" --panel rounded --title Notice
62
+ gradient str --inspect # inspect a Python object
63
+ gradient --spectrum --hues 7
64
+ gradient --tree src # directory tree
65
+ gradient README.md --export-svg out.svg # also: -o out.html, --pager
66
+ ```
67
+
68
+ ![Gradient text](docs/img/commands/text-example.svg)
69
+
70
+ ### Options at a glance
71
+
72
+ Shared flags keep their `rich-cli` spelling (`-p --print`, `-u --rule`, `-m --markdown`, `-J --json`, `-a --panel BOX`, `-d --padding`, `-s --style`, `-S --panel-style`, `-l/-c/-r` block alignment, `-L/-C/-R/-F` text justify, `-w/-W` width, `-h/-t` head/tail, `-n -g -x -y -j`, `-o --export-html`, `--export-svg`, `--pager`, `-v --version`). Gradient-specific options are long-only: `--colors`, `--bgcolors`, `--rainbow`, `--hues`, `--repeat-scale`, `--highlight-word`, `--highlight-regex`, `--animate`, `--duration`.
73
+
74
+ See [docs/options.md](docs/options.md) or run `gradient --help` for the grouped list.
75
+
76
+ ### From `0.3` subcommands
77
+
78
+ Versions up to 0.3 used subcommands (`gradient print`, `gradient panel`, `gradient view`, ...). They were replaced by flags on the one command; see the [CHANGELOG](CHANGELOG.md) for the mapping.
79
+
80
+ ### Telemetry
81
+
82
+ Anonymous usage telemetry is **off by default**. `gradient --telemetry enable|disable|status` manages it; when enabled and `AMPLITUDE_API_KEY` is set, a `Command Run` event with the render mode and a random install ID is sent after a command succeeds.
83
+
84
+ ## Docs
85
+
86
+ Build and preview the documentation locally with [Zensical](https://zensical.org):
87
+
88
+ ```bash
89
+ uv pip install -e ".[docs]"
90
+ zensical serve
91
+ ```
92
+
93
+ <div align="center">
94
+ <a href="https://github.com/maxludden/maxludden" style="text-decoration:none; color:inherit;">
95
+ <p>Designed by Max Ludden</p>
96
+ </a>
97
+ <br />
98
+ <a href="https://github.com/maxludden/maxludden" style="text-decoration:none; color:inherit;">
99
+ <img
100
+ src="docs/img/MaxLogo.svg"
101
+ alt="Max Ludden's Logo"
102
+ width="20%"
103
+ />
104
+ </a>
105
+ </div>
@@ -0,0 +1,80 @@
1
+ # rich-gradient-cli
2
+
3
+ `gradient` is a single-command CLI for [`rich-gradient`](https://github.com/maxludden/rich-gradient), modeled on [`rich-cli`](https://github.com/Textualize/rich-cli): point it at a file, a URL, `-` for stdin, or literal text and it renders the result with a gradient.
4
+
5
+ ```text
6
+ gradient [OPTIONS] [PATH,TEXT,URL, or '-']
7
+ ```
8
+
9
+ ## Installation
10
+
11
+ ```shell
12
+ uv tool install rich-gradient-cli # or: pip install rich-gradient-cli
13
+ ```
14
+
15
+ Or with [Homebrew](https://brew.sh):
16
+
17
+ ```shell
18
+ brew install maxludden/tap/rich-gradient-cli
19
+ ```
20
+
21
+ Requires Python 3.11+.
22
+
23
+ ## Usage
24
+
25
+ The renderable is chosen from the file extension (`.md`, `.rst`, `.ipynb`, `.json`, `.csv`/`.tsv`, source code) or by a mode flag, exactly like `rich-cli`. Literal text and stdin are printed as gradient text.
26
+
27
+ ```bash
28
+ gradient --colors 'red,#ff9900,#ffff00' "Gradient text that runs red, orange, yellow!"
29
+ gradient README.md # Markdown, auto-detected
30
+ gradient pyproject.toml -n -g # syntax with line numbers and guides
31
+ gradient data.csv --colors cyan,magenta # table
32
+ gradient notebook.ipynb # Jupyter notebook
33
+ cat doc.rst | gradient - --rst # reStructuredText from stdin
34
+ gradient https://example.com/page.md # URL
35
+ gradient "Title" --rule --colors blue,cyan
36
+ gradient "Heads up" --panel rounded --title Notice
37
+ gradient str --inspect # inspect a Python object
38
+ gradient --spectrum --hues 7
39
+ gradient --tree src # directory tree
40
+ gradient README.md --export-svg out.svg # also: -o out.html, --pager
41
+ ```
42
+
43
+ ![Gradient text](docs/img/commands/text-example.svg)
44
+
45
+ ### Options at a glance
46
+
47
+ Shared flags keep their `rich-cli` spelling (`-p --print`, `-u --rule`, `-m --markdown`, `-J --json`, `-a --panel BOX`, `-d --padding`, `-s --style`, `-S --panel-style`, `-l/-c/-r` block alignment, `-L/-C/-R/-F` text justify, `-w/-W` width, `-h/-t` head/tail, `-n -g -x -y -j`, `-o --export-html`, `--export-svg`, `--pager`, `-v --version`). Gradient-specific options are long-only: `--colors`, `--bgcolors`, `--rainbow`, `--hues`, `--repeat-scale`, `--highlight-word`, `--highlight-regex`, `--animate`, `--duration`.
48
+
49
+ See [docs/options.md](docs/options.md) or run `gradient --help` for the grouped list.
50
+
51
+ ### From `0.3` subcommands
52
+
53
+ Versions up to 0.3 used subcommands (`gradient print`, `gradient panel`, `gradient view`, ...). They were replaced by flags on the one command; see the [CHANGELOG](CHANGELOG.md) for the mapping.
54
+
55
+ ### Telemetry
56
+
57
+ Anonymous usage telemetry is **off by default**. `gradient --telemetry enable|disable|status` manages it; when enabled and `AMPLITUDE_API_KEY` is set, a `Command Run` event with the render mode and a random install ID is sent after a command succeeds.
58
+
59
+ ## Docs
60
+
61
+ Build and preview the documentation locally with [Zensical](https://zensical.org):
62
+
63
+ ```bash
64
+ uv pip install -e ".[docs]"
65
+ zensical serve
66
+ ```
67
+
68
+ <div align="center">
69
+ <a href="https://github.com/maxludden/maxludden" style="text-decoration:none; color:inherit;">
70
+ <p>Designed by Max Ludden</p>
71
+ </a>
72
+ <br />
73
+ <a href="https://github.com/maxludden/maxludden" style="text-decoration:none; color:inherit;">
74
+ <img
75
+ src="docs/img/MaxLogo.svg"
76
+ alt="Max Ludden's Logo"
77
+ width="20%"
78
+ />
79
+ </a>
80
+ </div>
@@ -1,14 +1,18 @@
1
1
  [project]
2
2
  name = "rich-gradient-cli"
3
- version = "0.3.0"
4
- description = "CLI for printing text in gradient color using the rich-gradient library."
3
+ version = "0.4.0"
4
+ description = "Render files, URLs, stdin, and text with rich-gradient from the command line."
5
5
  readme = "README.md"
6
- requires-python = ">=3.10"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.11"
7
9
  dependencies = [
8
10
  "typer>=0.21.1",
9
- "rich>=14.3.2",
10
- "rich-color-ext>=0.1.9",
11
- "rich-gradient>=0.3.9",
11
+ "rich>=15.0.0",
12
+ "rich-color-ext>=3.0.0",
13
+ "rich-gradient>=0.4.1",
14
+ "amplitude-analytics>=1.3.0",
15
+ "rich-rst>=2.2.0",
12
16
  ]
13
17
 
14
18
  [[project.authors]]
@@ -22,9 +26,9 @@ dev = [
22
26
  "ruff>=0.15.0",
23
27
  ]
24
28
  docs = [
25
- "mkdocstrings>=1.0.8; python_version >= '3.11'",
26
- "mkdocstrings-python>=2.0.2; python_version >= '3.11'",
27
- "zensical>=0.0.68; python_version >= '3.11'",
29
+ "mkdocstrings>=1.0.8",
30
+ "mkdocstrings-python>=2.0.2",
31
+ "zensical>=0.0.68",
28
32
  ]
29
33
 
30
34
  [project.scripts]
@@ -34,22 +38,18 @@ gradient = "rich_gradient_cli:entrypoint"
34
38
  requires = ["uv_build>=0.10.0,<0.11.0"]
35
39
  build-backend = "uv_build"
36
40
 
41
+ [tool.pytest.ini_options]
42
+ testpaths = ["tests"]
43
+
37
44
  [tool.mypy]
38
- python_version = "3.10"
39
- mypy_path = "typings"
40
- files = [
41
- "src",
42
- "typings",
43
- ]
45
+ python_version = "3.11"
46
+ files = ["src"]
44
47
  ignore_missing_imports = true
45
48
  check_untyped_defs = true
46
49
 
47
50
  [tool.ruff]
48
- target-version = "py310"
49
- src = [
50
- "src",
51
- "typings",
52
- ]
51
+ target-version = "py311"
52
+ src = ["src"]
53
53
 
54
54
  [tool.pylint.messages_control]
55
55
  disable = [
@@ -57,3 +57,6 @@ disable = [
57
57
  "unused-argument",
58
58
  "W0613",
59
59
  ]
60
+
61
+ [dependency-groups]
62
+ dev = ["pytest>=9.0.2"]
@@ -1,17 +1,21 @@
1
1
  [project]
2
2
  name = "rich-gradient-cli"
3
- version = "0.3.0"
4
- description = "CLI for printing text in gradient color using the rich-gradient library."
3
+ version = "0.4.0"
4
+ description = "Render files, URLs, stdin, and text with rich-gradient from the command line."
5
5
  readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
6
8
  authors = [
7
9
  { name = "Maxwell Ludden", email = "maxludden@me.com" }
8
10
  ]
9
- requires-python = ">=3.10"
11
+ requires-python = ">=3.11"
10
12
  dependencies = [
11
13
  "typer>=0.21.1",
12
- "rich>=14.3.2",
13
- "rich-color-ext>=0.1.9",
14
- "rich-gradient>=0.3.9",
14
+ "rich>=15.0.0",
15
+ "rich-color-ext>=3.0.0",
16
+ "rich-gradient>=0.4.1",
17
+ "amplitude-analytics>=1.3.0",
18
+ "rich-rst>=2.2.0",
15
19
  ]
16
20
 
17
21
  [project.optional-dependencies]
@@ -20,11 +24,10 @@ dev = [
20
24
  "pytest>=8.4.2",
21
25
  "ruff>=0.15.0",
22
26
  ]
23
- # Docs tooling (mkdocstrings>=1.0.8, zensical) requires Python >= 3.11; on 3.10 this extra installs nothing.
24
27
  docs = [
25
- "mkdocstrings>=1.0.8; python_version >= '3.11'",
26
- "mkdocstrings-python>=2.0.2; python_version >= '3.11'",
27
- "zensical>=0.0.68; python_version >= '3.11'",
28
+ "mkdocstrings>=1.0.8",
29
+ "mkdocstrings-python>=2.0.2",
30
+ "zensical>=0.0.68",
28
31
  ]
29
32
 
30
33
  [project.scripts]
@@ -34,16 +37,18 @@ gradient = "rich_gradient_cli:entrypoint"
34
37
  requires = ["uv_build>=0.10.0,<0.11.0"]
35
38
  build-backend = "uv_build"
36
39
 
40
+ [tool.pytest.ini_options]
41
+ testpaths = ["tests"]
42
+
37
43
  [tool.mypy]
38
- python_version = "3.10"
39
- mypy_path = "typings"
40
- files = ["src", "typings"]
44
+ python_version = "3.11"
45
+ files = ["src"]
41
46
  ignore_missing_imports = true
42
47
  check_untyped_defs = true
43
48
 
44
49
  [tool.ruff]
45
- target-version = "py310"
46
- src = ["src", "typings"]
50
+ target-version = "py311"
51
+ src = ["src"]
47
52
 
48
53
  [tool.pylint.messages_control]
49
54
  disable = [
@@ -51,3 +56,8 @@ disable = [
51
56
  "unused-argument",
52
57
  "W0613"
53
58
  ]
59
+
60
+ [dependency-groups]
61
+ dev = [
62
+ "pytest>=9.0.2",
63
+ ]
@@ -0,0 +1,36 @@
1
+ """rich-gradient-cli: render text, files, URLs, and stdin with rich-gradient.
2
+
3
+ The package exposes a single Typer application, :data:`app`, installed as the
4
+ ``gradient`` console script.
5
+ """
6
+
7
+ import sys
8
+
9
+ from . import cli
10
+ from .cli import VERSION, app
11
+ from .telemetry import track_command
12
+
13
+
14
+ def entrypoint() -> None:
15
+ """Console-script entry point for ``gradient``.
16
+
17
+ Runs the app, then sends the opt-in telemetry event only when the command
18
+ completed successfully (not for ``--help``, ``--telemetry`` or usage errors).
19
+ """
20
+ try:
21
+ app()
22
+ except SystemExit as exc:
23
+ if exc.code in (0, None):
24
+ _track_success()
25
+ raise
26
+ _track_success()
27
+
28
+
29
+ def _track_success() -> None:
30
+ """Send the render-mode telemetry event for a command that completed normally."""
31
+ if cli.invoked_mode and "--help" not in sys.argv[1:]:
32
+ track_command(cli.invoked_mode)
33
+
34
+
35
+ __version__ = VERSION
36
+ __all__ = ["VERSION", "app", "entrypoint"]