Skip to main content

behave-model

The canonical object model for Behave projects.

CI PyPI Python License: MIT Coverage

Documentation · Getting Started · API Reference · Changelog


behave-model provides a clean, stable, and extensible Python API that represents every element of a Behave project — features, rules, scenarios, steps, tags, tables, docstrings, and more.

Why does this exist? Every Behave tooling project parses .feature files independently, duplicating effort and producing inconsistent results. behave-model provides a single, well-tested domain model so that tools can depend on it instead of reinventing the parser.

Installation

pip install behave-model

Quick Example

from behave_model import load_project

project = load_project("features/")

# Query scenarios by tag
for scenario in project.find_scenarios(tag="@smoke"):
    print(scenario.name)

# Statistics
stats = project.statistics()
print(f"{stats['features']} features, {stats['scenarios']} scenarios, {stats['steps']} steps")

# Validate
from behave_model import Validator
issues = Validator().validate(project)
for issue in issues:
    print(f"[{issue.severity}] {issue.message}")

Requirements

  • Python >= 3.11
  • behave >= 1.2.6 (only runtime dependency)

Features

  • Gherkin v6 — Full Rule keyword support
  • Domain model — Plain dataclasses for every Gherkin element
  • Visitor pattern — DFS/BFS tree traversal with custom visitors
  • Query API — Filter by name, tag, keyword, or text content
  • Serializers — Dict, JSON, and pretty-printed Gherkin output
  • Transformations — Rename, sort, normalize, add/remove tags and scenarios
  • Validation — Pluggable rule framework with built-in checks
  • Statistics — Project metrics out of the box

Documentation

All guides, API reference, examples, and architecture docs are at mathiaspaulenko.github.io/behave-model.

Development

git clone https://github.com/MathiasPaulenko/behave-model.git
cd behave-model
pip install -e ".[dev]"
make test        # run tests
make lint        # lint with ruff
make docs-serve  # serve docs locally

Contributing

Contributions are welcome! See the Contributing guide for guidelines.

License

MIT — see LICENSE.

Metadata

Release files for behave-model 1.1.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 behave-model 1.1.1
File Size Uploaded Provenance Actions
behave_model-1.1.1.tar.gz 72.4 kB With provenance Details for behave_model-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for behave-model 1.1.1
File Interpreter ABI Platform Actions
behave_model-1.1.1-py3-none-any.whl Python 3 none any Details for behave_model-1.1.1-py3-none-any.whl

Total release size: 111.0 kB

Release files / behave_model-1.1.1.tar.gz

Download URL behave_model-1.1.1.tar.gz
Size 72.4 kB
Tags Source
SHA-256 checksum
How to use checksums
688c59d1487b79833cf21ec4e92ed85c90c6687201c2914786c88d05af16e62e
BLAKE2b-256 checksum
How to use checksums
5e222af5b7ec5cebcc2dfbed84df5b3d0599bbc7562378386bd876888d729a60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 17, 2026.

Transparency log

Release files / behave_model-1.1.1-py3-none-any.whl

Download URL behave_model-1.1.1-py3-none-any.whl
Size 38.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af5724f066d2142a67b2462f644b108d723d596e8d2ca691ffd728e33545b28b
BLAKE2b-256 checksum
How to use checksums
4cf4a4037f1ebe637cceacdc73eca6e15361737667da8d6c6b63eb3c669c8279
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 17, 2026.

Transparency log

Security for behave-model 1.1.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for behave_model-1.1.1.tar.gz

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 Nov 17, 2026.

Transparency log

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