Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Python example to latest API #203

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

kieran-ryan
Copy link
Member

@kieran-ryan kieran-ryan commented Dec 30, 2023

🤔 What's changed?

Updated the Python example for compatibility with the latest API of the package.

⚡️ What's your motivation?

Fix Python example so is working and runnable.

See the compiler.py module for API reference.

Current example, using previous API:

from gherkin.parser import Parser
from gherkin.pickles.compiler import compile

parser = Parser()
gherkin_document = parser.parse("Feature: ...")
pickles = compile(gherkin_document)
Traceback (most recent call last):
  File "/Users/<user>/projects/python/repository/script.py", line 2, in <module>
    from gherkin.pickles.compiler import compile
ImportError: cannot import name 'compile' from 'gherkin.pickles.compiler' (/Users/<user>/projects/python/repository/venv/lib/python3.10/site-packages/gherkin/pickles/compiler.py)

Updated example runs without issue:

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

parser = Parser()
gherkin_document = parser.parse("Feature: ...")
pickles = Compiler().compile(gherkin_document)

🏷️ What kind of change is this?

  • 🏦 Refactoring/debt/DX (improvement to code design, tooling, documentation etc. without changing behaviour)

♻️ Anything particular you want feedback on?

NA.

📋 Checklist:

@kieran-ryan kieran-ryan self-assigned this Jan 2, 2024
@mpkorstanje mpkorstanje merged commit 64a6d5e into cucumber:main Jan 4, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants