Installation

Using pip (or …)

Category:

Stable version

Precondition:

pip (or setuptools) is installed

Execute the following command to install behave with pip:

pip install behave

To update an already installed behave version, use:

pip install -U behave

Hint

See also pip related information for installing Python packages.

Using a Source Distribution

After unpacking the behave source distribution, enter the newly created directory “behave-<version>” and run:

python setup.py install

# OR:
pip install .

Using the GitHub Repository

Category:

Bleeding edge

Precondition:

pip is installed

Run the following command to install the newest version from the GitHub repository:

pip install git+https://github.com/behave/behave

To install a tagged version from the GitHub repository, use:

pip install git+https://github.com/behave/behave@<TAG>

where <TAG> is the placeholder for an existing tag.

When installing extras, use <TAG>#egg=behave[...], e.g.:

pip install git+https://github.com/behave/behave@v1.2.7.dev5#egg=behave[toml]

Optional Dependencies

If needed, additional dependencies (“extras”) can be installed using pip install with one of the following installation targets.

Installation Target

Description

behave[docs]

Include packages needed for building Behave’s documentation.

behave[develop]

Optional packages helpful for local development.

behave[formatters]

Install formatters from behave-contrib to extend the list of formatters provided by default.

behave[toml]

Optional toml package to configure behave from ‘toml’ files, like ‘pyproject.toml’ from pep-518.

Specify Dependency to “behave”

Use the following recipe in the "pyproject.toml" config-file if:

  • your project depends on behave and

  • you use a version from the git-repository (or a git branch)

EXAMPLE:

# -- FILE: my-project/pyproject.toml
# SCHEMA: Use "behave" from git-repository (instead of: https://pypi.org/ )
#   "behave @ git+https://github.com/behave/behave.git@<TAG>"
#   "behave @ git+https://github.com/behave/behave.git@<BRANCH>"
#   "behave[VARIANT] @ git+https://github.com/behave/behave.git@<TAG>" # with VARIANT=develop, docs, ...
# SEE: https://peps.python.org/pep-0508/

[project]
name = "my-project"
dependencies = [
    "behave @ git+https://github.com/behave/behave.git@v1.2.7.dev5",
    # OR: "behave[develop] @ git+https://github.com/behave/behave.git@main",
]