skillfed

cucumber-expressions

Cucumber Expressions - a simpler alternative to Regular Expressions

cucumber-expressions v20.1.0 3.6M downloads/30d#2,577 on PyPI199
Permissive license MIT Active released

What it is and what it does

Cucumber Expressions is a pattern-matching library designed for behavior-driven development that replaces regular expressions with a more intuitive, human-readable syntax. It parses expressions like "I have {count} cucumbers" into structured patterns that can extract and validate test step parameters, making test definitions easier to write and understand compared to regex-based approaches.

The library has no external runtime dependencies and supports modern Python versions (3.10 through 3.14). It is actively maintained by the Cucumber project and positioned as a core component for BDD test frameworks that need readable, maintainable step definitions.

Use it for:

  • Write readable step definitions in BDD test suites without learning complex regex syntax
  • Parse and extract parameters from Gherkin-style test steps in behavior-driven tests
  • Build custom test frameworks that need human-friendly pattern matching for step matching
  • Integrate with Cucumber-based testing tools to standardize step expression syntax

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Cucumber Expressions provides a simpler, more readable alternative to regular expressions for pattern matching in behavior-driven development (BDD) test frameworks, with an intuitive syntax designed for test step definitions.

Yes. The package is actively maintained, has no dependencies, supports current Python versions, carries a permissive MIT license, and fills a genuine need in BDD testing by offering a more readable alternative to regex for test step definitions. Install it if you're building or using BDD test frameworks.

Install

cucumber-expressions on PyPI

pip

pip install cucumber-expressions

uv

uv add cucumber-expressions

poetry

poetry add cucumber-expressions

Installing cucumber-expressions

Before you install

Low install friction with no runtime dependencies. Actively maintained with a recent release (9 days old) and steady repository activity.

License in practice

MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects.

Quickstart

pip install cucumber-expressions

from cucumber_expressions import CucumberExpressionParser

parser = CucumberExpressionParser()
expression = parser.parse("I have {count} cucumbers")

Requires Python 3.10 or later.

Verify before relying

  • Whether the parser handles custom parameter types beyond built-in types
  • Performance characteristics when parsing complex expressions at scale
  • Integration examples with specific BDD frameworks (pytest-bdd, behave, etc.)

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 9 days since the last release
Last repo commit
First released
Downloads 3,558,089/month — #2,577 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: cucumber_expressions-20.1.0-py3-none-any.whl

Keywords: cucumber, BDD, testing, expressions

Development Status :: 3 - AlphaEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Testing

Tags

BDD step definition patternscucumber expressions alternative to regexbehavior driven development testingreadable test step matchingcucumber gherkin expressions
bdd-testingpattern-matching

More Python Modules packages