behave-model
The canonical object model for Behave projects.
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
Rulekeyword 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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| behave_model-1.1.0.tar.gz | 65.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| behave_model-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 101.6 kB
Release files / behave_model-1.1.0.tar.gz
| Download URL | behave_model-1.1.0.tar.gz |
|---|---|
| Size | 65.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d0eebd0affec2e8f87f12291bdebef140a13eb12ea0dc1a1ec66d2b10ab917be
|
|
BLAKE2b-256 checksum How to use checksums |
99386b051d15bcf22f89623422fb5f66eb9a35ee8a54513b0b7eb2a170dc3802
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 3, 2026.
Transparency logRelease files / behave_model-1.1.0-py3-none-any.whl
| Download URL | behave_model-1.1.0-py3-none-any.whl |
|---|---|
| Size | 35.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5278a304b4108dacaf20211e1077f729176391e08dd1f47c6c108e7ee52f5e6f
|
|
BLAKE2b-256 checksum How to use checksums |
90d6c24af6eb3971bcdf1a486e6aac2a564b5e99ca0925a906fc7cb8eabd91dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 3, 2026.
Transparency log