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

Add type annotations to the python codebase #283

Merged
merged 30 commits into from
Sep 22, 2024
Merged

Conversation

youtux
Copy link
Contributor

@youtux youtux commented Sep 16, 2024

🤔 What's changed?

  • Added type annotations to the python codebase.
  • Added py.typed file marker

There are still quite some errors (actual bug, mypy idiosyncrasies, ...) , but at least all the signatures are annotated.

⚡️ What's your motivation?

Static type checking make things safer and easier to find usages.

🏷️ What kind of change is this?

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

♻️ Anything particular you want feedback on?

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

This text was originally generated from a template, then edited by hand. You can modify the template here.

@youtux youtux changed the title Add type annotations in python codebase Add type annotations to the python codebase Sep 16, 2024
@jsa34
Copy link
Contributor

jsa34 commented Sep 20, 2024

Perhaps instead of using typing.List instead of list for the typings, given I guess that we are so close to EOL for py3.8, should we just go for 3.9+?

@youtux youtux marked this pull request as ready for review September 21, 2024 08:05
@youtux
Copy link
Contributor Author

youtux commented Sep 21, 2024

Perhaps instead of using typing.List instead of list for the typings, given I guess that we are so close to EOL for py3.8, should we just go for 3.9+?

I fixed those lines, it was no big deal, so let's keep 3.8 until it goes EOL

Copy link
Contributor

@jsa34 jsa34 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just my initial spots

python/gherkin/parser_types.py Show resolved Hide resolved
python/gherkin/ast_builder.py Show resolved Hide resolved
@youtux youtux requested a review from jsa34 September 22, 2024 10:01
Copy link
Contributor

@jsa34 jsa34 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@jsa34 jsa34 merged commit 78b1c95 into main Sep 22, 2024
13 checks passed
@jsa34 jsa34 deleted the python-add-type-annotations branch September 22, 2024 12:16
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.

3 participants