django-orm-lens 1.0.2__tar.gz → 1.0.4__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.
- {django_orm_lens-1.0.2 → django_orm_lens-1.0.4}/PKG-INFO +193 -191
- {django_orm_lens-1.0.2 → django_orm_lens-1.0.4}/README.md +3 -1
- {django_orm_lens-1.0.2 → django_orm_lens-1.0.4}/django_orm_lens/__init__.py +1 -1
- {django_orm_lens-1.0.2 → django_orm_lens-1.0.4}/django_orm_lens/models.py +2 -0
- {django_orm_lens-1.0.2 → django_orm_lens-1.0.4}/django_orm_lens/parser.py +2 -0
- {django_orm_lens-1.0.2 → django_orm_lens-1.0.4}/django_orm_lens.egg-info/PKG-INFO +193 -191
- {django_orm_lens-1.0.2 → django_orm_lens-1.0.4}/pyproject.toml +1 -1
- {django_orm_lens-1.0.2 → django_orm_lens-1.0.4}/setup.cfg +4 -4
- {django_orm_lens-1.0.2 → django_orm_lens-1.0.4}/django_orm_lens/cli.py +0 -0
- {django_orm_lens-1.0.2 → django_orm_lens-1.0.4}/django_orm_lens/formatters.py +0 -0
- {django_orm_lens-1.0.2 → django_orm_lens-1.0.4}/django_orm_lens/mcp_server.py +0 -0
- {django_orm_lens-1.0.2 → django_orm_lens-1.0.4}/django_orm_lens/py.typed +0 -0
- {django_orm_lens-1.0.2 → django_orm_lens-1.0.4}/django_orm_lens.egg-info/SOURCES.txt +0 -0
- {django_orm_lens-1.0.2 → django_orm_lens-1.0.4}/django_orm_lens.egg-info/dependency_links.txt +0 -0
- {django_orm_lens-1.0.2 → django_orm_lens-1.0.4}/django_orm_lens.egg-info/entry_points.txt +0 -0
- {django_orm_lens-1.0.2 → django_orm_lens-1.0.4}/django_orm_lens.egg-info/requires.txt +0 -0
- {django_orm_lens-1.0.2 → django_orm_lens-1.0.4}/django_orm_lens.egg-info/top_level.txt +0 -0
|
@@ -1,191 +1,193 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: django-orm-lens
|
|
3
|
-
Version: 1.0.
|
|
4
|
-
Summary: Static analysis + MCP server for Django models. Sidebar tree, ER diagrams, and JSON output for terminals and AI coding agents.
|
|
5
|
-
Author: frowningdev
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/FROWNINGdev/django-orm-lens
|
|
8
|
-
Project-URL: Repository, https://github.com/FROWNINGdev/django-orm-lens
|
|
9
|
-
Project-URL: Bug Tracker, https://github.com/FROWNINGdev/django-orm-lens/issues
|
|
10
|
-
Project-URL: Changelog, https://github.com/FROWNINGdev/django-orm-lens/blob/main/CHANGELOG.md
|
|
11
|
-
Project-URL: VS Code Marketplace, https://marketplace.visualstudio.com/items?itemName=frowningdev.django-orm-lens
|
|
12
|
-
Keywords: django,orm,models,er-diagram,mermaid,mcp,ai-agents,cursor,aider,code-analysis,static-analysis
|
|
13
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
-
Classifier: Environment :: Console
|
|
15
|
-
Classifier: Framework :: Django
|
|
16
|
-
Classifier: Framework :: Django :: 4.0
|
|
17
|
-
Classifier: Framework :: Django :: 4.1
|
|
18
|
-
Classifier: Framework :: Django :: 4.2
|
|
19
|
-
Classifier: Framework :: Django :: 5.0
|
|
20
|
-
Classifier: Framework :: Django :: 5.1
|
|
21
|
-
Classifier: Intended Audience :: Developers
|
|
22
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
23
|
-
Classifier: Operating System :: OS Independent
|
|
24
|
-
Classifier: Programming Language :: Python
|
|
25
|
-
Classifier: Programming Language :: Python :: 3
|
|
26
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
27
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
28
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
29
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
30
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
31
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
32
|
-
Classifier: Topic :: Software Development :: Documentation
|
|
33
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
34
|
-
Classifier: Topic :: Utilities
|
|
35
|
-
Classifier: Typing :: Typed
|
|
36
|
-
Requires-Python: >=3.9
|
|
37
|
-
Description-Content-Type: text/markdown
|
|
38
|
-
Provides-Extra: mcp
|
|
39
|
-
Requires-Dist: mcp>=1.0; extra == "mcp"
|
|
40
|
-
Provides-Extra: dev
|
|
41
|
-
Requires-Dist: pytest>=8; extra == "dev"
|
|
42
|
-
Requires-Dist: ruff>=0.5; extra == "dev"
|
|
43
|
-
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
44
|
-
Requires-Dist: build>=1.2; extra == "dev"
|
|
45
|
-
Requires-Dist: twine>=5.1; extra == "dev"
|
|
46
|
-
|
|
47
|
-
# django-orm-lens
|
|
48
|
-
|
|
49
|
-
<!-- mcp-name: io.github.
|
|
50
|
-
|
|
51
|
-
**Static analysis + MCP server for Django models.** Terminal- and AI-agent-friendly.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
django-orm-lens scan -f
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
django-orm-lens
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
|
|
191
|
-
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: django-orm-lens
|
|
3
|
+
Version: 1.0.4
|
|
4
|
+
Summary: Static analysis + MCP server for Django models. Sidebar tree, ER diagrams, and JSON output for terminals and AI coding agents.
|
|
5
|
+
Author: frowningdev
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/FROWNINGdev/django-orm-lens
|
|
8
|
+
Project-URL: Repository, https://github.com/FROWNINGdev/django-orm-lens
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/FROWNINGdev/django-orm-lens/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/FROWNINGdev/django-orm-lens/blob/main/CHANGELOG.md
|
|
11
|
+
Project-URL: VS Code Marketplace, https://marketplace.visualstudio.com/items?itemName=frowningdev.django-orm-lens
|
|
12
|
+
Keywords: django,orm,models,er-diagram,mermaid,mcp,ai-agents,cursor,aider,code-analysis,static-analysis
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Framework :: Django
|
|
16
|
+
Classifier: Framework :: Django :: 4.0
|
|
17
|
+
Classifier: Framework :: Django :: 4.1
|
|
18
|
+
Classifier: Framework :: Django :: 4.2
|
|
19
|
+
Classifier: Framework :: Django :: 5.0
|
|
20
|
+
Classifier: Framework :: Django :: 5.1
|
|
21
|
+
Classifier: Intended Audience :: Developers
|
|
22
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
23
|
+
Classifier: Operating System :: OS Independent
|
|
24
|
+
Classifier: Programming Language :: Python
|
|
25
|
+
Classifier: Programming Language :: Python :: 3
|
|
26
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
29
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
30
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
31
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
32
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
33
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
34
|
+
Classifier: Topic :: Utilities
|
|
35
|
+
Classifier: Typing :: Typed
|
|
36
|
+
Requires-Python: >=3.9
|
|
37
|
+
Description-Content-Type: text/markdown
|
|
38
|
+
Provides-Extra: mcp
|
|
39
|
+
Requires-Dist: mcp>=1.0; extra == "mcp"
|
|
40
|
+
Provides-Extra: dev
|
|
41
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
42
|
+
Requires-Dist: ruff>=0.5; extra == "dev"
|
|
43
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
44
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
45
|
+
Requires-Dist: twine>=5.1; extra == "dev"
|
|
46
|
+
|
|
47
|
+
# django-orm-lens
|
|
48
|
+
|
|
49
|
+
<!-- mcp-name: io.github.FROWNINGdev/django-orm-lens -->
|
|
50
|
+
|
|
51
|
+
**Static analysis + MCP server for Django models.** Terminal- and AI-agent-friendly.
|
|
52
|
+
|
|
53
|
+
Listed in the official [MCP Registry](https://registry.modelcontextprotocol.io/servers/io.github.FROWNINGdev%2Fdjango-orm-lens) as `io.github.FROWNINGdev/django-orm-lens`.
|
|
54
|
+
|
|
55
|
+
Ships with a zero-dependency parser, a JSON/Markdown/table CLI, and an optional
|
|
56
|
+
MCP (Model Context Protocol) server so any AI coding agent — Cursor, Aider,
|
|
57
|
+
Continue, and any other MCP client — can navigate your Django schema without
|
|
58
|
+
importing Django or spinning up your app.
|
|
59
|
+
|
|
60
|
+
Companion to the [Django ORM Lens VS Code
|
|
61
|
+
extension](https://marketplace.visualstudio.com/items?itemName=frowningdev.django-orm-lens).
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Install
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Core CLI (zero third-party deps)
|
|
69
|
+
pip install django-orm-lens
|
|
70
|
+
|
|
71
|
+
# With the MCP server (adds the `mcp` package)
|
|
72
|
+
pip install "django-orm-lens[mcp]"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Requires Python **3.9+**. Works on Linux, macOS, and Windows.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## CLI usage
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Scan a Django project for models (JSON, Markdown, or table)
|
|
83
|
+
django-orm-lens scan -f json
|
|
84
|
+
django-orm-lens scan -f markdown
|
|
85
|
+
django-orm-lens scan -f table
|
|
86
|
+
|
|
87
|
+
# Describe one model
|
|
88
|
+
django-orm-lens describe blog.Post
|
|
89
|
+
django-orm-lens describe Post -f json
|
|
90
|
+
|
|
91
|
+
# Compact hover card (great for pipeing into your editor)
|
|
92
|
+
django-orm-lens hover blog.Post
|
|
93
|
+
|
|
94
|
+
# Flat list — pipes into fzf, grep, etc.
|
|
95
|
+
django-orm-lens list | fzf
|
|
96
|
+
|
|
97
|
+
# Emit a Mermaid ER diagram
|
|
98
|
+
django-orm-lens er > schema.mmd
|
|
99
|
+
django-orm-lens er -o schema.mmd
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Every command accepts `--path <dir>` and repeatable `--exclude <glob>`. Defaults
|
|
103
|
+
skip `migrations/`, `venv/`, `.venv/`, `env/`, and `node_modules/`.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## MCP server — for AI coding agents
|
|
108
|
+
|
|
109
|
+
The MCP server exposes five read-only tools that any MCP-compatible agent can
|
|
110
|
+
call while it edits your Django project:
|
|
111
|
+
|
|
112
|
+
| Tool | Purpose |
|
|
113
|
+
| --- | --- |
|
|
114
|
+
| `list_apps` | Every Django app in the workspace with model counts |
|
|
115
|
+
| `list_models` | Flat `app.Model` list, optional app filter |
|
|
116
|
+
| `describe_model` | Full field / relation / Meta detail for one model |
|
|
117
|
+
| `find_relations` | Inbound + outbound relations for one model |
|
|
118
|
+
| `er_diagram` | Mermaid `erDiagram` string for the whole workspace |
|
|
119
|
+
|
|
120
|
+
### Start the server manually
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
django-orm-lens-mcp # dedicated entry point
|
|
124
|
+
# or
|
|
125
|
+
django-orm-lens mcp # subcommand
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
By default the server scans the current working directory. Override with
|
|
129
|
+
`DJANGO_ORM_LENS_ROOT=/abs/path/to/project`.
|
|
130
|
+
|
|
131
|
+
### Register it with an agent
|
|
132
|
+
|
|
133
|
+
**Cursor** — add to `~/.cursor/mcp.json`:
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"mcpServers": {
|
|
138
|
+
"django-orm-lens": {
|
|
139
|
+
"command": "django-orm-lens-mcp",
|
|
140
|
+
"env": { "DJANGO_ORM_LENS_ROOT": "/abs/path/to/your/project" }
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Aider / Continue.dev / Zed / any MCP client** — same shape, the tool is
|
|
147
|
+
generic. Point `command` at the installed `django-orm-lens-mcp` binary and set
|
|
148
|
+
the workspace root via env.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Why?
|
|
153
|
+
|
|
154
|
+
Django's ORM is Python, and Python is dynamic. AI agents that only see
|
|
155
|
+
`models.py` as raw text miss:
|
|
156
|
+
|
|
157
|
+
* which fields belong to which model;
|
|
158
|
+
* the direction and cardinality of every relation;
|
|
159
|
+
* what `Meta.ordering`, `unique_together`, and `constraints` actually contain;
|
|
160
|
+
* which app owns which model when the project uses split `models/` packages.
|
|
161
|
+
|
|
162
|
+
`django-orm-lens` gives them a **static, deterministic, JSON view** of the
|
|
163
|
+
schema — no Django boot, no database, no side effects. And you get a nice CLI
|
|
164
|
+
for humans too.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Programmatic API
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
from django_orm_lens import scan_workspace
|
|
172
|
+
|
|
173
|
+
index = scan_workspace(".")
|
|
174
|
+
for app in index.apps:
|
|
175
|
+
for model in app.models:
|
|
176
|
+
print(f"{app.name}.{model.name} — {len(model.fields)} fields")
|
|
177
|
+
|
|
178
|
+
# The full parsed tree serialises to the same JSON schema the VS Code
|
|
179
|
+
# extension emits, so tools can share it interchangeably.
|
|
180
|
+
import json
|
|
181
|
+
json.dumps(index.to_dict(), indent=2)
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Links
|
|
187
|
+
|
|
188
|
+
* Repo: <https://github.com/FROWNINGdev/django-orm-lens>
|
|
189
|
+
* Issues: <https://github.com/FROWNINGdev/django-orm-lens/issues>
|
|
190
|
+
* Changelog: <https://github.com/FROWNINGdev/django-orm-lens/blob/main/CHANGELOG.md>
|
|
191
|
+
* VS Code extension: <https://marketplace.visualstudio.com/items?itemName=frowningdev.django-orm-lens>
|
|
192
|
+
|
|
193
|
+
MIT licensed.
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
# django-orm-lens
|
|
2
2
|
|
|
3
|
-
<!-- mcp-name: io.github.
|
|
3
|
+
<!-- mcp-name: io.github.FROWNINGdev/django-orm-lens -->
|
|
4
4
|
|
|
5
5
|
**Static analysis + MCP server for Django models.** Terminal- and AI-agent-friendly.
|
|
6
6
|
|
|
7
|
+
Listed in the official [MCP Registry](https://registry.modelcontextprotocol.io/servers/io.github.FROWNINGdev%2Fdjango-orm-lens) as `io.github.FROWNINGdev/django-orm-lens`.
|
|
8
|
+
|
|
7
9
|
Ships with a zero-dependency parser, a JSON/Markdown/table CLI, and an optional
|
|
8
10
|
MCP (Model Context Protocol) server so any AI coding agent — Cursor, Aider,
|
|
9
11
|
Continue, and any other MCP client — can navigate your Django schema without
|
|
@@ -4,7 +4,7 @@ Terminal / editor-agnostic parser for Django models.py files.
|
|
|
4
4
|
Ships a CLI and an optional MCP server for AI coding agents.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
__version__ = "1.0.
|
|
7
|
+
__version__ = "1.0.4"
|
|
8
8
|
|
|
9
9
|
from .models import ParsedApp, ParsedField, ParsedModel, WorkspaceIndex
|
|
10
10
|
from .parser import parse_models_file, scan_workspace
|
|
@@ -258,6 +258,8 @@ def parse_models_file(file_path: str, content: str) -> List[ParsedModel]:
|
|
|
258
258
|
field.related_model = _extract_related(inner)
|
|
259
259
|
field.on_delete = _extract_on_delete(inner)
|
|
260
260
|
field.related_name = _extract_related_name(inner)
|
|
261
|
+
if ftype == "ManyToManyField":
|
|
262
|
+
field.through_model = _extract_through_model(inner)
|
|
261
263
|
model.fields.append(field)
|
|
262
264
|
j = end_idx + 1
|
|
263
265
|
continue
|
|
@@ -1,191 +1,193 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: django-orm-lens
|
|
3
|
-
Version: 1.0.
|
|
4
|
-
Summary: Static analysis + MCP server for Django models. Sidebar tree, ER diagrams, and JSON output for terminals and AI coding agents.
|
|
5
|
-
Author: frowningdev
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/FROWNINGdev/django-orm-lens
|
|
8
|
-
Project-URL: Repository, https://github.com/FROWNINGdev/django-orm-lens
|
|
9
|
-
Project-URL: Bug Tracker, https://github.com/FROWNINGdev/django-orm-lens/issues
|
|
10
|
-
Project-URL: Changelog, https://github.com/FROWNINGdev/django-orm-lens/blob/main/CHANGELOG.md
|
|
11
|
-
Project-URL: VS Code Marketplace, https://marketplace.visualstudio.com/items?itemName=frowningdev.django-orm-lens
|
|
12
|
-
Keywords: django,orm,models,er-diagram,mermaid,mcp,ai-agents,cursor,aider,code-analysis,static-analysis
|
|
13
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
-
Classifier: Environment :: Console
|
|
15
|
-
Classifier: Framework :: Django
|
|
16
|
-
Classifier: Framework :: Django :: 4.0
|
|
17
|
-
Classifier: Framework :: Django :: 4.1
|
|
18
|
-
Classifier: Framework :: Django :: 4.2
|
|
19
|
-
Classifier: Framework :: Django :: 5.0
|
|
20
|
-
Classifier: Framework :: Django :: 5.1
|
|
21
|
-
Classifier: Intended Audience :: Developers
|
|
22
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
23
|
-
Classifier: Operating System :: OS Independent
|
|
24
|
-
Classifier: Programming Language :: Python
|
|
25
|
-
Classifier: Programming Language :: Python :: 3
|
|
26
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
27
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
28
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
29
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
30
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
31
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
32
|
-
Classifier: Topic :: Software Development :: Documentation
|
|
33
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
34
|
-
Classifier: Topic :: Utilities
|
|
35
|
-
Classifier: Typing :: Typed
|
|
36
|
-
Requires-Python: >=3.9
|
|
37
|
-
Description-Content-Type: text/markdown
|
|
38
|
-
Provides-Extra: mcp
|
|
39
|
-
Requires-Dist: mcp>=1.0; extra == "mcp"
|
|
40
|
-
Provides-Extra: dev
|
|
41
|
-
Requires-Dist: pytest>=8; extra == "dev"
|
|
42
|
-
Requires-Dist: ruff>=0.5; extra == "dev"
|
|
43
|
-
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
44
|
-
Requires-Dist: build>=1.2; extra == "dev"
|
|
45
|
-
Requires-Dist: twine>=5.1; extra == "dev"
|
|
46
|
-
|
|
47
|
-
# django-orm-lens
|
|
48
|
-
|
|
49
|
-
<!-- mcp-name: io.github.
|
|
50
|
-
|
|
51
|
-
**Static analysis + MCP server for Django models.** Terminal- and AI-agent-friendly.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
django-orm-lens scan -f
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
django-orm-lens
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
|
|
191
|
-
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: django-orm-lens
|
|
3
|
+
Version: 1.0.4
|
|
4
|
+
Summary: Static analysis + MCP server for Django models. Sidebar tree, ER diagrams, and JSON output for terminals and AI coding agents.
|
|
5
|
+
Author: frowningdev
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/FROWNINGdev/django-orm-lens
|
|
8
|
+
Project-URL: Repository, https://github.com/FROWNINGdev/django-orm-lens
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/FROWNINGdev/django-orm-lens/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/FROWNINGdev/django-orm-lens/blob/main/CHANGELOG.md
|
|
11
|
+
Project-URL: VS Code Marketplace, https://marketplace.visualstudio.com/items?itemName=frowningdev.django-orm-lens
|
|
12
|
+
Keywords: django,orm,models,er-diagram,mermaid,mcp,ai-agents,cursor,aider,code-analysis,static-analysis
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Framework :: Django
|
|
16
|
+
Classifier: Framework :: Django :: 4.0
|
|
17
|
+
Classifier: Framework :: Django :: 4.1
|
|
18
|
+
Classifier: Framework :: Django :: 4.2
|
|
19
|
+
Classifier: Framework :: Django :: 5.0
|
|
20
|
+
Classifier: Framework :: Django :: 5.1
|
|
21
|
+
Classifier: Intended Audience :: Developers
|
|
22
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
23
|
+
Classifier: Operating System :: OS Independent
|
|
24
|
+
Classifier: Programming Language :: Python
|
|
25
|
+
Classifier: Programming Language :: Python :: 3
|
|
26
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
29
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
30
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
31
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
32
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
33
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
34
|
+
Classifier: Topic :: Utilities
|
|
35
|
+
Classifier: Typing :: Typed
|
|
36
|
+
Requires-Python: >=3.9
|
|
37
|
+
Description-Content-Type: text/markdown
|
|
38
|
+
Provides-Extra: mcp
|
|
39
|
+
Requires-Dist: mcp>=1.0; extra == "mcp"
|
|
40
|
+
Provides-Extra: dev
|
|
41
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
42
|
+
Requires-Dist: ruff>=0.5; extra == "dev"
|
|
43
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
44
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
45
|
+
Requires-Dist: twine>=5.1; extra == "dev"
|
|
46
|
+
|
|
47
|
+
# django-orm-lens
|
|
48
|
+
|
|
49
|
+
<!-- mcp-name: io.github.FROWNINGdev/django-orm-lens -->
|
|
50
|
+
|
|
51
|
+
**Static analysis + MCP server for Django models.** Terminal- and AI-agent-friendly.
|
|
52
|
+
|
|
53
|
+
Listed in the official [MCP Registry](https://registry.modelcontextprotocol.io/servers/io.github.FROWNINGdev%2Fdjango-orm-lens) as `io.github.FROWNINGdev/django-orm-lens`.
|
|
54
|
+
|
|
55
|
+
Ships with a zero-dependency parser, a JSON/Markdown/table CLI, and an optional
|
|
56
|
+
MCP (Model Context Protocol) server so any AI coding agent — Cursor, Aider,
|
|
57
|
+
Continue, and any other MCP client — can navigate your Django schema without
|
|
58
|
+
importing Django or spinning up your app.
|
|
59
|
+
|
|
60
|
+
Companion to the [Django ORM Lens VS Code
|
|
61
|
+
extension](https://marketplace.visualstudio.com/items?itemName=frowningdev.django-orm-lens).
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Install
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Core CLI (zero third-party deps)
|
|
69
|
+
pip install django-orm-lens
|
|
70
|
+
|
|
71
|
+
# With the MCP server (adds the `mcp` package)
|
|
72
|
+
pip install "django-orm-lens[mcp]"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Requires Python **3.9+**. Works on Linux, macOS, and Windows.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## CLI usage
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Scan a Django project for models (JSON, Markdown, or table)
|
|
83
|
+
django-orm-lens scan -f json
|
|
84
|
+
django-orm-lens scan -f markdown
|
|
85
|
+
django-orm-lens scan -f table
|
|
86
|
+
|
|
87
|
+
# Describe one model
|
|
88
|
+
django-orm-lens describe blog.Post
|
|
89
|
+
django-orm-lens describe Post -f json
|
|
90
|
+
|
|
91
|
+
# Compact hover card (great for pipeing into your editor)
|
|
92
|
+
django-orm-lens hover blog.Post
|
|
93
|
+
|
|
94
|
+
# Flat list — pipes into fzf, grep, etc.
|
|
95
|
+
django-orm-lens list | fzf
|
|
96
|
+
|
|
97
|
+
# Emit a Mermaid ER diagram
|
|
98
|
+
django-orm-lens er > schema.mmd
|
|
99
|
+
django-orm-lens er -o schema.mmd
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Every command accepts `--path <dir>` and repeatable `--exclude <glob>`. Defaults
|
|
103
|
+
skip `migrations/`, `venv/`, `.venv/`, `env/`, and `node_modules/`.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## MCP server — for AI coding agents
|
|
108
|
+
|
|
109
|
+
The MCP server exposes five read-only tools that any MCP-compatible agent can
|
|
110
|
+
call while it edits your Django project:
|
|
111
|
+
|
|
112
|
+
| Tool | Purpose |
|
|
113
|
+
| --- | --- |
|
|
114
|
+
| `list_apps` | Every Django app in the workspace with model counts |
|
|
115
|
+
| `list_models` | Flat `app.Model` list, optional app filter |
|
|
116
|
+
| `describe_model` | Full field / relation / Meta detail for one model |
|
|
117
|
+
| `find_relations` | Inbound + outbound relations for one model |
|
|
118
|
+
| `er_diagram` | Mermaid `erDiagram` string for the whole workspace |
|
|
119
|
+
|
|
120
|
+
### Start the server manually
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
django-orm-lens-mcp # dedicated entry point
|
|
124
|
+
# or
|
|
125
|
+
django-orm-lens mcp # subcommand
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
By default the server scans the current working directory. Override with
|
|
129
|
+
`DJANGO_ORM_LENS_ROOT=/abs/path/to/project`.
|
|
130
|
+
|
|
131
|
+
### Register it with an agent
|
|
132
|
+
|
|
133
|
+
**Cursor** — add to `~/.cursor/mcp.json`:
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"mcpServers": {
|
|
138
|
+
"django-orm-lens": {
|
|
139
|
+
"command": "django-orm-lens-mcp",
|
|
140
|
+
"env": { "DJANGO_ORM_LENS_ROOT": "/abs/path/to/your/project" }
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Aider / Continue.dev / Zed / any MCP client** — same shape, the tool is
|
|
147
|
+
generic. Point `command` at the installed `django-orm-lens-mcp` binary and set
|
|
148
|
+
the workspace root via env.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Why?
|
|
153
|
+
|
|
154
|
+
Django's ORM is Python, and Python is dynamic. AI agents that only see
|
|
155
|
+
`models.py` as raw text miss:
|
|
156
|
+
|
|
157
|
+
* which fields belong to which model;
|
|
158
|
+
* the direction and cardinality of every relation;
|
|
159
|
+
* what `Meta.ordering`, `unique_together`, and `constraints` actually contain;
|
|
160
|
+
* which app owns which model when the project uses split `models/` packages.
|
|
161
|
+
|
|
162
|
+
`django-orm-lens` gives them a **static, deterministic, JSON view** of the
|
|
163
|
+
schema — no Django boot, no database, no side effects. And you get a nice CLI
|
|
164
|
+
for humans too.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Programmatic API
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
from django_orm_lens import scan_workspace
|
|
172
|
+
|
|
173
|
+
index = scan_workspace(".")
|
|
174
|
+
for app in index.apps:
|
|
175
|
+
for model in app.models:
|
|
176
|
+
print(f"{app.name}.{model.name} — {len(model.fields)} fields")
|
|
177
|
+
|
|
178
|
+
# The full parsed tree serialises to the same JSON schema the VS Code
|
|
179
|
+
# extension emits, so tools can share it interchangeably.
|
|
180
|
+
import json
|
|
181
|
+
json.dumps(index.to_dict(), indent=2)
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Links
|
|
187
|
+
|
|
188
|
+
* Repo: <https://github.com/FROWNINGdev/django-orm-lens>
|
|
189
|
+
* Issues: <https://github.com/FROWNINGdev/django-orm-lens/issues>
|
|
190
|
+
* Changelog: <https://github.com/FROWNINGdev/django-orm-lens/blob/main/CHANGELOG.md>
|
|
191
|
+
* VS Code extension: <https://marketplace.visualstudio.com/items?itemName=frowningdev.django-orm-lens>
|
|
192
|
+
|
|
193
|
+
MIT licensed.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "django-orm-lens"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.4"
|
|
8
8
|
description = "Static analysis + MCP server for Django models. Sidebar tree, ER diagrams, and JSON output for terminals and AI coding agents."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[egg_info]
|
|
2
|
-
tag_build =
|
|
3
|
-
tag_date = 0
|
|
4
|
-
|
|
1
|
+
[egg_info]
|
|
2
|
+
tag_build =
|
|
3
|
+
tag_date = 0
|
|
4
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{django_orm_lens-1.0.2 → django_orm_lens-1.0.4}/django_orm_lens.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|