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 messages implementation for python #165

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

elchupanebrej
Copy link

πŸ€” What's changed?

Add python implementation

🏷️ What kind of change is this?

  • ⚑ New feature (non-breaking change which adds new behaviour)

πŸ“‹ 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.
  • 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.

@elchupanebrej
Copy link
Author

This address to #162

@elchupanebrej
Copy link
Author

This was generated by https://github.com/koxudaxi/datamodel-code-generator with a small manual changes

Copy link
Contributor

@mpkorstanje mpkorstanje left a comment

Choose a reason for hiding this comment

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

At a glance this doesn't follow the pattern used by the other language implementations in quite a few ways. Please follow up the directions from #162 around code generation.

I also don't understand the purpose of the samples directory.

@elchupanebrej
Copy link
Author

@mpkorstanje

  1. For Python exists a tool that allows generating Pydantic models directly from json schema https://github.com/koxudaxi/datamodel-code-generator - So this allows not including an extra layer with templating. If you insist - I'll rewrite this by that approach.

  2. Samples are taken from gherkin repository to validate if serialization/deserialization works well. Adding external data to a python package is always an egg-chicken problem. I don't like to add external files by makefiles or any kind of scripts because they are always platform dependent. If another approach is used in cucumber - please let me know, and I'll adapt this PR

@elchupanebrej elchupanebrej marked this pull request as draft July 19, 2023 15:08
@mpkorstanje
Copy link
Contributor

mpkorstanje commented Jul 19, 2023

For Python exists a tool that allows generating Pydantic models directly from json schema

You can use Pydantic if you can make it fit into the make clean-all generate-all workflow. Though I suspect your manual edits might pose a problem.

Samples are taken from gherkin repository to validate if serialization/deserialization works well.

Consider narrowing this down to a few representative examples. Currently it is hard to see the forest for the trees.

Copy link
Contributor

@luke-hill luke-hill left a comment

Choose a reason for hiding this comment

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

If you're going to copy lots of the cck it would be better to fetch the data using some form of call rather than C+P as this is currently being rapidly updated

readme = {file = "README.md", content-type = "text/markdown"}
requires-python = ">=3.8"
urls = {Repository = "https://github.com/cucumber/messages"}
version = "0.1.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

This will need editing to conform to polyglot-release

Copy link
Author

Choose a reason for hiding this comment

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

Could you please give me a link to find out how to do this right?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we directly have a link. But we use a tool called polyglot-release to release internal tools.

If you look at how it is used. You'll see you'll need a version file that is directly auto-edited.

https://github.com/cucumber/polyglot-release

An example of "how" it auto-worked from the CLI can be viewed in this commit for gherkin
cucumber/gherkin@650109d

Here is "what" I did.

Ran a command on the CLI, then waited a few seconds or so.
It auto-generated this commit and changed all the relevant files (Check the python change)

.github/workflows/test-python.yml Show resolved Hide resolved
@elchupanebrej
Copy link
Author

At a glance this doesn't follow the pattern used by the other language implementations in quite a few ways. Please follow up the directions from #162 around code generation.

I also don't understand the purpose of the samples directory.

Agree, let do this in a few steps. At first - implementation, after that - generation

@elchupanebrej
Copy link
Author

Samples are taken from gherkin repository to validate if serialization/deserialization works well.

Consider narrowing this down to a few representative examples. Currently it is hard to see the forest for the trees.

Samples are used in tests. More complex tests could exist. I insist to include them for now

@@ -0,0 +1,15 @@
# How to make a release
Copy link
Contributor

Choose a reason for hiding this comment

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

This here should be using the auto-copy from polyglot-release.

See an example in one of the ruby projects I manage here: https://github.com/cucumber/cucumber-ruby/blob/main/RELEASING.md

Which links to: https://github.com/cucumber/.github/blob/main/RELEASING.md

This will tell you how to get a few things configured and setup, specifically for some of the internal toolings.

If you need more dedicated help, join us on slack @ cucumberBDD.slack.com

@mpkorstanje
Copy link
Contributor

mpkorstanje commented Jan 4, 2024

@elchupanebrej

Samples are used in tests. More complex tests could exist. I insist to include them for now

What purpose do these tests serve? They'll be a hassle to update if/when the schema changes.

@luke-hill
Copy link
Contributor

Hi @elchupanebrej - Just checking in to see where you're up to with this. Is this something you're still working on?

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.

None yet

3 participants