pytm
What it is
pytm is a free, open-source Python framework for building threat models from software architecture. Users describe systems in Python with elements such as servers, data stores, actors, processes, data flows, and trust boundaries. From that model, pytm can generate data flow diagrams, sequence diagrams, and relevant threats. Templates can create reports with diagrams and findings, while a RevealMD template produces browser-presentable slides. Data flow diagrams use Graphviz DOT; sequence diagrams use PlantUML. Models can also be imported from JSON with pytm’s Python load function. Users can supply a custom threats file and override finding details such as CVSS score, response text, and severity. The project aims to move threat modeling earlier in development and make it more automated and developer-centric. Listed requirements include Linux or macOS, Python 3.11 or later, Graphviz, Java OpenJDK 10 or 11, and plantuml.jar. Windows use is documented through a Devbox setup for WSL, and container and Devbox workflows are available for managing dependencies. The README warns that strings in threats.json are evaluated with eval(), so the file’s permissions should be protected against changes by an attacker.
For and against
For
- Generates diagrams and relevant threats from a model.
- Templates can produce reports and browser-presentable slides.
- Supports importing models from JSON.
- Finding attributes can be overridden.
Against
- Requires Python 3.11 or later.
- Diagram generation requires Graphviz and Java/PlantUML.
- Windows setup uses WSL through Devbox.
- Editable threats.json strings are evaluated with eval().
The verdict
pytm turns a Python-defined architecture into threat findings, diagrams, and report outputs. Its listed dependencies and the eval() behavior of threats.json are important setup and file-permission considerations.
Who it suits
pytm suits developers who want to define architecture and threat findings in Python and generate diagrams or reports from that model. It can also fit teams that customize threat files and finding attributes.
Plans and prices
Open-source pytm
Python 3.11+ · Requires Graphviz and Java/PlantUML for diagram generation
Read 8 Oct 2026 · github.com
On the record
- Diagram integrations
- Diagram output uses Graphviz DOT for data flow diagrams and PlantUML for sequence diagrams.github.com · read 8 Oct 2026
- Generated outputs
- From an architectural model, pytm can generate data flow diagrams, sequence diagrams, and relevant threats.github.com · read 8 Oct 2026
- Intended users
- The project describes its goal as shifting threat modeling earlier and making it more automated and developer-centric.github.com · read 8 Oct 2026
- Maker
- OWASP describes itself as a nonprofit foundation dedicated to improving software security through open-source collaboration, education, and innovation.owasp.org · read 8 Oct 2026
- Model import
- A threat model can be imported from JSON using pytm's Python load function.github.com · read 8 Oct 2026
- Modeling approach
- Threat models are defined in Python using elements such as servers, data stores, actors, processes, data flows, and trust boundaries.github.com · read 8 Oct 2026
- Other tooling
- The project documents container and Devbox workflows for managing dependencies, and uses Pandoc in its example report-generation command.github.com · read 8 Oct 2026
- Platform requirements
- The listed requirements are Linux or macOS, Python 3.11 or later, Graphviz, Java OpenJDK 10 or 11, and plantuml.jar.github.com · read 8 Oct 2026
- Purpose
- pytm is a Pythonic framework for threat modeling intended to make threat modeling more automated and developer-centric.github.com · read 8 Oct 2026
- Reports and slides
- Templates can produce reports containing diagrams and findings, and a RevealMD template can create browser-presentable slides.github.com · read 8 Oct 2026
- Security caution
- The README warns that strings in threats.json are evaluated with eval() and says to protect the file's permissions to prevent code execution by an attacker who can change those strings.github.com · read 8 Oct 2026
- Threat customization
- Users can provide a custom threats file and override finding attributes such as CVSS score, response text, and severity.github.com · read 8 Oct 2026
- Windows usage
- The project documents a Devbox setup for Windows through WSL.github.com · read 8 Oct 2026