skillfed

gherkin-official

Gherkin parser (official, by Cucumber team)

gherkin-official v42.0.1 2.8M downloads/30d#2,863 on PyPI391
Permissive license MIT Active released

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-official

uv

uv add gherkin-official

poetry

poetry add gherkin-official

Installing 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

Programming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

gherkin parserfeature file parsingbdd test parsingcucumber gherkinfeature file compilergherkin astbehavior driven development parser
bddtestingparser

More Testing packages