Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Use buf to generate python stubs #346

Merged
merged 11 commits into from
Nov 29, 2022
Merged

Use buf to generate python stubs #346

merged 11 commits into from
Nov 29, 2022

Conversation

eapolinario
Copy link
Contributor

TL;DR

Use buf to generate python stubs and pyi files

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

As described in https://developers.google.com/protocol-buffers/docs/news/2022-05-06, starting on version 4.21.0, the python protobuf package is based on the upb library. This requires us to remove the upper bound we put on the protobuf package if we are to leverage these new features. We are also receiving a fair amount of questions regarding the supported version of protobuf from Flyte users, so all in all it's a good time to relax that constraint.

This PR does two things:

  1. Use buf to generate the python stubs
  2. Generate the pyi files, which unlocks the removal of model files in flytekit.

Tracking Issue

Remove the 'fixes' keyword if there will be multiple PRs to fix the linked issue

fixes https://github.com/flyteorg/flyte/issues/

Follow-up issue

NA
OR
https://github.com/flyteorg/flyte/issues/

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Nov 28, 2022

Codecov Report

Merging #346 (3a8ba84) into master (0d0c0ed) will decrease coverage by 2.34%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #346      +/-   ##
==========================================
- Coverage   75.46%   73.12%   -2.35%     
==========================================
  Files          18       18              
  Lines        1174     1362     +188     
==========================================
+ Hits          886      996     +110     
- Misses        237      315      +78     
  Partials       51       51              
Flag Coverage Δ
unittests 73.12% <ø> (-1.99%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
clients/go/admin/auth_interceptor.go 70.73% <0.00%> (-5.74%) ⬇️
clients/go/admin/oauth/config.go 75.00% <0.00%> (-5.00%) ⬇️
clients/go/admin/authtype_enumer.go 23.68% <0.00%> (-3.59%) ⬇️
clients/go/admin/deviceflow/token_orchestrator.go 60.74% <0.00%> (-3.45%) ⬇️
clients/go/admin/config.go 16.66% <0.00%> (-3.34%) ⬇️
clients/go/admin/token_source.go 85.00% <0.00%> (-3.24%) ⬇️
clients/go/coreutils/extract_literal.go 83.63% <0.00%> (-3.16%) ⬇️
...admin/tokenorchestrator/base_token_orchestrator.go 50.94% <0.00%> (-2.55%) ⬇️
clients/go/admin/config_flags.go 56.25% <0.00%> (-2.45%) ⬇️
clients/go/admin/client_builder.go 71.42% <0.00%> (-2.26%) ⬇️
... and 8 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
wild-endeavor
wild-endeavor previously approved these changes Nov 29, 2022
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
run: python3 /usr/local/bin/entrypoint.py -i ./protos -d protos/flyteidl/plugins -l python
- name: Proto-Datacatalog-Python
run: python3 /usr/local/bin/entrypoint.py -i ./protos -d protos/flyteidl/datacatalog -l python
# - name: Proto-Service-Python
Copy link
Member

Choose a reason for hiding this comment

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

should we remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will all be removed once we move the other plugins to buf. Leaving it like this is a good indication that we're in this in-between state.

@eapolinario eapolinario merged commit f4ede35 into master Nov 29, 2022
@eapolinario eapolinario deleted the enable-buf branch November 29, 2022 23:31
eapolinario added a commit that referenced this pull request Feb 22, 2023
This reverts commit f4ede35.

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
eapolinario added a commit that referenced this pull request Sep 8, 2023
* Buf python migration

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Generate pyi files

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Add venv to .gitgnore

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Use buf to generate python stubs

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Use buf docker image to generate stubs

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Add stubs produced by call to `buf generate` using buf's docker image

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Add pyi files

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Use buf locally

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Verify that generated protos by using buf

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Copy generated code to a separate artifact

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

* Move back to go_generate.yml@master

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Co-authored-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants