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.
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/CLAUDE.md +9 -6
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/Cargo.lock +1 -1
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/Cargo.toml +1 -1
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/PKG-INFO +117 -74
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/README.md +116 -73
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/RELEASE_NOTES.md +101 -0
- pretty_mod-0.2.1/python/pretty_mod/__main__.py +6 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/python/pretty_mod/_pretty_mod.pyi +7 -2
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/python/pretty_mod/cli.py +21 -2
- pretty_mod-0.2.1/src/config.rs +219 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/src/explorer.rs +10 -3
- pretty_mod-0.2.1/src/lib.rs +150 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/src/module_info.rs +80 -20
- pretty_mod-0.2.1/src/output_format.rs +121 -0
- pretty_mod-0.2.1/src/signature.rs +385 -0
- pretty_mod-0.2.1/src/stdlib.rs +35 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/src/tree_formatter.rs +63 -19
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/src/utils.rs +33 -38
- pretty_mod-0.2.1/tests/conftest.py +7 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/tests/test_cli.py +5 -21
- pretty_mod-0.2.1/tests/test_double_colon.py +19 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/tests/test_explorer.py +7 -8
- pretty_mod-0.2.1/tests/test_json_output.py +103 -0
- pretty_mod-0.1.2/src/lib.rs +0 -106
- pretty_mod-0.1.2/src/signature.rs +0 -150
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/.github/workflows/CI.yml +0 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/.github/workflows/tests.yml +0 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/.gitignore +0 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/.pre-commit-config.yaml +0 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/LICENSE +0 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/examples/0_hello.py +0 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/examples/1_tree.py +0 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/examples/2_sig.py +0 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/justfile +0 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/pyproject.toml +0 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/python/pretty_mod/__init__.py +0 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/python/pretty_mod/explorer.py +0 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/python/pretty_mod/py.typed +0 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/scripts/compare_local.py +0 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/scripts/compare_versions.py +0 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/scripts/perf_test.py +0 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/scripts/profile.py +0 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/src/package_downloader.rs +0 -0
- {pretty_mod-0.1.2 → pretty_mod-0.2.1}/tests/__init__.py +0 -0
- {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
|
-
|
5
|
+
## getting oriented
|
6
6
|
|
7
7
|
- read @RELEASE_NOTES.md, @README.md, @pyproject.toml, and @justfile
|
8
8
|
|
9
|
-
|
9
|
+
## run the tests
|
10
10
|
|
11
11
|
```
|
12
12
|
just test
|
13
13
|
```
|
14
14
|
|
15
|
-
if
|
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
|
-
|
21
|
+
## run the local python package
|
22
22
|
|
23
23
|
```
|
24
24
|
uv run pretty-mod tree fastapi.routing
|
25
25
|
```
|
26
26
|
|
27
|
-
|
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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: pretty-mod
|
3
|
-
Version: 0.1
|
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
|
-
> [!
|
16
|
-
>
|
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
|
-
»
|
37
|
-
📎
|
38
|
-
├──
|
39
|
-
├──
|
40
|
-
├──
|
41
|
-
├──
|
42
|
-
├──
|
43
|
-
├──
|
44
|
-
├──
|
45
|
-
├──
|
46
|
-
├──
|
47
|
-
├──
|
48
|
-
├──
|
49
|
-
├──
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
├──
|
56
|
-
├──
|
57
|
-
├──
|
58
|
-
├──
|
59
|
-
├──
|
60
|
-
|
61
|
-
|
62
|
-
├──
|
63
|
-
|
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
|
-
##
|
67
|
+
## installation
|
80
68
|
|
81
69
|
```bash
|
82
70
|
uv add pretty-mod
|
83
71
|
```
|
84
72
|
|
85
|
-
|
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
|
-
##
|
170
|
+
## customization
|
138
171
|
|
139
|
-
|
172
|
+
pretty-mod supports extensive customization through environment variables:
|
140
173
|
|
141
|
-
|
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
|
-
#
|
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
|
-
#
|
152
|
-
pretty-mod
|
153
|
-
pretty-mod
|
154
|
-
|
155
|
-
|
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
|
-
|
160
|
-
pretty-mod tree requests --quiet
|
186
|
+
### colors
|
161
187
|
|
162
|
-
|
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
|
-
|
167
|
-
|
168
|
-
pretty-mod tree
|
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
|
-
|
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
|
-
|
216
|
+
see the [`examples/`](examples/) directory for more detailed usage patterns and advanced features.
|
174
217
|
|
175
|
-
##
|
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
|
-
> [!
|
6
|
-
>
|
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
|
-
»
|
27
|
-
📎
|
28
|
-
├──
|
29
|
-
├──
|
30
|
-
├──
|
31
|
-
├──
|
32
|
-
├──
|
33
|
-
├──
|
34
|
-
├──
|
35
|
-
├──
|
36
|
-
├──
|
37
|
-
├──
|
38
|
-
├──
|
39
|
-
├──
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
├──
|
46
|
-
├──
|
47
|
-
├──
|
48
|
-
├──
|
49
|
-
├──
|
50
|
-
|
51
|
-
|
52
|
-
├──
|
53
|
-
|
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
|
-
##
|
57
|
+
## installation
|
70
58
|
|
71
59
|
```bash
|
72
60
|
uv add pretty-mod
|
73
61
|
```
|
74
62
|
|
75
|
-
|
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
|
-
##
|
160
|
+
## customization
|
128
161
|
|
129
|
-
|
162
|
+
pretty-mod supports extensive customization through environment variables:
|
130
163
|
|
131
|
-
|
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
|
-
#
|
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
|
-
#
|
142
|
-
pretty-mod
|
143
|
-
pretty-mod
|
144
|
-
|
145
|
-
|
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
|
-
|
150
|
-
pretty-mod tree requests --quiet
|
176
|
+
### colors
|
151
177
|
|
152
|
-
|
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
|
-
|
157
|
-
|
158
|
-
pretty-mod tree
|
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
|
-
|
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
|
-
|
206
|
+
see the [`examples/`](examples/) directory for more detailed usage patterns and advanced features.
|
164
207
|
|
165
|
-
##
|
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
|
@@ -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,
|
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(
|
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: ...
|