Skip to content

Commit

Permalink
Expose Python API as package imports (#352)
Browse files Browse the repository at this point in the history
* feat: Expose public API as package imports
    - Update usage documentation
* debt: Drop redundant test module for removed Python 2 support
    - Python 2 compatibility character count code has been removed
  • Loading branch information
kieran-ryan authored Jan 8, 2025
1 parent 4412fb9 commit 5319c98
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
## [Unreleased]
### Added
- [.NET] Enabled overriding of parser's error-handling
- [Python] Expose Python public API as package imports ([#352](https://github.com/cucumber/gherkin/pull/352))

### Fixed
- [c] slight update to existing CMakeFiles.txt to propagate VERSION. Close #320 ([#328](https://github.com/cucumber/gherkin/pull/328))
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,9 @@ func main() {
#### Python

```python
from gherkin.parser import Parser
from gherkin.pickles.compiler import Compiler
from gherkin import Compiler, Parser

parser = Parser()
gherkin_document = parser.parse("Feature: ...")
gherkin_document = Parser().parse("Feature: ...")
gherkin_document["uri"] = "uri_of_the_feature.feature"
pickles = Compiler().compile(gherkin_document)
```
Expand Down
11 changes: 11 additions & 0 deletions python/gherkin/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""gherkin-official public API."""

from __future__ import annotations

from .parser import Parser
from .pickles.compiler import Compiler

__all__ = [
"Compiler",
"Parser",
]
13 changes: 0 additions & 13 deletions python/test/count_symbols_test.py

This file was deleted.

0 comments on commit 5319c98

Please sign in to comment.