behave-steplib

Reusable step libraries for Behave — share, discover and install step definitions across projects. Zero mandatory dependencies; each technology is an optional extra.

behave-steplib provides a modular, auto-registered collection of BDD step definitions for HTTP APIs, web browsers, databases, Kafka and generic data management. Steps are defined in English with Spanish (es) and Portuguese (pt) translations, fully typed, and discoverable via Python entry points.

Features at a glance

  • Modularapi, web, db, kafka, data, io, cli modules activated via extras and lazy imports.

  • Auto-registeredautoload(context) registers every installed step in one line.

  • Multilingual — steps defined in English with es and pt translations; all patterns are registered with behave so matching works regardless of active language.

  • Typed — full type hints, mypy --strict clean, py.typed marker included.

  • CLIsteplib list / show / validate / init powered by Typer.

  • Pluggable — third-party packages can register steps via the steplib.plugins entry point group.

  • Ecosystem — integrates with behave-kit, behave-tables and behave-data when installed.

  • Backends — each module supports multiple backends (e.g. stdlib/httpx/requests for API, selenium for web) selectable at autoload time.

Three adoption levels

Level 1 — Automatic wiring:

from steplib.behave import autoload

def before_all(context):
    context.steplib = autoload(context)

def before_scenario(context, scenario):
    context.steplib.reset()

def after_scenario(context, scenario):
    context.steplib.cleanup()

Level 2 — Explicit load:

from steplib.behave import load

def before_all(context):
    context.steplib = load(context, "steplib.modules.api.steps")

Level 3 — Filtered autoload:

from steplib.behave import autoload

def before_all(context):
    context.steplib = autoload(
        context,
        categories=["api"],
        backends={"api": "httpx"},
    )

Installation

pip install behave-steplib

With optional extras:

pip install "behave-steplib[api,requests,web,db,kafka,data]"

License

MIT — see LICENSE.