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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ jobs:
run: rm -rf ./gen
- name: "Run buf generate"
run: buf generate
- name: "Include __init__.py files"
run: find gen/pb_python -type d -exec touch {}/__init__.py \;
- uses: actions/upload-artifact@master
with:
name: generated-buf
Expand Down
4 changes: 2 additions & 2 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ version: v1
managed:
enabled: true
plugins:
- remote: buf.build/grpc/plugins/python:v1.49.1-1
- remote: buf.build/grpc/plugins/python:v1.51.1-1
out: gen/pb_python
- remote: buf.build/protocolbuffers/plugins/python:v21.7.0-1
- remote: buf.build/protocolbuffers/plugins/python:v21.9.0-1
out: gen/pb_python
- remote: buf.build/protocolbuffers/plugins/pyi:v21.9.0-1
out: gen/pb_python
Empty file added gen/pb_python/__init__.py
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
7 changes: 7 additions & 0 deletions generate_protos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,16 @@ do
done

# Buf migration
# TODO: fix stub generation via docker image. The trick of forcing the current user as a user in
# the container (used extensively in this file) does not work.
# docker run --volume "$(pwd):/workspace" --workdir /workspace bufbuild/buf generate
buf generate

# Unfortunately the python protoc plugin does not add __init__.py files to the generated code
# (as described in https://github.com/protocolbuffers/protobuf/issues/881). One of the
# suggestions is to manually create such files, which is what we do here:
find gen/pb_python -type d -exec touch {}/__init__.py \;

# Docs generated

# Remove any currently generated core docs file
Expand Down
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
maintainer_email='admin@flyte.org',
packages=find_packages('gen/pb_python'),
package_dir={'': 'gen/pb_python'},
# https://github.com/pypa/setuptools/issues/3136 describes an extension to
# setuptools that would involve a simpler way to specify this, but while
# that does not happen we have to package the pyi files manually like so:
package_data={'flyteidl': ["*.pyi", "**/*.pyi"]},
dependency_links=[],
install_requires=[
'googleapis-common-protos',
Expand Down