depatlas 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- depatlas-0.1.0/PKG-INFO +306 -0
- depatlas-0.1.0/README.md +271 -0
- depatlas-0.1.0/depatlas/__init__.py +0 -0
- depatlas-0.1.0/depatlas/cli/__init__.py +0 -0
- depatlas-0.1.0/depatlas/cli/main.py +652 -0
- depatlas-0.1.0/depatlas/connectors/__init__.py +0 -0
- depatlas-0.1.0/depatlas/connectors/codecommit.py +102 -0
- depatlas-0.1.0/depatlas/connectors/github.py +93 -0
- depatlas-0.1.0/depatlas/graph/__init__.py +0 -0
- depatlas-0.1.0/depatlas/graph/builder.py +125 -0
- depatlas-0.1.0/depatlas/graph/models.py +78 -0
- depatlas-0.1.0/depatlas/graph/store.py +241 -0
- depatlas-0.1.0/depatlas/intelligence/__init__.py +0 -0
- depatlas-0.1.0/depatlas/intelligence/alerts.py +242 -0
- depatlas-0.1.0/depatlas/intelligence/diff.py +41 -0
- depatlas-0.1.0/depatlas/output/__init__.py +0 -0
- depatlas-0.1.0/depatlas/output/dot_export.py +41 -0
- depatlas-0.1.0/depatlas/output/json_export.py +36 -0
- depatlas-0.1.0/depatlas/ownership/__init__.py +0 -0
- depatlas-0.1.0/depatlas/ownership/codeowners.py +88 -0
- depatlas-0.1.0/depatlas/ownership/manifest.py +55 -0
- depatlas-0.1.0/depatlas/parsers/__init__.py +0 -0
- depatlas-0.1.0/depatlas/parsers/java_parser.py +222 -0
- depatlas-0.1.0/depatlas/parsers/js_ts_parser.py +333 -0
- depatlas-0.1.0/depatlas/parsers/python_parser.py +290 -0
- depatlas-0.1.0/depatlas.egg-info/PKG-INFO +306 -0
- depatlas-0.1.0/depatlas.egg-info/SOURCES.txt +31 -0
- depatlas-0.1.0/depatlas.egg-info/dependency_links.txt +1 -0
- depatlas-0.1.0/depatlas.egg-info/entry_points.txt +2 -0
- depatlas-0.1.0/depatlas.egg-info/requires.txt +9 -0
- depatlas-0.1.0/depatlas.egg-info/top_level.txt +1 -0
- depatlas-0.1.0/pyproject.toml +62 -0
- depatlas-0.1.0/setup.cfg +4 -0
depatlas-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: depatlas
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Reads your codebase and builds a living dependency graph across services, teams, and repositories.
|
|
5
|
+
Author: Shameel
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/sshafeeq84/DepAtlas
|
|
8
|
+
Project-URL: Repository, https://github.com/sshafeeq84/DepAtlas
|
|
9
|
+
Project-URL: Issues, https://github.com/sshafeeq84/DepAtlas/issues
|
|
10
|
+
Keywords: dependency-graph,static-analysis,cli,devtools,codeowners,microservices
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
23
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
24
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
Requires-Dist: click>=8.1
|
|
28
|
+
Requires-Dist: javalang>=0.13
|
|
29
|
+
Requires-Dist: esprima>=4.0
|
|
30
|
+
Requires-Dist: requests>=2.28
|
|
31
|
+
Requires-Dist: boto3>=1.34
|
|
32
|
+
Requires-Dist: pyyaml>=6.0
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
35
|
+
|
|
36
|
+
# DepAtlas
|
|
37
|
+
|
|
38
|
+
[](LICENSE)
|
|
39
|
+
|
|
40
|
+
*(Originally released as DepGraph — renamed to DepAtlas. The original
|
|
41
|
+
design doc in [`docs/SPEC.pdf`](docs/SPEC.pdf) predates the rename and
|
|
42
|
+
still uses the old name.)*
|
|
43
|
+
|
|
44
|
+
DepAtlas reads your codebase and builds a living dependency graph across
|
|
45
|
+
services, teams, and repositories — so blockers surface before they cost
|
|
46
|
+
you a sprint.
|
|
47
|
+
|
|
48
|
+
Engineering organizations above a certain size develop an invisible
|
|
49
|
+
coordination tax: teams block each other without knowing it, status
|
|
50
|
+
updates are written from memory, and nobody has a system that actually
|
|
51
|
+
knows what depends on what. DepAtlas reads the code itself — the one
|
|
52
|
+
source of truth that can't drift out of date — and turns it into a
|
|
53
|
+
queryable graph, automatically.
|
|
54
|
+
|
|
55
|
+
Full original design in [`docs/SPEC.pdf`](docs/SPEC.pdf).
|
|
56
|
+
|
|
57
|
+
<p align="center">
|
|
58
|
+
<img src="docs/images/example_dependency_graph.png" alt="Example dependency graph exported by depatlas, showing five services colored by owning team, generated with depatlas export --format dot" width="850">
|
|
59
|
+
</p>
|
|
60
|
+
|
|
61
|
+
<p align="center">
|
|
62
|
+
<img src="docs/images/example_alerts_terminal.png" alt="Terminal output showing depatlas detecting a new cross-team dependency" width="850">
|
|
63
|
+
</p>
|
|
64
|
+
|
|
65
|
+
## Status
|
|
66
|
+
|
|
67
|
+
Feature-complete relative to the v1 spec. Three language parsers, three
|
|
68
|
+
code sources, a persisted queryable graph with history and diffing, full
|
|
69
|
+
ownership resolution, all five spec'd alert types (including
|
|
70
|
+
signature-level breaking-change detection), and both JSON and DOT
|
|
71
|
+
export — all covered by 113 passing tests. Two things are knowingly out
|
|
72
|
+
of scope for now; see [Known limitations](#known-limitations).
|
|
73
|
+
|
|
74
|
+
| Area | What's there |
|
|
75
|
+
|---|---|
|
|
76
|
+
| **Languages** | Python (`ast`), Java (`javalang`), JavaScript/TypeScript (`esprima`) |
|
|
77
|
+
| **Code sources** | Local directory, GitHub (REST API), AWS CodeCommit (`boto3`) |
|
|
78
|
+
| **Persistence** | SQLite-backed graph store; every scan saves an immutable snapshot |
|
|
79
|
+
| **Ownership** | CODEOWNERS, with a `depatlas.yaml` manifest fallback |
|
|
80
|
+
| **Intelligence** | Diff engine (snapshot-to-snapshot) + 5 alert types, incl. breaking-change signature detection |
|
|
81
|
+
| **Export** | JSON and Graphviz DOT |
|
|
82
|
+
|
|
83
|
+
## Quick start
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pip install -e ".[dev]"
|
|
87
|
+
|
|
88
|
+
# Scan a local repo, resolving ownership from CODEOWNERS:
|
|
89
|
+
depatlas scan \
|
|
90
|
+
--repo tests/fixtures/sample_repo/payments \
|
|
91
|
+
--services tests/fixtures/payments_services.json \
|
|
92
|
+
--codeowners tests/fixtures/sample_repo/payments/CODEOWNERS
|
|
93
|
+
|
|
94
|
+
# Query what it found:
|
|
95
|
+
depatlas query --service payments-service --direction downstream
|
|
96
|
+
depatlas query --team @payments-team
|
|
97
|
+
|
|
98
|
+
# See what changed since the last scan (run the scan above twice to
|
|
99
|
+
# see this produce real output; on a first scan there's nothing yet
|
|
100
|
+
# to compare against):
|
|
101
|
+
depatlas diff --last 2 --repo tests/fixtures/sample_repo/payments
|
|
102
|
+
|
|
103
|
+
# Check for cross-team dependencies, breaking changes, and more:
|
|
104
|
+
depatlas alerts
|
|
105
|
+
|
|
106
|
+
# Export the whole graph:
|
|
107
|
+
depatlas export --format dot --output graph.dot
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The `--services` file is a small JSON manifest mapping importable module
|
|
111
|
+
names to service names, plus a special `__self__` key naming the service
|
|
112
|
+
being scanned:
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"__self__": "payments-service",
|
|
117
|
+
"auth_client": "auth-service",
|
|
118
|
+
"endpoints": {
|
|
119
|
+
"auth.internal": "auth-service"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
More usage examples — Java, JS/TS, GitHub, CodeCommit, ownership
|
|
125
|
+
manifests — are in [Full usage](#full-usage) below.
|
|
126
|
+
|
|
127
|
+
## CLI reference
|
|
128
|
+
|
|
129
|
+
| Command | Purpose |
|
|
130
|
+
|---|---|
|
|
131
|
+
| `depatlas scan` | Parse a repo (local, GitHub, or CodeCommit) and persist the resulting graph |
|
|
132
|
+
| `depatlas query` | Look up a service's dependencies (`--direction downstream\|upstream`) or a team's services |
|
|
133
|
+
| `depatlas snapshots` | List saved snapshots for a repo |
|
|
134
|
+
| `depatlas diff` | Compare two snapshots (`--from`/`--to` or `--last 2`) |
|
|
135
|
+
| `depatlas alerts` | Check the stored graph for all 5 alert types |
|
|
136
|
+
| `depatlas export` | Export the whole graph as JSON or DOT |
|
|
137
|
+
|
|
138
|
+
Every command supports `--help` for full option details.
|
|
139
|
+
|
|
140
|
+
## How it works
|
|
141
|
+
|
|
142
|
+
### Language parsers
|
|
143
|
+
|
|
144
|
+
Each parser walks a real AST (never regex) and extracts dependencies at
|
|
145
|
+
three confidence levels — **high** (an explicit, unambiguous signal),
|
|
146
|
+
**medium** (a configured endpoint match), and **low** (a heuristic
|
|
147
|
+
match) — plus public function/method signatures for breaking-change
|
|
148
|
+
detection.
|
|
149
|
+
|
|
150
|
+
- **Python** (`ast`): `import`/`from...import` statements (high);
|
|
151
|
+
`requests.get/post/etc.` calls resolved via an endpoint registry
|
|
152
|
+
(medium) or name heuristic (low).
|
|
153
|
+
- **Java** (`javalang`): `import` statements resolved against known
|
|
154
|
+
package namespaces (high); `@FeignClient` annotations, an explicit
|
|
155
|
+
dependency declaration (high); RestTemplate/WebClient-style calls
|
|
156
|
+
(medium/low, same scheme as Python).
|
|
157
|
+
- **JavaScript/TypeScript** (`esprima`): `import`/`require(...)` (high);
|
|
158
|
+
`fetch`/`axios.<method>`/`got.<method>` calls (medium/low);
|
|
159
|
+
`package.json` dependencies as `shared_library` edges (high).
|
|
160
|
+
|
|
161
|
+
Tests: `tests/test_parsers/`.
|
|
162
|
+
|
|
163
|
+
### Code sources
|
|
164
|
+
|
|
165
|
+
`depatlas scan` takes exactly one of:
|
|
166
|
+
- **`--repo <path>`** — a local directory.
|
|
167
|
+
- **`--github-repo owner/repo`** — downloaded via the GitHub REST API's
|
|
168
|
+
zipball endpoint (no `git clone` dependency). Requires
|
|
169
|
+
`DEPATLAS_GITHUB_TOKEN`.
|
|
170
|
+
- **`--codecommit-repo <name>`** — downloaded via `boto3`, walking the
|
|
171
|
+
repo tree with `get_folder`/`get_file` (CodeCommit has no bulk-download
|
|
172
|
+
endpoint). Uses the AWS profile in `DEPATLAS_AWS_PROFILE`, or the
|
|
173
|
+
default credential chain.
|
|
174
|
+
|
|
175
|
+
Tests: `tests/test_connectors/` (all network/AWS calls mocked — no real
|
|
176
|
+
credentials needed to run the suite).
|
|
177
|
+
|
|
178
|
+
### Persistence and diffing
|
|
179
|
+
|
|
180
|
+
Every `scan` persists to a local SQLite store (default
|
|
181
|
+
`.depatlas/graph.db`) and saves an immutable snapshot of that scan's
|
|
182
|
+
edges. Rescanning a repo replaces its *live* edges (so the graph always
|
|
183
|
+
reflects current code) while snapshots accumulate, giving
|
|
184
|
+
`depatlas diff` a timeline to compare. Services known only as a
|
|
185
|
+
dependency (not yet scanned directly) get a placeholder node, filled in
|
|
186
|
+
once their own repo is scanned.
|
|
187
|
+
|
|
188
|
+
Tests: `tests/test_graph/`, `tests/test_intelligence/test_diff.py`.
|
|
189
|
+
|
|
190
|
+
### Ownership
|
|
191
|
+
|
|
192
|
+
Resolved in priority order: **CODEOWNERS** (majority owner across a
|
|
193
|
+
repo's files, last-matching-rule-wins) → **`depatlas.yaml` manifest**
|
|
194
|
+
fallback (explicit service→team mapping) → **unowned**.
|
|
195
|
+
|
|
196
|
+
Tests: `tests/test_ownership/`.
|
|
197
|
+
|
|
198
|
+
### Alerts
|
|
199
|
+
|
|
200
|
+
All five SPEC.md alert types, checked automatically after every `scan`
|
|
201
|
+
(`--no-alerts` to disable) or on demand via `depatlas alerts`:
|
|
202
|
+
|
|
203
|
+
- **`BREAKING_CHANGE`** (high) — a public function removed, its
|
|
204
|
+
parameter count changed, or a parameter's type changed at the same
|
|
205
|
+
position (only when both old and new have a known type) — on a
|
|
206
|
+
service with at least one known dependent. A pure parameter *rename*
|
|
207
|
+
is deliberately not flagged, since most real callers invoke
|
|
208
|
+
positionally.
|
|
209
|
+
- **`NEW_CROSS_TEAM_DEPENDENCY`** (medium) — a new edge crossing a team
|
|
210
|
+
boundary.
|
|
211
|
+
- **`HIGH_FAN_IN`** (medium) — a service's distinct dependent count
|
|
212
|
+
crosses a threshold (default 10).
|
|
213
|
+
- **`ORPHANED_SERVICE`** (low) — no dependents and no dependencies.
|
|
214
|
+
- **`UNOWNED_SERVICE`** (low) — no resolved team.
|
|
215
|
+
|
|
216
|
+
Tests: `tests/test_intelligence/test_alerts.py`.
|
|
217
|
+
|
|
218
|
+
## Full usage
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
# Scan a Java repo:
|
|
222
|
+
depatlas scan \
|
|
223
|
+
--repo tests/fixtures/sample_repo_java/payments \
|
|
224
|
+
--services tests/fixtures/payments_services_java.json \
|
|
225
|
+
--language java
|
|
226
|
+
|
|
227
|
+
# Scan a JS/TS repo:
|
|
228
|
+
depatlas scan \
|
|
229
|
+
--repo tests/fixtures/sample_repo_js/payments \
|
|
230
|
+
--services tests/fixtures/payments_services_js.json \
|
|
231
|
+
--language javascript
|
|
232
|
+
|
|
233
|
+
# Scan a real GitHub repo (requires DEPATLAS_GITHUB_TOKEN):
|
|
234
|
+
depatlas scan \
|
|
235
|
+
--github-repo sshafeeq84/DepAtlas \
|
|
236
|
+
--services tests/fixtures/payments_services.json
|
|
237
|
+
|
|
238
|
+
# Scan a real AWS CodeCommit repo (requires an AWS profile):
|
|
239
|
+
depatlas scan \
|
|
240
|
+
--codecommit-repo my-payments-repo \
|
|
241
|
+
--region us-east-1 \
|
|
242
|
+
--services tests/fixtures/payments_services.json
|
|
243
|
+
|
|
244
|
+
# Resolve ownership from a depatlas.yaml manifest instead of CODEOWNERS:
|
|
245
|
+
depatlas scan \
|
|
246
|
+
--repo tests/fixtures/sample_repo/payments \
|
|
247
|
+
--services tests/fixtures/payments_services.json \
|
|
248
|
+
--ownership-manifest tests/fixtures/depatlas.yaml
|
|
249
|
+
|
|
250
|
+
# List and diff snapshots explicitly:
|
|
251
|
+
depatlas snapshots --repo tests/fixtures/sample_repo/payments
|
|
252
|
+
depatlas diff --from 1 --to 2
|
|
253
|
+
|
|
254
|
+
# Filter alerts by severity:
|
|
255
|
+
depatlas alerts --severity medium
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## Known limitations
|
|
259
|
+
|
|
260
|
+
A couple of things are deliberately out of scope for now, documented in
|
|
261
|
+
the relevant module and in [`docs/CONTRIBUTING.md`](docs/CONTRIBUTING.md):
|
|
262
|
+
|
|
263
|
+
- **Full TypeScript syntax** — `esprima` parses JavaScript, not
|
|
264
|
+
TypeScript-specific syntax (type annotations, interfaces). A `.ts`
|
|
265
|
+
file using real TS syntax is skipped with a warning, not crashed on.
|
|
266
|
+
Full support would need a Node-based parser, which this project
|
|
267
|
+
avoids as a runtime dependency.
|
|
268
|
+
- **`boto3`/`grpc` detection** in the Python parser, and Java's
|
|
269
|
+
Maven/Gradle shared-library detection — spec'd, not yet built.
|
|
270
|
+
- The **CodeCommit connector** is fully tested against a mocked AWS API
|
|
271
|
+
but has not been exercised against a real AWS account.
|
|
272
|
+
|
|
273
|
+
## Running tests
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
pytest tests/ -v
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## Repository structure
|
|
280
|
+
|
|
281
|
+
```
|
|
282
|
+
depatlas/
|
|
283
|
+
├── depatlas/
|
|
284
|
+
│ ├── cli/ # CLI entry point (click)
|
|
285
|
+
│ ├── connectors/ # GitHub, AWS CodeCommit
|
|
286
|
+
│ ├── parsers/ # python_parser (ast), java_parser (javalang),
|
|
287
|
+
│ │ js_ts_parser (esprima)
|
|
288
|
+
│ ├── graph/ # Models, graph builder, SQLite store
|
|
289
|
+
│ ├── ownership/ # CODEOWNERS + depatlas.yaml manifest
|
|
290
|
+
│ ├── intelligence/ # Diff engine, alerts
|
|
291
|
+
│ └── output/ # JSON and DOT exporters
|
|
292
|
+
├── tests/ # Mirrors the structure above, 1:1
|
|
293
|
+
├── docs/
|
|
294
|
+
│ ├── SPEC.pdf # Original v0.1 spec
|
|
295
|
+
│ └── CONTRIBUTING.md
|
|
296
|
+
└── pyproject.toml
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## Contributing
|
|
300
|
+
|
|
301
|
+
See [`docs/CONTRIBUTING.md`](docs/CONTRIBUTING.md) for setup,
|
|
302
|
+
testing conventions, and known scope boundaries.
|
|
303
|
+
|
|
304
|
+
## License
|
|
305
|
+
|
|
306
|
+
Apache 2.0 — see [`LICENSE`](LICENSE).
|
depatlas-0.1.0/README.md
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
# DepAtlas
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
|
|
5
|
+
*(Originally released as DepGraph — renamed to DepAtlas. The original
|
|
6
|
+
design doc in [`docs/SPEC.pdf`](docs/SPEC.pdf) predates the rename and
|
|
7
|
+
still uses the old name.)*
|
|
8
|
+
|
|
9
|
+
DepAtlas reads your codebase and builds a living dependency graph across
|
|
10
|
+
services, teams, and repositories — so blockers surface before they cost
|
|
11
|
+
you a sprint.
|
|
12
|
+
|
|
13
|
+
Engineering organizations above a certain size develop an invisible
|
|
14
|
+
coordination tax: teams block each other without knowing it, status
|
|
15
|
+
updates are written from memory, and nobody has a system that actually
|
|
16
|
+
knows what depends on what. DepAtlas reads the code itself — the one
|
|
17
|
+
source of truth that can't drift out of date — and turns it into a
|
|
18
|
+
queryable graph, automatically.
|
|
19
|
+
|
|
20
|
+
Full original design in [`docs/SPEC.pdf`](docs/SPEC.pdf).
|
|
21
|
+
|
|
22
|
+
<p align="center">
|
|
23
|
+
<img src="docs/images/example_dependency_graph.png" alt="Example dependency graph exported by depatlas, showing five services colored by owning team, generated with depatlas export --format dot" width="850">
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
<p align="center">
|
|
27
|
+
<img src="docs/images/example_alerts_terminal.png" alt="Terminal output showing depatlas detecting a new cross-team dependency" width="850">
|
|
28
|
+
</p>
|
|
29
|
+
|
|
30
|
+
## Status
|
|
31
|
+
|
|
32
|
+
Feature-complete relative to the v1 spec. Three language parsers, three
|
|
33
|
+
code sources, a persisted queryable graph with history and diffing, full
|
|
34
|
+
ownership resolution, all five spec'd alert types (including
|
|
35
|
+
signature-level breaking-change detection), and both JSON and DOT
|
|
36
|
+
export — all covered by 113 passing tests. Two things are knowingly out
|
|
37
|
+
of scope for now; see [Known limitations](#known-limitations).
|
|
38
|
+
|
|
39
|
+
| Area | What's there |
|
|
40
|
+
|---|---|
|
|
41
|
+
| **Languages** | Python (`ast`), Java (`javalang`), JavaScript/TypeScript (`esprima`) |
|
|
42
|
+
| **Code sources** | Local directory, GitHub (REST API), AWS CodeCommit (`boto3`) |
|
|
43
|
+
| **Persistence** | SQLite-backed graph store; every scan saves an immutable snapshot |
|
|
44
|
+
| **Ownership** | CODEOWNERS, with a `depatlas.yaml` manifest fallback |
|
|
45
|
+
| **Intelligence** | Diff engine (snapshot-to-snapshot) + 5 alert types, incl. breaking-change signature detection |
|
|
46
|
+
| **Export** | JSON and Graphviz DOT |
|
|
47
|
+
|
|
48
|
+
## Quick start
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install -e ".[dev]"
|
|
52
|
+
|
|
53
|
+
# Scan a local repo, resolving ownership from CODEOWNERS:
|
|
54
|
+
depatlas scan \
|
|
55
|
+
--repo tests/fixtures/sample_repo/payments \
|
|
56
|
+
--services tests/fixtures/payments_services.json \
|
|
57
|
+
--codeowners tests/fixtures/sample_repo/payments/CODEOWNERS
|
|
58
|
+
|
|
59
|
+
# Query what it found:
|
|
60
|
+
depatlas query --service payments-service --direction downstream
|
|
61
|
+
depatlas query --team @payments-team
|
|
62
|
+
|
|
63
|
+
# See what changed since the last scan (run the scan above twice to
|
|
64
|
+
# see this produce real output; on a first scan there's nothing yet
|
|
65
|
+
# to compare against):
|
|
66
|
+
depatlas diff --last 2 --repo tests/fixtures/sample_repo/payments
|
|
67
|
+
|
|
68
|
+
# Check for cross-team dependencies, breaking changes, and more:
|
|
69
|
+
depatlas alerts
|
|
70
|
+
|
|
71
|
+
# Export the whole graph:
|
|
72
|
+
depatlas export --format dot --output graph.dot
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The `--services` file is a small JSON manifest mapping importable module
|
|
76
|
+
names to service names, plus a special `__self__` key naming the service
|
|
77
|
+
being scanned:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"__self__": "payments-service",
|
|
82
|
+
"auth_client": "auth-service",
|
|
83
|
+
"endpoints": {
|
|
84
|
+
"auth.internal": "auth-service"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
More usage examples — Java, JS/TS, GitHub, CodeCommit, ownership
|
|
90
|
+
manifests — are in [Full usage](#full-usage) below.
|
|
91
|
+
|
|
92
|
+
## CLI reference
|
|
93
|
+
|
|
94
|
+
| Command | Purpose |
|
|
95
|
+
|---|---|
|
|
96
|
+
| `depatlas scan` | Parse a repo (local, GitHub, or CodeCommit) and persist the resulting graph |
|
|
97
|
+
| `depatlas query` | Look up a service's dependencies (`--direction downstream\|upstream`) or a team's services |
|
|
98
|
+
| `depatlas snapshots` | List saved snapshots for a repo |
|
|
99
|
+
| `depatlas diff` | Compare two snapshots (`--from`/`--to` or `--last 2`) |
|
|
100
|
+
| `depatlas alerts` | Check the stored graph for all 5 alert types |
|
|
101
|
+
| `depatlas export` | Export the whole graph as JSON or DOT |
|
|
102
|
+
|
|
103
|
+
Every command supports `--help` for full option details.
|
|
104
|
+
|
|
105
|
+
## How it works
|
|
106
|
+
|
|
107
|
+
### Language parsers
|
|
108
|
+
|
|
109
|
+
Each parser walks a real AST (never regex) and extracts dependencies at
|
|
110
|
+
three confidence levels — **high** (an explicit, unambiguous signal),
|
|
111
|
+
**medium** (a configured endpoint match), and **low** (a heuristic
|
|
112
|
+
match) — plus public function/method signatures for breaking-change
|
|
113
|
+
detection.
|
|
114
|
+
|
|
115
|
+
- **Python** (`ast`): `import`/`from...import` statements (high);
|
|
116
|
+
`requests.get/post/etc.` calls resolved via an endpoint registry
|
|
117
|
+
(medium) or name heuristic (low).
|
|
118
|
+
- **Java** (`javalang`): `import` statements resolved against known
|
|
119
|
+
package namespaces (high); `@FeignClient` annotations, an explicit
|
|
120
|
+
dependency declaration (high); RestTemplate/WebClient-style calls
|
|
121
|
+
(medium/low, same scheme as Python).
|
|
122
|
+
- **JavaScript/TypeScript** (`esprima`): `import`/`require(...)` (high);
|
|
123
|
+
`fetch`/`axios.<method>`/`got.<method>` calls (medium/low);
|
|
124
|
+
`package.json` dependencies as `shared_library` edges (high).
|
|
125
|
+
|
|
126
|
+
Tests: `tests/test_parsers/`.
|
|
127
|
+
|
|
128
|
+
### Code sources
|
|
129
|
+
|
|
130
|
+
`depatlas scan` takes exactly one of:
|
|
131
|
+
- **`--repo <path>`** — a local directory.
|
|
132
|
+
- **`--github-repo owner/repo`** — downloaded via the GitHub REST API's
|
|
133
|
+
zipball endpoint (no `git clone` dependency). Requires
|
|
134
|
+
`DEPATLAS_GITHUB_TOKEN`.
|
|
135
|
+
- **`--codecommit-repo <name>`** — downloaded via `boto3`, walking the
|
|
136
|
+
repo tree with `get_folder`/`get_file` (CodeCommit has no bulk-download
|
|
137
|
+
endpoint). Uses the AWS profile in `DEPATLAS_AWS_PROFILE`, or the
|
|
138
|
+
default credential chain.
|
|
139
|
+
|
|
140
|
+
Tests: `tests/test_connectors/` (all network/AWS calls mocked — no real
|
|
141
|
+
credentials needed to run the suite).
|
|
142
|
+
|
|
143
|
+
### Persistence and diffing
|
|
144
|
+
|
|
145
|
+
Every `scan` persists to a local SQLite store (default
|
|
146
|
+
`.depatlas/graph.db`) and saves an immutable snapshot of that scan's
|
|
147
|
+
edges. Rescanning a repo replaces its *live* edges (so the graph always
|
|
148
|
+
reflects current code) while snapshots accumulate, giving
|
|
149
|
+
`depatlas diff` a timeline to compare. Services known only as a
|
|
150
|
+
dependency (not yet scanned directly) get a placeholder node, filled in
|
|
151
|
+
once their own repo is scanned.
|
|
152
|
+
|
|
153
|
+
Tests: `tests/test_graph/`, `tests/test_intelligence/test_diff.py`.
|
|
154
|
+
|
|
155
|
+
### Ownership
|
|
156
|
+
|
|
157
|
+
Resolved in priority order: **CODEOWNERS** (majority owner across a
|
|
158
|
+
repo's files, last-matching-rule-wins) → **`depatlas.yaml` manifest**
|
|
159
|
+
fallback (explicit service→team mapping) → **unowned**.
|
|
160
|
+
|
|
161
|
+
Tests: `tests/test_ownership/`.
|
|
162
|
+
|
|
163
|
+
### Alerts
|
|
164
|
+
|
|
165
|
+
All five SPEC.md alert types, checked automatically after every `scan`
|
|
166
|
+
(`--no-alerts` to disable) or on demand via `depatlas alerts`:
|
|
167
|
+
|
|
168
|
+
- **`BREAKING_CHANGE`** (high) — a public function removed, its
|
|
169
|
+
parameter count changed, or a parameter's type changed at the same
|
|
170
|
+
position (only when both old and new have a known type) — on a
|
|
171
|
+
service with at least one known dependent. A pure parameter *rename*
|
|
172
|
+
is deliberately not flagged, since most real callers invoke
|
|
173
|
+
positionally.
|
|
174
|
+
- **`NEW_CROSS_TEAM_DEPENDENCY`** (medium) — a new edge crossing a team
|
|
175
|
+
boundary.
|
|
176
|
+
- **`HIGH_FAN_IN`** (medium) — a service's distinct dependent count
|
|
177
|
+
crosses a threshold (default 10).
|
|
178
|
+
- **`ORPHANED_SERVICE`** (low) — no dependents and no dependencies.
|
|
179
|
+
- **`UNOWNED_SERVICE`** (low) — no resolved team.
|
|
180
|
+
|
|
181
|
+
Tests: `tests/test_intelligence/test_alerts.py`.
|
|
182
|
+
|
|
183
|
+
## Full usage
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
# Scan a Java repo:
|
|
187
|
+
depatlas scan \
|
|
188
|
+
--repo tests/fixtures/sample_repo_java/payments \
|
|
189
|
+
--services tests/fixtures/payments_services_java.json \
|
|
190
|
+
--language java
|
|
191
|
+
|
|
192
|
+
# Scan a JS/TS repo:
|
|
193
|
+
depatlas scan \
|
|
194
|
+
--repo tests/fixtures/sample_repo_js/payments \
|
|
195
|
+
--services tests/fixtures/payments_services_js.json \
|
|
196
|
+
--language javascript
|
|
197
|
+
|
|
198
|
+
# Scan a real GitHub repo (requires DEPATLAS_GITHUB_TOKEN):
|
|
199
|
+
depatlas scan \
|
|
200
|
+
--github-repo sshafeeq84/DepAtlas \
|
|
201
|
+
--services tests/fixtures/payments_services.json
|
|
202
|
+
|
|
203
|
+
# Scan a real AWS CodeCommit repo (requires an AWS profile):
|
|
204
|
+
depatlas scan \
|
|
205
|
+
--codecommit-repo my-payments-repo \
|
|
206
|
+
--region us-east-1 \
|
|
207
|
+
--services tests/fixtures/payments_services.json
|
|
208
|
+
|
|
209
|
+
# Resolve ownership from a depatlas.yaml manifest instead of CODEOWNERS:
|
|
210
|
+
depatlas scan \
|
|
211
|
+
--repo tests/fixtures/sample_repo/payments \
|
|
212
|
+
--services tests/fixtures/payments_services.json \
|
|
213
|
+
--ownership-manifest tests/fixtures/depatlas.yaml
|
|
214
|
+
|
|
215
|
+
# List and diff snapshots explicitly:
|
|
216
|
+
depatlas snapshots --repo tests/fixtures/sample_repo/payments
|
|
217
|
+
depatlas diff --from 1 --to 2
|
|
218
|
+
|
|
219
|
+
# Filter alerts by severity:
|
|
220
|
+
depatlas alerts --severity medium
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Known limitations
|
|
224
|
+
|
|
225
|
+
A couple of things are deliberately out of scope for now, documented in
|
|
226
|
+
the relevant module and in [`docs/CONTRIBUTING.md`](docs/CONTRIBUTING.md):
|
|
227
|
+
|
|
228
|
+
- **Full TypeScript syntax** — `esprima` parses JavaScript, not
|
|
229
|
+
TypeScript-specific syntax (type annotations, interfaces). A `.ts`
|
|
230
|
+
file using real TS syntax is skipped with a warning, not crashed on.
|
|
231
|
+
Full support would need a Node-based parser, which this project
|
|
232
|
+
avoids as a runtime dependency.
|
|
233
|
+
- **`boto3`/`grpc` detection** in the Python parser, and Java's
|
|
234
|
+
Maven/Gradle shared-library detection — spec'd, not yet built.
|
|
235
|
+
- The **CodeCommit connector** is fully tested against a mocked AWS API
|
|
236
|
+
but has not been exercised against a real AWS account.
|
|
237
|
+
|
|
238
|
+
## Running tests
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
pytest tests/ -v
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Repository structure
|
|
245
|
+
|
|
246
|
+
```
|
|
247
|
+
depatlas/
|
|
248
|
+
├── depatlas/
|
|
249
|
+
│ ├── cli/ # CLI entry point (click)
|
|
250
|
+
│ ├── connectors/ # GitHub, AWS CodeCommit
|
|
251
|
+
│ ├── parsers/ # python_parser (ast), java_parser (javalang),
|
|
252
|
+
│ │ js_ts_parser (esprima)
|
|
253
|
+
│ ├── graph/ # Models, graph builder, SQLite store
|
|
254
|
+
│ ├── ownership/ # CODEOWNERS + depatlas.yaml manifest
|
|
255
|
+
│ ├── intelligence/ # Diff engine, alerts
|
|
256
|
+
│ └── output/ # JSON and DOT exporters
|
|
257
|
+
├── tests/ # Mirrors the structure above, 1:1
|
|
258
|
+
├── docs/
|
|
259
|
+
│ ├── SPEC.pdf # Original v0.1 spec
|
|
260
|
+
│ └── CONTRIBUTING.md
|
|
261
|
+
└── pyproject.toml
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Contributing
|
|
265
|
+
|
|
266
|
+
See [`docs/CONTRIBUTING.md`](docs/CONTRIBUTING.md) for setup,
|
|
267
|
+
testing conventions, and known scope boundaries.
|
|
268
|
+
|
|
269
|
+
## License
|
|
270
|
+
|
|
271
|
+
Apache 2.0 — see [`LICENSE`](LICENSE).
|
|
File without changes
|
|
File without changes
|