gherkin-official
Gherkin parser (official, by Cucumber team)
What it is and what it does
Gherkin is the official parser and compiler for the Gherkin language, maintained by the Cucumber team. It reads Gherkin feature files (plain-text specifications written in a business-readable syntax) and converts them into structured data—abstract syntax trees and pickles—that testing frameworks can execute. The library is designed to work in-process, producing easily consumable objects without requiring subprocess calls or JSON parsing.
You can use it either as a library (the recommended approach) or via a command-line interface that outputs newline-delimited JSON conforming to the Cucumber Event Protocol. It supports multiple languages through i18n translations and handles table cell escaping. The package depends only on typing-extensions and supports Python 3.10 through 3.14.
Use it for:
- Parse .feature files in a test runner to convert Gherkin scenarios into executable test cases.
- Build custom BDD tooling that consumes Gherkin specifications and generates test code or reports.
- Validate Gherkin syntax in feature files before passing them to Cucumber or similar frameworks.
- Extract and analyze test scenarios from feature files for documentation or coverage reporting.
- Integrate Gherkin parsing into CI/CD pipelines to compile feature files into intermediate representations.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses and compiles Gherkin feature files into abstract syntax trees and pickles for behavior-driven development testing frameworks.
Yes. This is the official Gherkin parser maintained by the Cucumber team, actively developed, permissively licensed (MIT), and has minimal dependencies. Install it if you need to parse or compile Gherkin feature files programmatically or integrate BDD workflows into custom tooling. The only constraint is a Python 3.10+ requirement.
Install
gherkin-official on PyPI
pip
pip install gherkin-officialuv
uv add gherkin-officialpoetry
poetry add gherkin-officialInstalling gherkin-official
Before you install
Low install friction with a single lightweight runtime dependency (typing-extensions). Active maintenance with a recent release (9 days old) and steady repository activity.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and proprietary projects.
Quickstart
from gherkin import Compiler, Parser
gherkin_document = Parser().parse("Feature: ...")
gherkin_document["uri"] = "uri_of_the_feature.feature"
pickles = Compiler().compile(gherkin_document)
Requires Python 3.10 or later.
Verify before relying
- Whether the library API is stable across minor versions or subject to breaking changes
- Performance characteristics when parsing large feature files or many files in sequence
- Whether i18n support covers all languages needed for your test suite
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — typing-extensions |
| Maintenance | actively maintained — 9 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,846,540/month — #2,863 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: gherkin_official-42.0.1-py3-none-any.whl
Keywords: gherkin, cucumber, bdd
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
cucumber-tag-expressionsParses and evaluates boolean tag expressions…
permissive · top 5,000 on PyPI
reformat-gherkinAutomatically formats Gherkin feature files to…
permissive · top 15,000 on PyPI
cucumber-expressionsCucumber Expressions provides a simpler, more…
permissive · top 5,000 on PyPI
pytest-bddpytest-bdd implements Gherkin-based…
permissive · top 5,000 on PyPI
radish-bddradish is a Behavior Driven Development (BDD)…
permissive · top 15,000 on PyPI
behavebehave is a behavior-driven development (BDD)…
permissive · top 5,000 on PyPI
behave-djangoIntegrates Behave BDD testing into Django…
permissive · top 15,000 on PyPI
tree-sitter-javaProvides a Java language grammar for…
permissive · top 5,000 on PyPI
tree-sitter-rubyProvides a Ruby language grammar for…
permissive · top 5,000 on PyPI
aws-lambda-buildersCompiles, builds, and packages AWS Lambda…
permissive · top 5,000 on PyPI