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

Fix python package and publish typing information #347

Merged
merged 4 commits into from Nov 30, 2022
Merged

Conversation

eapolinario
Copy link
Contributor

@eapolinario eapolinario commented Nov 30, 2022

TL;DR

Necessary init.py files were removed in #346

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

The python protoc plugin does not leave __init__.py in the generated code, which makes it hard for code like setuptools to package the generated stub code. We do something similar in https://github.com/backup-test-123/protogen/blob/first-commit/generate_protos.py#L171-L181 and in this PR puts those files back and leave some code in generate_protos.sh to generate those files.

This PR also publishes the typing information contained in the pyi files by specifying them in the package_data section in setuptools.setup.

I tested this by producing a wheel and testing it on a clean virtual environment. Here's a screenshot of this PR working in emacs:
Screenshot from 2022-11-29 18-07-19

On the left I'm showing the existing model file defined in flytekit and on the right hand side we can see a script importing the stub directly and having access to the field named closure.

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>
@codecov
Copy link

codecov bot commented Nov 30, 2022

Codecov Report

Merging #347 (488a8d7) into master (f4ede35) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #347   +/-   ##
=======================================
  Coverage   73.12%   73.12%           
=======================================
  Files          18       18           
  Lines        1362     1362           
=======================================
  Hits          996      996           
  Misses        315      315           
  Partials       51       51           
Flag Coverage Δ
unittests 73.12% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out 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>
@eapolinario eapolinario enabled auto-merge (squash) November 30, 2022 05:22
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
@eapolinario eapolinario reopened this Nov 30, 2022
@eapolinario eapolinario merged commit b4a6a57 into master Nov 30, 2022
@eapolinario eapolinario deleted the fix-buf-build branch November 30, 2022 19:32
eapolinario added a commit that referenced this pull request Feb 22, 2023
This reverts commit b4a6a57.

Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
eapolinario added a commit that referenced this pull request Sep 8, 2023
* Add __init__.py files to generated stubs

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

* Publish stubs in the package

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

* Include __init__.py in verification workflow

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

* Bump versions of remote plugins

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