Skip to main content

speculast

speculast is an installable Python framework for semantic code analysis, automatic pytest generation, infrastructure detection, and visual reporting.

speculast parses Python projects through AST analysis, tracks semantic changes, detects external dependencies, prepares test suites, can orchestrate Docker-backed integration runs, and produces a self-contained HTML report.

What speculast Does

  • analyzes Python modules and projects at the semantic level;
  • extracts functions, methods, imports, and external calls;
  • detects infrastructure requirements such as PostgreSQL and Redis;
  • generates production-style pytest suites;
  • runs a full cycle with Docker, pytest, coverage, and JSON reports;
  • builds timestamped HTML dashboards grouped by day under reports/.

Installation

Use Python 3.12+. The project is packaged through pyproject.toml.

python -m venv .venv

Windows:

.venv\Scripts\activate
python -m pip install --upgrade pip
python -m pip install .

Linux / macOS:

source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install .

After installation, the CLI command speculast becomes available in the active environment.

CLI Quick Reference

speculast [PATH] [--no-tests] [--no-viz] [--no-real-db] [--no-cleanup] [--lang ru|en] [--cleanup-reports] [--report-retention-days N]

Examples:

speculast
speculast path/to/module.py
speculast . --cleanup-reports --report-retention-days 7
speculast . --no-tests
speculast . --no-viz --lang en

By default, speculast runs in Full Auto mode:

  • uses the current directory when PATH is omitted;
  • cleans temporary root-level technical noise automatically;
  • enables real DB mode by default;
  • runs generated tests;
  • builds the HTML report;
  • opens the fresh report in the browser automatically.

--cleanup-reports additionally prunes aged HTML reports from reports/.

The default full cycle performs:

  1. semantic analysis;
  2. test generation;
  3. infrastructure planning;
  4. docker compose up -d when services are required;
  5. pytest execution with coverage and JSON reports;
  6. HTML report generation;
  7. docker compose down --remove-orphans.

Template and Report Portability

speculast resolves Jinja and HTML templates through importlib.resources. This means the package can locate bundled templates correctly after pip install ., even when speculast is started from an unrelated working directory.

Bundled resources include:

  • engine/generator/templates/*.jinja2
  • engine/visualizer/templates/report.html

Scenario A: Quick Start on Any OS

Install the package and run the full autonomous cycle against the current project:

python -m pip install .
speculast

Expected outputs:

  • generated test suite under tests/;
  • docker-compose.yaml when infrastructure is required;
  • date-grouped reports such as reports/2026-05-14/report_131530.html.

If you also want to keep raw pytest and coverage JSON artifacts:

speculast . --no-cleanup

If you only need the report without pytest execution:

speculast . --no-tests

Scenario B: Windows + Docker Desktop

Recommended stack:

  • Python 3.12+
  • Docker Desktop
  • PowerShell or Windows Terminal

Typical workflow:

.venv\Scripts\activate
python -m pip install .
speculast

Notes for Windows:

  • speculast can start and stop Docker-backed infrastructure for integration scenarios.
  • If PostgreSQL-backed tests are generated, make sure Docker Desktop is installed and available in PATH.
  • speculast writes final diagnostics into timestamped files inside reports/, while terminal output stays compact.

Scenario C: Linux / macOS Server Mode

speculast does not require a desktop UI. The report is generated as a plain HTML file that can be opened locally or archived as a build artifact.

Typical workflow:

source .venv/bin/activate
python -m pip install .
speculast /opt/projects/my-service --lang en

Recommended environment preparation:

  • install Docker Engine or Docker Desktop for container-backed tests;
  • ensure the current user can run docker compose;
  • run inside a CI worker, VM, or server shell without GUI if needed.

For analysis-only mode on a server:

speculast /opt/projects/my-service --no-tests --no-viz

Scenario D: CI/CD Integration

The CLI is designed to be called directly from automated validation pipelines.

Minimal pipeline step:

python -m pip install .
speculast . --lang en

Recommended artifacts to publish from the job:

  • reports/
  • generated tests/ directory if you want to inspect emitted suites

If the pipeline should also retain raw pytest and coverage JSON files, run with --no-cleanup and publish:

  • .speculast/pytest-report.json
  • .speculast/coverage.json

Example GitHub Actions step:

- name: Install framework
  run: python -m pip install .

- name: Run semantic analysis and tests
  run: speculast . --lang en

Example GitLab CI job:

speculast:
  stage: test
  script:
    - python -m pip install .
    - speculast . --lang en
  artifacts:
    when: always
    paths:
      - reports/

Project Layout

engine/
  analyzer/    Semantic analysis and AST visitors
  core/        Pydantic models, i18n, protocols
  generator/   Jinja-based pytest generation templates and engine
  infra/       Infrastructure detection and Docker Compose helpers
  visualizer/  HTML dashboard rendering
main.py        CLI entry module
pyproject.toml Packaging metadata and script entry points

Installed CLI Entry Point

The package registers:

[project.scripts]
speculast = "main:main"

So after installation, speculast runs the same autonomous CLI cycle exposed by main.py.

Output Artifacts

Depending on the mode, the framework can generate:

  • tests/
  • docker-compose.yaml
  • reports/

Temporary technical artifacts such as .speculast/, cache folders, and browser-check profiles are removed automatically unless --no-cleanup is used.

Development Notes

Runtime dependencies are declared in pyproject.toml and include:

  • pydantic
  • jinja2
  • sqlalchemy
  • asyncpg
  • pytest
  • pytest-asyncio
  • pytest-cov
  • pytest-json-report
  • rich

Optional development extras:

python -m pip install .[dev]

Metadata

Release files for speculast 1.0.10

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

Source distribution (sdist)

Source distribution for speculast 1.0.10
File Size Uploaded Provenance Actions
speculast-1.0.10.tar.gz 85.6 kB Without provenance Details for speculast-1.0.10.tar.gz

Built distribution (wheel)

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

Total release size: 171.1 kB

Release files / speculast-1.0.10.tar.gz

Download URL speculast-1.0.10.tar.gz
Size 85.6 kB
Tags Source
SHA-256 checksum
How to use checksums
54dd7774b65493a11e28ccd78084f061eaa1cb1014915c0a091707631270231d
BLAKE2b-256 checksum
How to use checksums
da96a28418688199d03931cd04f6c4fda413782a76d1f0a118d95a02f6817f58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / speculast-1.0.10-py3-none-any.whl

Download URL speculast-1.0.10-py3-none-any.whl
Size 85.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
08db03403f863cfae329ada3197d43c743abb35b8f213d3758285592edc662dc
BLAKE2b-256 checksum
How to use checksums
5a462b31f0164fb37765695648fab08058b55496acc9a9d55919c578df811ce2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for speculast 1.0.10

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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