pretty-mod 0.1.2__tar.gz → 0.2.1__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 (45) hide show
  1. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/CLAUDE.md +9 -6
  2. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/Cargo.lock +1 -1
  3. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/Cargo.toml +1 -1
  4. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/PKG-INFO +117 -74
  5. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/README.md +116 -73
  6. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/RELEASE_NOTES.md +101 -0
  7. pretty_mod-0.2.1/python/pretty_mod/__main__.py +6 -0
  8. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/python/pretty_mod/_pretty_mod.pyi +7 -2
  9. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/python/pretty_mod/cli.py +21 -2
  10. pretty_mod-0.2.1/src/config.rs +219 -0
  11. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/src/explorer.rs +10 -3
  12. pretty_mod-0.2.1/src/lib.rs +150 -0
  13. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/src/module_info.rs +80 -20
  14. pretty_mod-0.2.1/src/output_format.rs +121 -0
  15. pretty_mod-0.2.1/src/signature.rs +385 -0
  16. pretty_mod-0.2.1/src/stdlib.rs +35 -0
  17. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/src/tree_formatter.rs +63 -19
  18. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/src/utils.rs +33 -38
  19. pretty_mod-0.2.1/tests/conftest.py +7 -0
  20. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/tests/test_cli.py +5 -21
  21. pretty_mod-0.2.1/tests/test_double_colon.py +19 -0
  22. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/tests/test_explorer.py +7 -8
  23. pretty_mod-0.2.1/tests/test_json_output.py +103 -0
  24. pretty_mod-0.1.2/src/lib.rs +0 -106
  25. pretty_mod-0.1.2/src/signature.rs +0 -150
  26. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/.github/workflows/CI.yml +0 -0
  27. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/.github/workflows/tests.yml +0 -0
  28. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/.gitignore +0 -0
  29. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/.pre-commit-config.yaml +0 -0
  30. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/LICENSE +0 -0
  31. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/examples/0_hello.py +0 -0
  32. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/examples/1_tree.py +0 -0
  33. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/examples/2_sig.py +0 -0
  34. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/justfile +0 -0
  35. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/pyproject.toml +0 -0
  36. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/python/pretty_mod/__init__.py +0 -0
  37. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/python/pretty_mod/explorer.py +0 -0
  38. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/python/pretty_mod/py.typed +0 -0
  39. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/scripts/compare_local.py +0 -0
  40. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/scripts/compare_versions.py +0 -0
  41. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/scripts/perf_test.py +0 -0
  42. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/scripts/profile.py +0 -0
  43. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/src/package_downloader.rs +0 -0
  44. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/tests/__init__.py +0 -0
  45. {pretty_mod-0.1.2 → pretty_mod-0.2.1}/uv.lock +0 -0
@@ -2,30 +2,33 @@
2
2
 
3
3
  `pretty-mod` is a python package built on pyo3 to explore python packages for LLMs
4
4
 
5
- # Getting oriented
5
+ ## getting oriented
6
6
 
7
7
  - read @RELEASE_NOTES.md, @README.md, @pyproject.toml, and @justfile
8
8
 
9
- # run the tests
9
+ ## run the tests
10
10
 
11
11
  ```
12
12
  just test
13
13
  ```
14
14
 
15
- if for some reason you need to only build (just test does this automatically)
15
+ if you only need to build (`just test` runs `just build` automatically)
16
16
 
17
17
  ```
18
18
  just build
19
19
  ```
20
20
 
21
- # run the local python package
21
+ ## run the local python package
22
22
 
23
23
  ```
24
24
  uv run pretty-mod tree fastapi.routing
25
25
  ```
26
26
 
27
- # run the remote python package
27
+ ## run the remote python package
28
28
 
29
29
  ```
30
30
  uvx pretty-mod tree fastapi.routing
31
- ```
31
+ ```
32
+
33
+ # IMPORTANT
34
+ - avoid breaking changes to the public api defined by type stubs in @python/pretty_mod/_pretty_mod.pyi
@@ -1017,7 +1017,7 @@ dependencies = [
1017
1017
 
1018
1018
  [[package]]
1019
1019
  name = "pretty-mod"
1020
- version = "0.1.2"
1020
+ version = "0.2.1"
1021
1021
  dependencies = [
1022
1022
  "flate2",
1023
1023
  "pyo3",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "pretty-mod"
3
- version = "0.1.2"
3
+ version = "0.2.1"
4
4
  edition = "2021"
5
5
 
6
6
  [lib]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pretty-mod
3
- Version: 0.1.2
3
+ Version: 0.2.1
4
4
  License-File: LICENSE
5
5
  Summary: A python module tree explorer for LLMs (and humans)
6
6
  Author-email: zzstoatzz <thrast36@gmail.com>
@@ -12,8 +12,9 @@ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
12
12
 
13
13
  a python module tree explorer for LLMs (and humans)
14
14
 
15
- > [!IMPORTANT]
16
- > for all versions `>=0.1.0`, wheels for different operating systems are built via `maturin` and published to pypi, install `<0.1.0` for a pure python version
15
+ > [!NOTE]
16
+ > - For all versions `>=0.1.0`, wheels for different operating systems are built via `maturin` and published to PyPI. Install `<0.1.0` for a pure Python version.
17
+ > - Starting from v0.2.0, output includes colors by default. Use `PRETTY_MOD_NO_COLOR=1` to disable.
17
18
 
18
19
  ```bash
19
20
  # Explore module structure
@@ -32,57 +33,89 @@ a python module tree explorer for LLMs (and humans)
32
33
  └── 📦 tool
33
34
  └── ⚡ functions: main
34
35
 
35
- # Inspect function signatures
36
- » uvx pretty-mod sig json:dumps
37
- 📎 dumps
38
- ├── Parameters:
39
- ├── obj
40
- ├── *
41
- ├── skipkeys=False
42
- ├── ensure_ascii=True
43
- ├── check_circular=True
44
- ├── allow_nan=True
45
- ├── cls=None
46
- ├── indent=None
47
- ├── separators=None
48
- ├── default=None
49
- ├── sort_keys=False
50
- └── **kw
51
-
52
- # Auto-download packages from PyPI (no install needed!)
53
- » uvx pretty-mod tree requests --quiet
54
- 📦 requests
55
- ├── 📜 __all__: delete, get, head, options, patch, post, put, request
56
- ├── ⚡ functions: check_compatibility, delete, get, head, options, patch, post, put, request
57
- ├── 🔷 classes: ConnectTimeout, ConnectionError, DependencyWarning, FileModeWarning, HTTPError, JSONDecodeError, NullHandler, PreparedRequest, ReadTimeout, Request, RequestException, RequestsDependencyWarning, Response, Session, Timeout, TooManyRedirects, URLRequired
58
- ├── 📌 constants: __author__, __author_email__, __build__, __cake__, __copyright__, __description__, __license__, __title__, __url__, codes
59
- ├── 📦 adapters
60
- ├── 🔷 classes: BaseAdapter, HTTPAdapter
61
- │ └── 📌 constants: DEFAULT_POOL_TIMEOUT, DEFAULT_POOLBLOCK, DEFAULT_POOLSIZE, DEFAULT_RETRIES
62
- ├── 📦 api
63
- └── ⚡ functions: delete, get, head, options, patch, post, put, request
64
- ├── 📦 auth
65
- │ └── 🔷 classes: AuthBase, HTTPBasicAuth, HTTPDigestAuth, HTTPProxyAuth
66
- ├── 📦 certs
67
- ├── 📦 compat
68
- ├── 📦 cookies
69
- ├── 📦 exceptions
70
- ├── 📦 help
71
- ├── 📦 hooks
72
- ├── 📦 models
73
- ├── 📦 sessions
74
- ├── 📦 status_codes
75
- ├── 📦 structures
76
- └── 📦 utils
36
+ # Inspect function signatures (even if the package is not installed)
37
+ » uv run pretty-mod sig fastmcp:FastMCP --quiet
38
+ 📎 FastMCP
39
+ ├── Parameters:
40
+ ├── self
41
+ ├── name: str | None=None
42
+ ├── instructions: str | None=None
43
+ ├── auth: OAuthProvider | None=None
44
+ ├── lifespan: Callable[[FastMCP[LifespanResultT]], AbstractAsyncContextManager[LifespanResultT]] | None=None
45
+ ├── tool_serializer: Callable[[Any], str] | None=None
46
+ ├── cache_expiration_seconds: float | None=None
47
+ ├── on_duplicate_tools: DuplicateBehavior | None=None
48
+ ├── on_duplicate_resources: DuplicateBehavior | None=None
49
+ ├── on_duplicate_prompts: DuplicateBehavior | None=None
50
+ ├── resource_prefix_format: Literal['protocol', 'path'] | None=None
51
+ ├── mask_error_details: bool | None=None
52
+ ├── tools: list[Tool | Callable[..., Any]] | None=None
53
+ ├── dependencies: list[str] | None=None
54
+ ├── include_tags: set[str] | None=None
55
+ ├── exclude_tags: set[str] | None=None
56
+ ├── log_level: str | None=None
57
+ ├── debug: bool | None=None
58
+ ├── host: str | None=None
59
+ ├── port: int | None=None
60
+ ├── sse_path: str | None=None
61
+ ├── message_path: str | None=None
62
+ ├── streamable_http_path: str | None=None
63
+ ├── json_response: bool | None=None
64
+ └── stateless_http: bool | None=None
77
65
  ```
78
66
 
79
- ## Installation
67
+ ## installation
80
68
 
81
69
  ```bash
82
70
  uv add pretty-mod
83
71
  ```
84
72
 
85
- ## Usage
73
+
74
+ ## cli
75
+
76
+ `pretty-mod` includes a command-line interface for shell-based exploration:
77
+
78
+ > [!IMPORTANT]
79
+ > all commands below can be run ephemerally with `uvx`, e.g. `uvx pretty-mod tree json`
80
+
81
+ ```bash
82
+ # Explore module structure
83
+ pretty-mod tree json
84
+
85
+ # Go deeper into the tree with --depth
86
+ pretty-mod tree requests --depth 3
87
+
88
+ # Display function signatures
89
+ pretty-mod sig json:loads
90
+
91
+ # Get JSON output for programmatic use
92
+ pretty-mod tree json -o json | jq '.tree.submodules | keys'
93
+ pretty-mod sig json:dumps -o json | jq '.parameters'
94
+ pretty-mod sig os.path:join
95
+
96
+ # Explore packages even without having them installed
97
+ pretty-mod tree django
98
+ pretty-mod tree flask --depth 1
99
+
100
+ # Use --quiet to suppress download messages
101
+ pretty-mod tree requests --quiet
102
+
103
+ # Version specifiers - explore specific versions
104
+ pretty-mod tree toml@0.10.2
105
+ pretty-mod sig toml@0.10.2:loads
106
+
107
+ # Submodules with version specifiers (correct syntax)
108
+ pretty-mod tree prefect.server@2.10.0 # ✅ Works
109
+ pretty-mod tree prefect@2.10.0.server # ❌ Invalid - version must come last
110
+
111
+ # Package name differs from module name
112
+ pretty-mod tree pydocket::docket # PyPI package 'pydocket' contains module 'docket'
113
+ pretty-mod tree pillow::PIL # PyPI package 'pillow' contains module 'PIL'
114
+ pretty-mod tree pillow::PIL@10.0.0 # Specific version of pillow
115
+ pretty-mod sig pillow::PIL.Image:open # Works with signatures too
116
+ ```
117
+
118
+ ## python sdk
86
119
 
87
120
  ```python
88
121
  from pretty_mod import display_tree
@@ -134,45 +167,55 @@ print(display_signature("json:loads"))
134
167
  ```
135
168
  </details>
136
169
 
137
- ## CLI
170
+ ## customization
138
171
 
139
- Pretty-mod includes a command-line interface for quick exploration:
172
+ pretty-mod supports extensive customization through environment variables:
140
173
 
141
- > [!IMPORTANT]
142
- > all commands below can be run ephemerally with `uvx`, e.g. `uvx pretty-mod tree json`
174
+ ### display characters
143
175
 
144
176
  ```bash
145
- # Explore module structure
146
- pretty-mod tree json
147
-
148
- # Go deeper into the tree with --depth
149
- pretty-mod tree requests --depth 3
177
+ # Use ASCII-only mode for terminals without Unicode support
178
+ PRETTY_MOD_ASCII=1 pretty-mod tree json
150
179
 
151
- # Display function signatures
152
- pretty-mod sig json:loads
153
- pretty-mod sig os.path:join
154
-
155
- # Explore packages even without having them installed
156
- pretty-mod tree django
157
- pretty-mod tree flask --depth 1
180
+ # Customize individual icons
181
+ PRETTY_MOD_MODULE_ICON="[M]" pretty-mod tree json
182
+ PRETTY_MOD_FUNCTION_ICON="fn" pretty-mod tree json
183
+ PRETTY_MOD_CLASS_ICON="cls" pretty-mod tree json
184
+ ```
158
185
 
159
- # Use --quiet to suppress download messages
160
- pretty-mod tree requests --quiet
186
+ ### colors
161
187
 
162
- # Version specifiers - explore specific versions
163
- pretty-mod tree toml@0.10.2
164
- pretty-mod sig toml@0.10.2:loads
188
+ pretty-mod uses an earth-tone color scheme by default:
165
189
 
166
- # Submodules with version specifiers (correct syntax)
167
- pretty-mod tree prefect.server@2.10.0 # ✅ Works
168
- pretty-mod tree prefect@2.10.0.server # ❌ Invalid - version must come last
190
+ ```bash
191
+ # Disable colors entirely
192
+ PRETTY_MOD_NO_COLOR=1 pretty-mod tree json
193
+ # or use the standard NO_COLOR environment variable
194
+ NO_COLOR=1 pretty-mod tree json
195
+
196
+ # Override specific colors with hex values
197
+ PRETTY_MOD_MODULE_COLOR="#FF6B6B" pretty-mod tree json
198
+ PRETTY_MOD_FUNCTION_COLOR="#4ECDC4" pretty-mod tree json
169
199
  ```
170
200
 
171
- ## Examples
201
+ available color environment variables:
202
+ - `PRETTY_MOD_MODULE_COLOR` - Modules/packages (default: #8B7355)
203
+ - `PRETTY_MOD_FUNCTION_COLOR` - Functions (default: #6B8E23)
204
+ - `PRETTY_MOD_CLASS_COLOR` - Classes (default: #4682B4)
205
+ - `PRETTY_MOD_CONSTANT_COLOR` - Constants (default: #BC8F8F)
206
+ - `PRETTY_MOD_EXPORTS_COLOR` - __all__ exports (default: #9370DB)
207
+ - `PRETTY_MOD_SIGNATURE_COLOR` - Signatures (default: #5F9EA0)
208
+ - `PRETTY_MOD_TREE_COLOR` - Tree structure lines (default: #696969)
209
+ - `PRETTY_MOD_PARAM_COLOR` - Parameter names (default: #708090)
210
+ - `PRETTY_MOD_TYPE_COLOR` - Type annotations (default: #778899)
211
+ - `PRETTY_MOD_DEFAULT_COLOR` - Default values (default: #8FBC8F)
212
+ - `PRETTY_MOD_WARNING_COLOR` - Warning messages (default: #DAA520)
213
+
214
+ ## examples
172
215
 
173
- See the [`examples/`](examples/) directory for more detailed usage patterns and advanced features.
216
+ see the [`examples/`](examples/) directory for more detailed usage patterns and advanced features.
174
217
 
175
- ## Development
218
+ ## development
176
219
 
177
220
  ```bash
178
221
  gh repo clone zzstoatzz/pretty-mod && cd pretty-mod
@@ -2,8 +2,9 @@
2
2
 
3
3
  a python module tree explorer for LLMs (and humans)
4
4
 
5
- > [!IMPORTANT]
6
- > for all versions `>=0.1.0`, wheels for different operating systems are built via `maturin` and published to pypi, install `<0.1.0` for a pure python version
5
+ > [!NOTE]
6
+ > - For all versions `>=0.1.0`, wheels for different operating systems are built via `maturin` and published to PyPI. Install `<0.1.0` for a pure Python version.
7
+ > - Starting from v0.2.0, output includes colors by default. Use `PRETTY_MOD_NO_COLOR=1` to disable.
7
8
 
8
9
  ```bash
9
10
  # Explore module structure
@@ -22,57 +23,89 @@ a python module tree explorer for LLMs (and humans)
22
23
  └── 📦 tool
23
24
  └── ⚡ functions: main
24
25
 
25
- # Inspect function signatures
26
- » uvx pretty-mod sig json:dumps
27
- 📎 dumps
28
- ├── Parameters:
29
- ├── obj
30
- ├── *
31
- ├── skipkeys=False
32
- ├── ensure_ascii=True
33
- ├── check_circular=True
34
- ├── allow_nan=True
35
- ├── cls=None
36
- ├── indent=None
37
- ├── separators=None
38
- ├── default=None
39
- ├── sort_keys=False
40
- └── **kw
41
-
42
- # Auto-download packages from PyPI (no install needed!)
43
- » uvx pretty-mod tree requests --quiet
44
- 📦 requests
45
- ├── 📜 __all__: delete, get, head, options, patch, post, put, request
46
- ├── ⚡ functions: check_compatibility, delete, get, head, options, patch, post, put, request
47
- ├── 🔷 classes: ConnectTimeout, ConnectionError, DependencyWarning, FileModeWarning, HTTPError, JSONDecodeError, NullHandler, PreparedRequest, ReadTimeout, Request, RequestException, RequestsDependencyWarning, Response, Session, Timeout, TooManyRedirects, URLRequired
48
- ├── 📌 constants: __author__, __author_email__, __build__, __cake__, __copyright__, __description__, __license__, __title__, __url__, codes
49
- ├── 📦 adapters
50
- ├── 🔷 classes: BaseAdapter, HTTPAdapter
51
- │ └── 📌 constants: DEFAULT_POOL_TIMEOUT, DEFAULT_POOLBLOCK, DEFAULT_POOLSIZE, DEFAULT_RETRIES
52
- ├── 📦 api
53
- └── ⚡ functions: delete, get, head, options, patch, post, put, request
54
- ├── 📦 auth
55
- │ └── 🔷 classes: AuthBase, HTTPBasicAuth, HTTPDigestAuth, HTTPProxyAuth
56
- ├── 📦 certs
57
- ├── 📦 compat
58
- ├── 📦 cookies
59
- ├── 📦 exceptions
60
- ├── 📦 help
61
- ├── 📦 hooks
62
- ├── 📦 models
63
- ├── 📦 sessions
64
- ├── 📦 status_codes
65
- ├── 📦 structures
66
- └── 📦 utils
26
+ # Inspect function signatures (even if the package is not installed)
27
+ » uv run pretty-mod sig fastmcp:FastMCP --quiet
28
+ 📎 FastMCP
29
+ ├── Parameters:
30
+ ├── self
31
+ ├── name: str | None=None
32
+ ├── instructions: str | None=None
33
+ ├── auth: OAuthProvider | None=None
34
+ ├── lifespan: Callable[[FastMCP[LifespanResultT]], AbstractAsyncContextManager[LifespanResultT]] | None=None
35
+ ├── tool_serializer: Callable[[Any], str] | None=None
36
+ ├── cache_expiration_seconds: float | None=None
37
+ ├── on_duplicate_tools: DuplicateBehavior | None=None
38
+ ├── on_duplicate_resources: DuplicateBehavior | None=None
39
+ ├── on_duplicate_prompts: DuplicateBehavior | None=None
40
+ ├── resource_prefix_format: Literal['protocol', 'path'] | None=None
41
+ ├── mask_error_details: bool | None=None
42
+ ├── tools: list[Tool | Callable[..., Any]] | None=None
43
+ ├── dependencies: list[str] | None=None
44
+ ├── include_tags: set[str] | None=None
45
+ ├── exclude_tags: set[str] | None=None
46
+ ├── log_level: str | None=None
47
+ ├── debug: bool | None=None
48
+ ├── host: str | None=None
49
+ ├── port: int | None=None
50
+ ├── sse_path: str | None=None
51
+ ├── message_path: str | None=None
52
+ ├── streamable_http_path: str | None=None
53
+ ├── json_response: bool | None=None
54
+ └── stateless_http: bool | None=None
67
55
  ```
68
56
 
69
- ## Installation
57
+ ## installation
70
58
 
71
59
  ```bash
72
60
  uv add pretty-mod
73
61
  ```
74
62
 
75
- ## Usage
63
+
64
+ ## cli
65
+
66
+ `pretty-mod` includes a command-line interface for shell-based exploration:
67
+
68
+ > [!IMPORTANT]
69
+ > all commands below can be run ephemerally with `uvx`, e.g. `uvx pretty-mod tree json`
70
+
71
+ ```bash
72
+ # Explore module structure
73
+ pretty-mod tree json
74
+
75
+ # Go deeper into the tree with --depth
76
+ pretty-mod tree requests --depth 3
77
+
78
+ # Display function signatures
79
+ pretty-mod sig json:loads
80
+
81
+ # Get JSON output for programmatic use
82
+ pretty-mod tree json -o json | jq '.tree.submodules | keys'
83
+ pretty-mod sig json:dumps -o json | jq '.parameters'
84
+ pretty-mod sig os.path:join
85
+
86
+ # Explore packages even without having them installed
87
+ pretty-mod tree django
88
+ pretty-mod tree flask --depth 1
89
+
90
+ # Use --quiet to suppress download messages
91
+ pretty-mod tree requests --quiet
92
+
93
+ # Version specifiers - explore specific versions
94
+ pretty-mod tree toml@0.10.2
95
+ pretty-mod sig toml@0.10.2:loads
96
+
97
+ # Submodules with version specifiers (correct syntax)
98
+ pretty-mod tree prefect.server@2.10.0 # ✅ Works
99
+ pretty-mod tree prefect@2.10.0.server # ❌ Invalid - version must come last
100
+
101
+ # Package name differs from module name
102
+ pretty-mod tree pydocket::docket # PyPI package 'pydocket' contains module 'docket'
103
+ pretty-mod tree pillow::PIL # PyPI package 'pillow' contains module 'PIL'
104
+ pretty-mod tree pillow::PIL@10.0.0 # Specific version of pillow
105
+ pretty-mod sig pillow::PIL.Image:open # Works with signatures too
106
+ ```
107
+
108
+ ## python sdk
76
109
 
77
110
  ```python
78
111
  from pretty_mod import display_tree
@@ -124,45 +157,55 @@ print(display_signature("json:loads"))
124
157
  ```
125
158
  </details>
126
159
 
127
- ## CLI
160
+ ## customization
128
161
 
129
- Pretty-mod includes a command-line interface for quick exploration:
162
+ pretty-mod supports extensive customization through environment variables:
130
163
 
131
- > [!IMPORTANT]
132
- > all commands below can be run ephemerally with `uvx`, e.g. `uvx pretty-mod tree json`
164
+ ### display characters
133
165
 
134
166
  ```bash
135
- # Explore module structure
136
- pretty-mod tree json
137
-
138
- # Go deeper into the tree with --depth
139
- pretty-mod tree requests --depth 3
167
+ # Use ASCII-only mode for terminals without Unicode support
168
+ PRETTY_MOD_ASCII=1 pretty-mod tree json
140
169
 
141
- # Display function signatures
142
- pretty-mod sig json:loads
143
- pretty-mod sig os.path:join
144
-
145
- # Explore packages even without having them installed
146
- pretty-mod tree django
147
- pretty-mod tree flask --depth 1
170
+ # Customize individual icons
171
+ PRETTY_MOD_MODULE_ICON="[M]" pretty-mod tree json
172
+ PRETTY_MOD_FUNCTION_ICON="fn" pretty-mod tree json
173
+ PRETTY_MOD_CLASS_ICON="cls" pretty-mod tree json
174
+ ```
148
175
 
149
- # Use --quiet to suppress download messages
150
- pretty-mod tree requests --quiet
176
+ ### colors
151
177
 
152
- # Version specifiers - explore specific versions
153
- pretty-mod tree toml@0.10.2
154
- pretty-mod sig toml@0.10.2:loads
178
+ pretty-mod uses an earth-tone color scheme by default:
155
179
 
156
- # Submodules with version specifiers (correct syntax)
157
- pretty-mod tree prefect.server@2.10.0 # ✅ Works
158
- pretty-mod tree prefect@2.10.0.server # ❌ Invalid - version must come last
180
+ ```bash
181
+ # Disable colors entirely
182
+ PRETTY_MOD_NO_COLOR=1 pretty-mod tree json
183
+ # or use the standard NO_COLOR environment variable
184
+ NO_COLOR=1 pretty-mod tree json
185
+
186
+ # Override specific colors with hex values
187
+ PRETTY_MOD_MODULE_COLOR="#FF6B6B" pretty-mod tree json
188
+ PRETTY_MOD_FUNCTION_COLOR="#4ECDC4" pretty-mod tree json
159
189
  ```
160
190
 
161
- ## Examples
191
+ available color environment variables:
192
+ - `PRETTY_MOD_MODULE_COLOR` - Modules/packages (default: #8B7355)
193
+ - `PRETTY_MOD_FUNCTION_COLOR` - Functions (default: #6B8E23)
194
+ - `PRETTY_MOD_CLASS_COLOR` - Classes (default: #4682B4)
195
+ - `PRETTY_MOD_CONSTANT_COLOR` - Constants (default: #BC8F8F)
196
+ - `PRETTY_MOD_EXPORTS_COLOR` - __all__ exports (default: #9370DB)
197
+ - `PRETTY_MOD_SIGNATURE_COLOR` - Signatures (default: #5F9EA0)
198
+ - `PRETTY_MOD_TREE_COLOR` - Tree structure lines (default: #696969)
199
+ - `PRETTY_MOD_PARAM_COLOR` - Parameter names (default: #708090)
200
+ - `PRETTY_MOD_TYPE_COLOR` - Type annotations (default: #778899)
201
+ - `PRETTY_MOD_DEFAULT_COLOR` - Default values (default: #8FBC8F)
202
+ - `PRETTY_MOD_WARNING_COLOR` - Warning messages (default: #DAA520)
203
+
204
+ ## examples
162
205
 
163
- See the [`examples/`](examples/) directory for more detailed usage patterns and advanced features.
206
+ see the [`examples/`](examples/) directory for more detailed usage patterns and advanced features.
164
207
 
165
- ## Development
208
+ ## development
166
209
 
167
210
  ```bash
168
211
  gh repo clone zzstoatzz/pretty-mod && cd pretty-mod
@@ -1,3 +1,104 @@
1
+ # Release Notes - v0.2.1
2
+
3
+ ## 📊 JSON Output Support & Better Type Annotation Handling
4
+
5
+ This release adds machine-readable JSON output and fixes a critical bug with complex type annotations.
6
+
7
+ ### ✨ New Features
8
+
9
+ - **📊 JSON Output Support**: Export tree and signature data as JSON for programmatic use
10
+ - `pretty-mod tree json -o json` - Get module structure as JSON
11
+ - `pretty-mod sig json:dumps -o json` - Get function signature as JSON
12
+ - Perfect for piping to `jq` or other JSON processors
13
+ - Follows the Kubernetes pattern of `-o <format>` for output selection
14
+ - Example: `pretty-mod tree json -o json | jq '.tree.submodules | keys'`
15
+
16
+ ### 🏗️ Technical Improvements
17
+
18
+ - **Visitor Pattern**: Implemented output formatters using the Visitor pattern for extensibility
19
+ - Clean separation between data structure and formatting
20
+ - Easy to add new output formats in the future
21
+ - Type-safe implementation using Rust traits
22
+
23
+
24
+ ---
25
+
26
+ # Release Notes - v0.2.0
27
+
28
+ ## 🎨 Customizable Display & Colors + Enhanced Signature Support
29
+
30
+ This release introduces customizable display characters, color output, full type annotation support in signatures, and a new double-colon syntax for handling packages where the PyPI name differs from the module name.
31
+
32
+ ### 🚨 Breaking Changes
33
+ - **Color output by default**: Tree and signature displays now include ANSI color codes
34
+ - **Minor version bump**: Due to visual output changes, this is a minor version release
35
+
36
+ ### ✨ New Features
37
+
38
+ - **🔗 Double-colon syntax**: Handle packages where PyPI name differs from module name
39
+ - `pretty-mod tree pydocket::docket` - Download 'pydocket' package, explore 'docket' module
40
+ - `pretty-mod tree pillow::PIL` - Download 'pillow' package, explore 'PIL' module
41
+ - Works with version specifiers: `pretty-mod tree pillow::PIL@10.0.0`
42
+ - Works with signatures: `pretty-mod sig pillow::PIL.Image:open`
43
+
44
+ - **📝 Full Type Annotation Support**: Signatures now display complete type information
45
+ - Union types: `str | None`
46
+ - Generic types: `list[Tool | Callable[..., Any]]`
47
+ - Literal types: `Literal['protocol', 'path']`
48
+ - Complex nested types properly rendered from AST
49
+
50
+ - **🎨 Color Support**: Earth-tone/pastel color scheme
51
+ - Modules: Saddle brown (#8B7355)
52
+ - Functions: Olive drab (#6B8E23)
53
+ - Classes: Steel blue (#4682B4)
54
+ - Constants: Rosy brown (#BC8F8F)
55
+ - Warning messages: Goldenrod (#DAA520)
56
+ - And more subtle colors for parameters, types, and tree structures
57
+
58
+ - **🔧 Customizable Display Characters**: Configure via environment variables
59
+ - `PRETTY_MOD_MODULE_ICON`: Icon for modules (default: 📦)
60
+ - `PRETTY_MOD_FUNCTION_ICON`: Icon for functions (default: ⚡)
61
+ - `PRETTY_MOD_CLASS_ICON`: Icon for classes (default: 🔷)
62
+ - `PRETTY_MOD_CONSTANT_ICON`: Icon for constants (default: 📌)
63
+ - `PRETTY_MOD_EXPORTS_ICON`: Icon for __all__ exports (default: 📜)
64
+ - `PRETTY_MOD_SIGNATURE_ICON`: Icon for signatures (default: 📎)
65
+
66
+ - **🖥️ ASCII Mode**: For terminals without Unicode support
67
+ ```bash
68
+ PRETTY_MOD_ASCII=1 pretty-mod tree json
69
+ ```
70
+
71
+ - **🚫 Disable Colors**: For clean output or piping
72
+ ```bash
73
+ PRETTY_MOD_NO_COLOR=1 pretty-mod tree json
74
+ # or use the standard NO_COLOR environment variable
75
+ ```
76
+
77
+ - **🎯 Custom Colors**: Override any color with hex values
78
+ ```bash
79
+ PRETTY_MOD_MODULE_COLOR=#FF6B6B pretty-mod tree json
80
+ ```
81
+
82
+ ### 🏗️ Technical Improvements
83
+
84
+ - **Configuration system**: Centralized configuration module with environment variable support
85
+ - **Color rendering**: ANSI 24-bit true color support with automatic hex-to-RGB conversion
86
+ - **Consistent styling**: Both tree and signature displays use the same configuration system
87
+ - **Enhanced AST parsing**: Better handling of complex type annotations and expressions
88
+ - **Code organization**: Consolidated signature parsing logic for better maintainability
89
+
90
+ ### 🐛 Bug Fixes
91
+
92
+ - **Complex type annotations**: Fixed parameter splitting for nested generics
93
+ - Previously: `Callable[[Any], str]` would split incorrectly on the comma
94
+ - Now: Properly handles all nested brackets and quotes in type annotations
95
+ - Affects all complex types like `Dict[str, List[int]]`, `Literal['a', 'b']`, etc.
96
+ - **Stdlib module handling**: Built-in modules no longer trigger PyPI download attempts
97
+ - **Signature discovery**: Improved recursive search for symbols exported in `__all__`
98
+ - **Download messages**: Colored warning messages for better visibility
99
+
100
+ ---
101
+
1
102
  # Release Notes - v0.1.2
2
103
 
3
104
  ## 🔧 Code Quality Improvements
@@ -0,0 +1,6 @@
1
+ """Enable running pretty-mod as a module: python -m pretty_mod"""
2
+
3
+ from .cli import main
4
+
5
+ if __name__ == "__main__":
6
+ main()
@@ -14,7 +14,12 @@ class ModuleTreeExplorer:
14
14
  def get_tree_string(self) -> str: ...
15
15
 
16
16
  def display_tree(
17
- root_module_path: str, max_depth: int = 2, quiet: bool = False
17
+ root_module_path: str,
18
+ max_depth: int = 2,
19
+ quiet: bool = False,
20
+ format: str = "pretty",
18
21
  ) -> None: ...
19
- def display_signature(import_path: str, quiet: bool = False) -> str: ...
22
+ def display_signature(
23
+ import_path: str, quiet: bool = False, format: str = "pretty"
24
+ ) -> str: ...
20
25
  def import_object(import_path: str) -> Any: ...