export:puml
Generate PlantUML diagrams from the active product’s feature model, database models, dependencies, and Docker topology.
Table of contents
- Usage
- Diagram modes
- Output options
- Examples
- Feature model (default)
- Class diagram (
--classes) - Dependency graph (
--deps) - Deployment diagram (
--deployment) - UVL resolution
- Refinement mixins
- Error reporting
- Requirements
- See also
Usage
splent export:puml [OPTIONS]
Diagram modes
By default, export:puml generates a feature model diagram. Use flags to select other modes.
| Flag | Diagram | What it shows |
|---|---|---|
| (none) | Feature model | Components with contracts (routes, models, services, hooks, env vars) + UVL constraints |
--classes |
UML class diagram | SQLAlchemy models with attributes, types, PKs, unique, nullable, methods, FK relationships with cardinality |
--deps |
Dependency graph | Clean feature nodes (colored by mandatory/optional) + requires arrows |
--deployment |
Docker deployment | Containers, images, ports, volumes, networks, and dependencies |
Output options
| Option | Description |
|---|---|
--pdf |
Also export as PDF (requires PlantUML + rsvg-convert) |
--png |
Also export as PNG |
--svg |
Also export as SVG |
-o PATH |
Custom output path (without extension) |
Files are saved to <product>/exports/puml/ by default.
Examples
# Feature model (default)
splent export:puml
# Class diagram as PDF
splent export:puml --classes --pdf
# Dependency graph as PNG
splent export:puml --deps --png
# Docker deployment as SVG
splent export:puml --deployment --svg
# All formats at once
splent export:puml --classes --pdf --png --svg
# Custom output path
splent export:puml --classes -o docs/diagrams/models --pdf
Feature model (default)
Generates a component diagram showing all features declared in pyproject.toml with the following details.
- Cardinality. Mandatory or optional (from UVL)
- Contract details. Routes, blueprints, models, services, hooks, docker, env vars (from
[tool.splent.contract]in each feature’spyproject.toml) - Dependencies.
requiresarrows between features (from UVL constraints)
splent export:puml
The output is written to exports/puml/<product>.puml.
Class diagram (--classes)
Parses models.py from each feature and generates a UML class diagram with the following elements.
- Classes grouped by feature (as
<<Feature>>packages) - Attributes. Name, type (
int,str,datetime,bool), stereotypes (<<PK>>,<<unique>>), nullable (?) - Methods. Public methods extracted from the model class
- Relationships. Foreign keys with cardinality (
"1" -- "1"or"1" -- "*"), detected fromdb.ForeignKeyanddb.relationship(handles both quoted and unquoted target names)
splent export:puml --classes
The output is written to exports/puml/<product>_classes.puml.
Example output
package "auth" <<Feature>> {
class User {
+ id : int <<PK>>
+ email : str? <<unique>>
+ password : str
+ created_at : datetime
+ active : bool
..
+ set_password()
+ check_password()
}
}
package "profile" <<Feature>> {
class UserProfile {
+ id : int <<PK>>
+ user_id : int <<unique>>
+ name : str
+ surname : str
}
}
User "1" -- "1" UserProfile : profile
Dependency graph (--deps)
A clean, minimal diagram showing only feature nodes and dependency arrows. Features are color-coded.
- Dark blue (
#2E86C1). Mandatory features - Light blue (
#AED6F1). Optional features
splent export:puml --deps
The output is written to exports/puml/<product>_deps.puml.
Deployment diagram (--deployment)
Reads all docker-compose.yml files (product + features + CLI) and generates a deployment diagram showing the following.
- Containers with appropriate shapes.
nodefor application containersdatabasefor MariaDB/MySQL/PostgreSQLstoragefor Rediscollectionsfor mail services (MailHog)
- Ports. The
host:containermappings - Dependencies.
depends_onrelationships - Named volumes. Persistent data volumes
splent export:puml --deployment
The output is written to exports/puml/<product>_deployment.puml.
UVL resolution
The command reads [tool.splent].spl from the product’s pyproject.toml and resolves that model the same way every other command does, from the working copy at splent_spl_<core>/, then from .splent_cache/spls/, then by downloading it with the DOI recorded under [tool.splent.spl_model].
If the product names no SPL, it falls back to the legacy [tool.splent.uvl].file configuration.
Refinement mixins
When generating class diagrams (--classes), features that declare [tool.splent.refinement].extends.models in their pyproject.toml are handled specially. Mixin classes (classes defined without explicit base classes) are detected and their attributes and methods are merged into the target model in the diagram. This means the class diagram reflects the fully composed model, not the raw source files.
Error reporting
When PlantUML fails to render a diagram, the actual PlantUML error output (stderr and stdout) is displayed directly, making it easier to diagnose syntax issues in the generated .puml file.
Requirements
- PlantUML. Required for
--pdf,--png,--svgrendering. Installed in the CLI Docker container. - rsvg-convert. Required for PDF/PNG conversion from SVG. Part of
librsvg2-binin the CLI container. - UVL file. Must be configured via
[tool.splent].spl(SPL catalog, preferred) or[tool.splent.uvl].file(legacy) in the product’spyproject.toml. - Feature contracts. For full detail in the feature model, features should have
[tool.splent.contract]in theirpyproject.toml(auto-generated byfeature:release).
See also
- product:validate. Validate the UVL model and check for conflicts between features
- feature:contract. Infer and write feature contracts