Skip to main content

sqr-lite — preview release of the sqr PyPI package

A reduced edition of sqr containing only the AST-driven extractors and analyses. There is no traceability layer, no sphinx-needs integration, no on-target verification, no release machinery — just diagrams and code-quality metrics.

This subdirectory is a side-project of the parent repository. Its purpose is to ship the lite subset to PyPI under the package name sqr while the full edition is still in development. Once the full version stabilises, sqr-lite gets folded back in.

Surface Name
PyPI distribution sqr (you pip install sqr)
Python import package sqr_lite (from sqr_lite import ...)
CLI script sqr-lite

What's in it

Capability Subcommand Backed by
Component diagrams (one per module / composite) sqr-lite extract static clang AST
Sequence diagrams (one per behaviour) sqr-lite extract dynamic clang AST
Activity diagrams (one per traced function) sqr-lite extract activity clang AST
LCOM4 cohesion per module sqr-lite analyse lcom clang AST
McCabe V(G) per function sqr-lite analyse cyclomatic clang AST
Worst-case stack depth per function sqr-lite analyse stack clang .su + AST call graph

Everything except analyse stack runs from the .ast files already produced by your build (clang -emit-ast). analyse stack additionally needs -fstack-usage -fcallgraph-info=su.

Installation

From PyPI (latest release):

pip install sqr-lite
sqr-lite --help

From a local checkout (editable install, picks up source edits):

cd sqr-lite/
poetry install --with dev
poetry run sqr-lite --help

The build uses poetry-dynamic-versioning, so the package version comes from the git tag — install it once as a Poetry plugin:

poetry self add "poetry-dynamic-versioning[plugin]"

Releases

The published version is derived from a git tag of the form vX.Y.Z-lite (e.g. v0.0.1-lite). Pushing such a tag triggers the publish-lite.yml workflow, which builds the wheel + sdist and publishes to PyPI via OIDC trusted publishing. The full sqr edition ships under vX.Y.Z-full tags through a parallel workflow, so the two version streams stay independent.

Configuration

sqr-lite reads [project.sqr] from any .toml file in (or above) the working directory — the same schema the full sqr edition uses. Extra sections (testing, review, release, target, …) are silently ignored, so a project can ship one config that drives both editions.

Minimal example:

[project.sqr]
output = "sqr-out"

[project.sqr.architecture]
build = "build"
source = "src"

[[project.sqr.architecture.behaviour]]
name = "main_loop"
description = "Top-level main loop."
entry_point = "main"
generated = "sqr-out/dynamic/main_loop.puml"

[[project.sqr.architecture.component]]
name = "core.scheduler"
static_generated = "sqr-out/static/scheduler.puml"
activity_generated = "sqr-out/activity/scheduler.puml"
activity_function = "scheduler_tick"

[project.sqr.verification.architecture.lcom]
enabled = true
warning_threshold = 2
error_threshold = 5

[project.sqr.verification.unit.cyclomatic]
enabled = true
warning_threshold = 11
error_threshold = 21

[project.sqr.verification.unit.stack_usage]
enabled = true
budget = 4096
# su_files defaults to [architecture].build (the call graph is
# derived from the loaded ASTs — no separate cgraph input).

The full reference is in docs/source/configuration.md; the same key names apply.

Typical run

# 1. Build with clang so .ast (+ .su if stack analysis) are produced.
cmake --build build/

# 2. Extract diagrams.
sqr-lite extract all

# 3. Run the analyses that are enabled in the config.
sqr-lite analyse all

Each analyse subcommand exits non-zero when any function/module crosses its configured error threshold (or when stack budget is overrun).

Relationship to sqr

sqr-lite is a strict subset of sqr. Its source is copied, not imported from sqr — this lets the two ship as independent distributions. Logic kept in lockstep:

  • architecture/{static,dynamic,activity,render,models}.py
  • analyses/{lcom,cyclomatic,stack}.py
  • utility/ast_loader.py
  • utility/config/{loader,schema,architecture}.py (the verification schema is a reduced subset).

When the parent sqr changes one of those files, the sqr-lite copy needs the same change. There is no automatic synchronisation — that's the price of keeping sqr-lite trivially installable on its own.

Metadata

Release files for sqr 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqr 0.0.1
File Size Uploaded
sqr-0.0.1.tar.gz 55.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sqr 0.0.1
File Interpreter ABI Platform
sqr-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 121.5 kB

Release files / sqr-0.0.1.tar.gz

Download URL sqr-0.0.1.tar.gz
Size 55.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1e728173dfe088dd045ee720ab64a971ec195c777f9fad4c68a99cd76bcba80a
BLAKE2b-256 checksum
How to use checksums
77ce2efef608b9a793454325dae80d4c8ef545a1ceb6e80bceb3033f3272b235
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.

Transparency log

Release files / sqr-0.0.1-py3-none-any.whl

Download URL sqr-0.0.1-py3-none-any.whl
Size 65.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dbe0a25c62534d08435c80d4ec621a8d0a2e204eeb8da851c8acc847c71e1dd2
BLAKE2b-256 checksum
How to use checksums
fc52132c3060daf39040f8cd641c301853d417e88910572fcdc0b633389489f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page