zerottmm 0.1.0__py3-none-any.whl
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.
- zerottmm/__init__.py +38 -0
- zerottmm/ai_analysis.py +149 -0
- zerottmm/cli.py +212 -0
- zerottmm/gitingest.py +219 -0
- zerottmm/gitutils.py +117 -0
- zerottmm/index.py +160 -0
- zerottmm/metrics.py +66 -0
- zerottmm/search.py +121 -0
- zerottmm/store.py +380 -0
- zerottmm/trace.py +178 -0
- zerottmm-0.1.0.dist-info/METADATA +176 -0
- zerottmm-0.1.0.dist-info/RECORD +15 -0
- zerottmm-0.1.0.dist-info/WHEEL +5 -0
- zerottmm-0.1.0.dist-info/entry_points.txt +2 -0
- zerottmm-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,176 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: zerottmm
|
3
|
+
Version: 0.1.0
|
4
|
+
Summary: Time‑to‑Mental‑Model: a local‑first code reading assistant (Phase A)
|
5
|
+
Author-email: Gaurav Sood <contact@gsood.com>
|
6
|
+
License-Expression: MIT
|
7
|
+
Keywords: code-analysis,static-analysis,code-reading,python,ast
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
9
|
+
Classifier: Intended Audience :: Developers
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
15
|
+
Classifier: Topic :: Software Development :: Code Generators
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
17
|
+
Classifier: Topic :: Utilities
|
18
|
+
Requires-Python: >=3.10
|
19
|
+
Description-Content-Type: text/markdown
|
20
|
+
Provides-Extra: ui
|
21
|
+
Requires-Dist: streamlit>=1.23; extra == "ui"
|
22
|
+
Requires-Dist: openai>=1.0.0; extra == "ui"
|
23
|
+
Provides-Extra: test
|
24
|
+
Requires-Dist: pytest; extra == "test"
|
25
|
+
Provides-Extra: ai
|
26
|
+
Requires-Dist: openai>=1.0.0; extra == "ai"
|
27
|
+
Provides-Extra: all
|
28
|
+
Requires-Dist: streamlit>=1.23; extra == "all"
|
29
|
+
Requires-Dist: pytest; extra == "all"
|
30
|
+
Requires-Dist: openai>=1.0.0; extra == "all"
|
31
|
+
|
32
|
+
# ttmm: Time‑to‑Mental‑Model
|
33
|
+
|
34
|
+
`ttmm` is a local‑first code reading assistant designed to reduce the time it takes to load a mental model of a codebase. It provides static indexing, simple call graph navigation, hotspot detection and dynamic tracing. You can use it either from the command line or through a Streamlit web UI.
|
35
|
+
|
36
|
+
**New**: `ttmm` now supports remote repositories via Git URLs and GitIngest integration, making it easy to analyze any public Python repository without cloning manually.
|
37
|
+
|
38
|
+
## Key features (Phase A)
|
39
|
+
|
40
|
+
* **Index your repository** – builds a lightweight SQLite database of all Python functions/methods, their definitions, references and coarse call edges using only the standard library.
|
41
|
+
* **Remote repository support** – analyze any GitHub, GitLab, or Bitbucket repository directly via URL or GitIngest links without manual cloning.
|
42
|
+
* **Hotspot detection** – computes a hotspot score by combining cyclomatic complexity and recent git churn to help you prioritise where to read first.
|
43
|
+
* **Static call graph navigation** – shows callers and callees for any symbol using conservative AST analysis. Attribute calls that cannot be resolved are marked as `<unresolved>`.
|
44
|
+
* **Keyword search** – a tiny TF‑IDF engine lets you ask a natural language question and returns a minimal reading set of relevant symbols.
|
45
|
+
* **Dynamic tracing** – run a module, function or script with `sys.settrace` to capture the actual call sequence executed at runtime and persist it in the database.
|
46
|
+
|
47
|
+
## Installation
|
48
|
+
|
49
|
+
Requirements:
|
50
|
+
|
51
|
+
* Python 3.8 or later (except 3.9.7 due to Streamlit compatibility)
|
52
|
+
* A `git` executable in your `PATH` if you want churn‑based hotspot scores
|
53
|
+
|
54
|
+
Install from PyPI:
|
55
|
+
|
56
|
+
```bash
|
57
|
+
pip install zerottmm
|
58
|
+
```
|
59
|
+
|
60
|
+
Or install in development mode from this repository:
|
61
|
+
|
62
|
+
```bash
|
63
|
+
pip install -e .
|
64
|
+
```
|
65
|
+
|
66
|
+
To enable optional extras:
|
67
|
+
|
68
|
+
* `[ui]` – install `streamlit` and `openai` for the web UI with AI features
|
69
|
+
* `[test]` – install `pytest` for running the test suite
|
70
|
+
* `[ai]` – install `openai` for AI-enhanced analysis
|
71
|
+
|
72
|
+
For example:
|
73
|
+
|
74
|
+
```bash
|
75
|
+
pip install zerottmm[ui,test]
|
76
|
+
```
|
77
|
+
|
78
|
+
## Command line usage
|
79
|
+
|
80
|
+
After installation a `zerottmm` command will be available:
|
81
|
+
|
82
|
+
```bash
|
83
|
+
zerottmm index PATH_OR_URL # index a Python repository (local or remote)
|
84
|
+
zerottmm hotspots PATH # show the top hotspots (default 10)
|
85
|
+
zerottmm callers PATH SYMBOL
|
86
|
+
zerottmm callees PATH SYMBOL
|
87
|
+
zerottmm trace PATH [--module pkg.mod:func | --script file.py] [-- args...]
|
88
|
+
zerottmm answer PATH "your question"
|
89
|
+
```
|
90
|
+
|
91
|
+
* **PATH_OR_URL** – local repository path, Git URL, or GitIngest URL
|
92
|
+
* **PATH** – local repository path that has been indexed previously
|
93
|
+
* **SYMBOL** – a fully‑qualified name like `package.module:Class.method` or `package.module:function`.
|
94
|
+
* **--module** – run a function or module entry point (e.g. `package.module:main`) and trace calls within the repository.
|
95
|
+
* **--script** – run an arbitrary Python script in the repository and trace calls.
|
96
|
+
|
97
|
+
Use `zerottmm --help` for full documentation.
|
98
|
+
|
99
|
+
## Examples
|
100
|
+
|
101
|
+
Here are some examples analyzing popular Python repositories:
|
102
|
+
|
103
|
+
### Analyze the Python requests library
|
104
|
+
```bash
|
105
|
+
# Index directly from GitHub
|
106
|
+
zerottmm index https://github.com/psf/requests.git
|
107
|
+
|
108
|
+
# Find hotspots (complex functions with high churn)
|
109
|
+
zerottmm hotspots /tmp/ttmm_repo_*/
|
110
|
+
# Output: PreparedRequest.prepare_body, super_len, RequestEncodingMixin._encode_files
|
111
|
+
|
112
|
+
# Ask natural language questions
|
113
|
+
zerottmm answer /tmp/ttmm_repo_*/ "how to make HTTP requests"
|
114
|
+
# Output: HTTPAdapter.send, Session.request, HTTPAdapter.cert_verify
|
115
|
+
```
|
116
|
+
|
117
|
+
### Analyze a mathematical optimization library
|
118
|
+
```bash
|
119
|
+
# Index a specialized repo via GitIngest URL
|
120
|
+
zerottmm index "https://gitingest.com/?url=https://github.com/finite-sample/rank_preserving_calibration"
|
121
|
+
|
122
|
+
# Find the main algorithmic components
|
123
|
+
zerottmm answer /tmp/ttmm_repo_*/ "main calibration algorithm"
|
124
|
+
# Output: calibrate_dykstra, calibrate_admm, _isotonic_regression
|
125
|
+
|
126
|
+
# Explore function relationships
|
127
|
+
zerottmm callers /tmp/ttmm_repo_*/ "calibrate_dykstra"
|
128
|
+
# Shows all the places this core algorithm is used
|
129
|
+
```
|
130
|
+
|
131
|
+
### Analyze FastAPI core (subpath example)
|
132
|
+
```bash
|
133
|
+
# Index just the FastAPI core module using GitIngest subpath
|
134
|
+
zerottmm index "https://gitingest.com/?url=https://github.com/tiangolo/fastapi&subpath=fastapi"
|
135
|
+
|
136
|
+
# Find entry points and main interfaces
|
137
|
+
zerottmm answer /tmp/ttmm_repo_*/ "main application interface"
|
138
|
+
```
|
139
|
+
|
140
|
+
## Streamlit UI
|
141
|
+
|
142
|
+
A simple web UI is provided under `app/app.py`. To run it locally:
|
143
|
+
|
144
|
+
```bash
|
145
|
+
pip install -e .[ui]
|
146
|
+
streamlit run app/app.py
|
147
|
+
```
|
148
|
+
|
149
|
+
The app allows you to index repositories (local or remote via GitIngest), explore hotspots, get AI-powered insights, and search interactively. Features include:
|
150
|
+
|
151
|
+
* **Repository indexing** from local paths, Git URLs, or GitIngest links
|
152
|
+
* **Automatic repository summary** with key metrics and analysis
|
153
|
+
* **AI-enhanced analysis** with OpenAI integration (optional)
|
154
|
+
* **Hotspot detection** and complexity analysis
|
155
|
+
* **Natural language search** over code symbols
|
156
|
+
|
157
|
+
The app is designed to run on [Streamlit Community Cloud](https://streamlit.io/cloud) – simply push this repository to GitHub and deploy the app by pointing to `app/app.py`. The `requirements.txt` file ensures all dependencies (including OpenAI) are automatically installed.
|
158
|
+
|
159
|
+
## Development & tests
|
160
|
+
|
161
|
+
Tests live in `tests/test_ttmm.py` and cover indexing, hotspot scoring and search. To run them:
|
162
|
+
|
163
|
+
```bash
|
164
|
+
pip install -e .[test]
|
165
|
+
pytest -q
|
166
|
+
```
|
167
|
+
|
168
|
+
Continuous integration is configured via `.github/workflows/ci.yml` to run the test suite on Python 3.8 through 3.12. If you fork this repository on GitHub the workflow will execute automatically.
|
169
|
+
|
170
|
+
## Limitations
|
171
|
+
|
172
|
+
* Phase A supports Python only and uses conservative static analysis. Many dynamic method calls cannot be resolved statically; these appear as `<unresolved>` in the call graph.
|
173
|
+
* Hotspot scores require `git` to compute churn – if `git` is not installed or the directory is not a git repository, churn is assumed to be zero.
|
174
|
+
* Dynamic tracing only captures calls within the repository root. Calls to the standard library or external packages are ignored.
|
175
|
+
|
176
|
+
Future phases (not implemented here) would add richer language support, deeper type‑aware call resolution and integration with your editor.
|
@@ -0,0 +1,15 @@
|
|
1
|
+
zerottmm/__init__.py,sha256=kVasgoTJFcM2iIoN-BsYfDo0uHHEU59lVuBRPnKHUBI,1274
|
2
|
+
zerottmm/ai_analysis.py,sha256=WGe_YcPlykze182AMRylaCxvNduPDTroqtA3LjX7qwc,4773
|
3
|
+
zerottmm/cli.py,sha256=_X35_v6-eTvTVeEl5da59e_hfkLenoULwnGRRJe3xEw,7536
|
4
|
+
zerottmm/gitingest.py,sha256=7jGGk_LJbdcyjSEt9rghX8qnPjLhec9Rr4I6Odsv70I,6504
|
5
|
+
zerottmm/gitutils.py,sha256=3KFeRklnLoYBmH14BLC2YTjfJlv-r9Nl2CJilPnW3CQ,3810
|
6
|
+
zerottmm/index.py,sha256=5Th_7jOENhAMJbHG-7nAoDsfIsATmenPQxdmegDvAKg,6595
|
7
|
+
zerottmm/metrics.py,sha256=dmyk-qal3vH0O1JIb9x9D_sSeGzB9ii7A4K0E-wI86U,2115
|
8
|
+
zerottmm/search.py,sha256=PG3RV4z7c9PstkSgLLc3WGM70sKKTEo_PVak90TEwWk,4399
|
9
|
+
zerottmm/store.py,sha256=u_1CcRaIofXsvpAf4O8of5i5TkjjMiwIHY5NLqS85So,13198
|
10
|
+
zerottmm/trace.py,sha256=Nlw621J7_JpjEmJeu0KU05dB58LsbyiMO009zojUUo8,6691
|
11
|
+
zerottmm-0.1.0.dist-info/METADATA,sha256=FqKxiRGI2RWOay4kVTaQmLmaGlU0smxNb3q1dpDsXrc,7523
|
12
|
+
zerottmm-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
13
|
+
zerottmm-0.1.0.dist-info/entry_points.txt,sha256=SB5P12FcxrIQCaZbfpg9EvGqX4NM4ijWMVzUgLXNJjA,47
|
14
|
+
zerottmm-0.1.0.dist-info/top_level.txt,sha256=BNjiqDdE-_XlhpjAe8rlS3ocL53EG-nqaBmrxN2bCnQ,9
|
15
|
+
zerottmm-0.1.0.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
zerottmm
|