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

Generate Python dataclasses from Go status structs #2

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

benhoyt
Copy link
Owner

@benhoyt benhoyt commented Feb 14, 2025

To generate structs.py, run:

$ make getfields

# Which is equivalent to:

$ go run ./cmd/getfields/ >structs.py
$ uvx [email protected] format --line-length=99 --config "format.quote-style = 'single'" structs.py

This is the same as #1, but against the Juju main (4.0) branch.

Basically some metering stuff was removed. I think we probably want to use the 4.0 branch for the Jubilant types, so these extra fields don't show up in autocomplete -- just the ones common to 3.6 and 4.

This commit shows the diff of the generated structs.py.

@benhoyt benhoyt changed the title Generate Python dataclasses and from_dict from Go status structs (4.0 branch) Generate Python dataclasses from Go status structs (4.0 branch) Feb 14, 2025
@benhoyt benhoyt changed the title Generate Python dataclasses from Go status structs (4.0 branch) Generate Python dataclasses from Go status structs Feb 14, 2025
benhoyt added a commit to benhoyt/jubilant that referenced this pull request Feb 16, 2025
These come from the Go generator in:
benhoyt/juju#2
There's one anomaly on the Go side, "Attachments", that doesn't have a
JSON field name specified.
Currently it serializes as "Attachments", but it should be
"attachments" like all the other fields. This is a breaking change, but
we're considering it a bug fix, and it's very unlikely to break anyone.

Fixed in Juju in juju#18931
benhoyt added a commit to canonical/jubilant that referenced this pull request Feb 19, 2025
These come from the Go generator in: benhoyt/juju#2
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.

1 participant