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

Fix v4-proto-py package #215

Merged
merged 1 commit into from
Sep 8, 2023
Merged

Fix v4-proto-py package #215

merged 1 commit into from
Sep 8, 2023

Conversation

jiajames
Copy link
Contributor

@jiajames jiajames commented Sep 8, 2023

Fix the build of v4-proto-py, as I was trying to import it into the v4-client-py with no luck. The following changes worked for me:

  • Build everything under v4_proto (when importing the package, it gets put under v4-proto, which has incompatible naming with python)
  • Add a boilerplate __init__.py. This was in the original dydxpy, i'm not completely familiar with what it does but it helped to set the subdirectories correctly

$$(find ./$${dir} -type f -name '*.proto'); \
done; \
touch v4-proto-py/v4-proto-py/__init__.py
echo "import os\nimport sys\n\nsys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))" > v4-proto-py/v4_proto/__init__.py

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like modifying the python path in here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be sufficient to just do touch v4-proto-py/v4_proto/__init__.py here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Resolved: this is a hack to resolve protocolbuffers/protobuf#1491 (comment).

We should consider using sed to change the import statements instead. Mostly because we are hiding some real googleapi protos if we do this.

Copy link
Contributor

@roy-dydx roy-dydx left a comment

Choose a reason for hiding this comment

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

I don't like the content of the init.py

@roy-dydx roy-dydx merged commit 3953440 into main Sep 8, 2023
@roy-dydx roy-dydx deleted the jj/fix-v4-proto-py branch September 8, 2023 14:37
roy-dydx pushed a commit that referenced this pull request Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants