Skip to main content

Translate between Python tests, Gherkin behavior specs, and BDD execution evidence

Project description

PyPI - Version PyPI - Python Version PyPI - Downloads codecov

specweave

SpecWeave translates between canonical Gherkin behavior specs, plain pytest enforcement, and normalized execution evidence.

It is not a task ledger, architecture ledger, or CI system.

Canonical layout

specweave.toml
specs/behavior/README.md
specs/behavior/manifest.json
specs/behavior/features/<area>/<feature>.feature
specs/behavior/evidence/*.json
specs/behavior/mappings/taskledger/*.json
tests/test_<area>_<feature>.py
specs/behavior/reports/*.xml
specs/behavior/reports/specweave/*.json

Hidden .specweave.toml is still discovered for existing projects, but specweave.toml is the default config file and classic .feature is the only canonical feature format.

Behavior workflow

specweave init
specweave doctor
specweave create gherkin --from-tests tests --out specs/behavior/features
specweave review specs
specweave review coverage --view both --show gaps
specweave behavior index
specweave behavior generate-tests --features specs/behavior/features --tests-dir tests
pytest --junitxml=specs/behavior/reports/pytest-junit.xml
specweave behavior import-report specs/behavior/reports/pytest-junit.xml --format junit-xml

Classic Gherkin only

Canonical specs use classic Gherkin:

@area-auth @feature-password-login
Feature: Password login
  Users authenticate with a password.

  @rule-invalid-password
  Rule: Invalid passwords are rejected

    @bdd-password-login-invalid-password @ac-0001
    Example: Reject invalid password
      Given a registered user exists
      When the user submits an invalid password
      Then login is rejected
      And no authenticated session is created

Legacy .feature.md files are no longer supported as canonical specs.

Evidence and mappings

  • normalized evidence: specs/behavior/evidence
  • Taskledger mapping artifacts: specs/behavior/mappings/taskledger
  • generated runner output: specs/behavior/reports
  • SpecWeave runner summaries: specs/behavior/reports/specweave

Import pytest/JUnit evidence with:

specweave behavior import-report \
  specs/behavior/reports/pytest-junit.xml \
  --format junit-xml \
  --out specs/behavior/evidence/pytest-evidence.json

Optional Taskledger integration

Taskledger exchange is file-based:

specweave behavior import-taskledger \
  specs/behavior/mappings/taskledger/task-0123.json \
  --out specs/behavior/features/task-management/plan-gates.feature

specweave create taskledger-task \
  --feature specs/behavior/features/task-management/plan-gates.feature \
  --out specs/behavior/mappings/taskledger/draft.json

Trace and cross-ledger diagnostics remain read-only:

specweave trace @bdd-login-success --format json
specweave combi check --json specs/behavior/reports/specweave/combi-check.json

Installation

pip install specweave
pip install specweave[gherkin]   # optional official Cucumber parser
pip install -e ".[dev]"          # development tools

Development

pytest -q
ruff check .
ruff format --check .
mypy specweave

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

specweave-0.2.0.tar.gz (211.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

specweave-0.2.0-py3-none-any.whl (97.1 kB view details)

Uploaded Python 3

File details

Details for the file specweave-0.2.0.tar.gz.

File metadata

  • Download URL: specweave-0.2.0.tar.gz
  • Upload date:
  • Size: 211.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for specweave-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6a577931881a159a40d2bf26f79be4bf62778996ccb6e7b696c8f5a1df6a8e0d
MD5 dd178a5058f330fb9280cc462a3ad3ce
BLAKE2b-256 e18ff5b0106b979859932e8fefc048e40563e48216afba1231ed5bcb127c8337

See more details on using hashes here.

File details

Details for the file specweave-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: specweave-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 97.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for specweave-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2d2fd5b64f5c12b7f88ffe137bcc533819f44a91066e554a0298006d26706e5
MD5 5cad3dff027cc6b8629ca628d80422a4
BLAKE2b-256 c5a88079d2a5411520634febd711ebb3eb27912f5ab9b44092196fb29a282afe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page