Canonical object model for Behave projects
Project description
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 — Pure frozen 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file behave_model-1.0.1.tar.gz.
File metadata
- Download URL: behave_model-1.0.1.tar.gz
- Upload date:
- Size: 58.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1dd82cb3603846e045e5423ad5f99c4f42160858c21de83eeec18353340290f
|
|
| MD5 |
66e70d9d95dce0ac7515d6e5f37436af
|
|
| BLAKE2b-256 |
75e3e94cbac6d553e1e46496ec73960bb1a63561cf5b06ab92c2715a6eba7470
|
Provenance
The following attestation bundles were made for behave_model-1.0.1.tar.gz:
Publisher:
release.yml on MathiasPaulenko/behave-model
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
behave_model-1.0.1.tar.gz -
Subject digest:
d1dd82cb3603846e045e5423ad5f99c4f42160858c21de83eeec18353340290f - Sigstore transparency entry: 2043055183
- Sigstore integration time:
-
Permalink:
MathiasPaulenko/behave-model@4fa17e40065d9b3a0360e4fc2ff5579be4e8192d -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/MathiasPaulenko
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4fa17e40065d9b3a0360e4fc2ff5579be4e8192d -
Trigger Event:
push
-
Statement type:
File details
Details for the file behave_model-1.0.1-py3-none-any.whl.
File metadata
- Download URL: behave_model-1.0.1-py3-none-any.whl
- Upload date:
- Size: 33.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51bdc9e67a9a7fc356161f9fde9399f95af30a9cf77a1423e5c1668dd9c9e3e6
|
|
| MD5 |
e6236b21036a82e0e38c5f782ffba3b3
|
|
| BLAKE2b-256 |
90ce44abceec21440135406ac24511356746a56bece3bb58bf6c7b8a76dc8218
|
Provenance
The following attestation bundles were made for behave_model-1.0.1-py3-none-any.whl:
Publisher:
release.yml on MathiasPaulenko/behave-model
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
behave_model-1.0.1-py3-none-any.whl -
Subject digest:
51bdc9e67a9a7fc356161f9fde9399f95af30a9cf77a1423e5c1668dd9c9e3e6 - Sigstore transparency entry: 2043056953
- Sigstore integration time:
-
Permalink:
MathiasPaulenko/behave-model@4fa17e40065d9b3a0360e4fc2ff5579be4e8192d -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/MathiasPaulenko
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4fa17e40065d9b3a0360e4fc2ff5579be4e8192d -
Trigger Event:
push
-
Statement type: