-
Notifications
You must be signed in to change notification settings - Fork 247
Create a wrapper script to generate python client; regenerate the python client #1347
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
Conversation
@snazy can you take a look at this draft? My impression is that I should be using the headers from |
592d2af
to
56477d4
Compare
87accb7
to
68ac664
Compare
592e296
to
53e8503
Compare
@@ -260,6 +260,7 @@ paths: | |||
parameters: | |||
- $ref: '#/components/parameters/page-token' | |||
- $ref: '#/components/parameters/page-size' | |||
- $ref: '#/components/parameters/prefix' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is needed due to an unfortunate bug in the python generator wherein parameters are overriden, not extended. Without this, the method list_namespaces
doesn't have a prefix
argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we make a note somewhere (e.g. spec/README.md
) that these changes are needed? Since iceberg-rest-catalog-open-api.yaml
should be a copy-paste of upstream one, we may easily lose track of these additional changes the next time we copy-paste from the upstream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, the CI will fail when a bad copy/paste happens. We need to wire up the CI to the new task but I would like to do that in a followup. For now, let me add this in the README!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: it'd be nice to add the comment directly here like Non functional change required by Python generator
. I believe this is the place where people may get confused every time pulling iceberg spec upstream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Just to confirm, currently we expect to manually regenerate the client after a spec change so the CI should not run the regeneration yet.
"./polaris/management/__pycache__/" | ||
"./polaris/management/models/__pycache__/" | ||
"./polaris/management/api/__pycache__/" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[non-blocker] Shall we add ./.DS_STORE
to exclude_paths for mac users? This makes running regenerate.sh
fails in my mac locally with
Re-applying license headers
No header compatible with file ./.DS_Store
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
) | |
"./.DS_Store" | |
"./poetry.lock" | |
) |
Also "poetry.lock" should be excluded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Synced with Eric offline, I believe we can solve this in a follow-up which automate the regeneration during test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I ran these commands from main: ``` redocly bundle spec/polaris-catalog-service.yaml -o spec/generated/bundled-polaris-catalog-service.yaml ./gradlew regeneratePythonClient ``` I didn't realize before that some Python types are generated form the bundled spec, so some of the fixes from #1347 didn't get properly applied before.
It looks like this method lost the `prefix` and `namespace` parameters in #1347. They're re-introduced to the spec here, and then I've run: ``` redocly bundle spec/polaris-catalog-service.yaml -o spec/generated/bundled-polaris-catalog-service.yaml ./gradlew regeneratePythonClient ``` Then, some manual reverts: ``` alias gitrevert='git checkout upstream/main --' gitrevert client/python/.github/workflows/python.yml gitrevert client/python/.gitlab-ci.yml gitrevert client/python/pyproject.toml ``` I still hope to automate this process as part of CI soon; see #1675
As noted in #755 and elsewhere, the generated types in
client/python
are currently out of date. This introduces a script to regenerate them and a gradle task to run that script.I've also run the script, which necessitated several things to get tests passing: