Python Project Scanner: Static Analysis Architecture

Summary

Pixel shares an overview of Project Inventory, a Python 3.11+ static analysis engine that scans files without executing a project. It identifies subprojects, inventories dependencies across ten ecosystems, analyzes Docker configurations, maps component relationships, and generates HTML, JSON, and CSV reports—helping developers understand legacy projects and monorepos faster.

DEV Community

🔎 Python Project Scanner Architecture: Static Analysis, Multi-Ecosystem Dependencies, and Technical Mapping

Taking over an existing software project often begins with the same questions. Which technologies does it use? What libraries does it depend on? Which external services are integrated? How do its different components relate to one another? In a recent, well-documented project, the answers may be relatively easy to find. In a legacy project, a monorepo, or an application composed of multiple services, they are often scattered across configuration files, dependency manifests, Dockerfiles, and source code. Manual analysis becomes a task of its own. An alternative approach is to build a technical inventory directly from the filesystem without executing the project being analyzed. This article presents the architecture of Project Inventory, a static analysis engine built with Python 3.11+, capable of inventorying dependencies across ten ecosystems, identifying subprojects, analyzing Docker configurations, and mapping relationships between components. 1. Analyzing a Project Without Executing It The first architectural principle is to work exclusively with observable elements within the project. Software project
│
▼
Filesystem exploration
│
▼
Technical file detection
│
▼
Manifest and configuration analysis
│
▼
Source code reference analysis
│
▼
Consolidation and mapping
│
▼
HTML, JSON, and CSV reports
The scanner does not need to start the application, install its dependencies, or launch its Docker containers. It builds a technical representation from the available files. This distinction is important: a static inventory describes what can be observed within a project, but does not necessarily establish its actual runtime behavior. A service may be declared in Docker Compose without running. A library may be installed without being directly imported. An environment variable may exist without being used. The report must preserve these distinctions. 2. A Modular Architecture The engine separates responsibilities across several categories of components. project-inventory/
│
├── scanner/
│ ├── init.py
│ ├── filesystem.py
│ └── project_scanner.py
│
├── detectors/
│ ├── init.py
│ ├── environment.py
│ ├── infrastructure.py
│ ├── languages.py
│ ├── packages.py
│ ├── projects.py
│ └── services.py
│
├── analyzers/
│ ├── init.py
│ ├── dependencies.py
│ └── relationships.py
│
├── exporters/
│ ├── init.py
│ ├── csv_export.py
│ ├── html_export.py
│ └── json_export.py
│
├── docs/
├── output/
│ └── .gitkeep
│
├── LICENCE.md
├── LICENSE.md
└── app.py
This organization corresponds to the documented project structure. Component Responsibility scanner/ Exploration and orchestration detectors/ Information extraction analyzers/ Consolidation and relationships exporters/ Report generation output/ Result storage app.py Application entry point The separation between detection and analysis is a central aspect of this architecture. A detector can identify a package, an environment file, or a Docker service. An analyzer can then correlate these observations to establish relationships between components. This prevents data discovery from being mixed with interpretation. 3. Recursive Filesystem Exploration The first step is to traverse the selected directory and its subdirectories. However, not every file within a project is relevant to its technical inventory. Directories containing installed dependencies, generated files, or development tool data can significantly increase the volume of files to analyze. The scanner excludes directories including: .git
.idea
.vscode
pycache
node_modules
vendor
.venv
venv
dist
build
coverage
An educational example using the Python standard library could look like this: import os
from pathlib import Path

EXCLUDED_DIRS = {
".git",
".idea",
".vscode",
"pycache",
"node_modules",
"vendor",
".venv",
"venv",
"dist",
"build",
"coverage",
}

de...
Python Project Scanner: Static Analysis Architecture
Powered by Readybot.io

The latest from Pixel

Incident Response: Look Beyond the Red Alert

Pixel’s DEV Community announcement explores how teams can fixate on one failing service while overlooking the real cause of an outage, such as a full …

Sach: AI Fact-Checks WhatsApp Forwards in India

Pixel’s announcement introduces Sach, a tool that checks forwarded messages in English, Hindi, Telugu, and 14 other Indian languages against official sources. It gives cited …

Java 25 Removes SecurityManager: What to Fix

Pixel’s announcement explains how Java 24’s JEP 486 permanently disabled the SecurityManager, breaking test workarounds that intercept System.exit. It recommends returning exit codes or throwing …