Skip to content

Commit

Permalink
Merge pull request #334 from InjectiveLabs/fix/make_proto_modules_imp…
Browse files Browse the repository at this point in the history
…orts_explicit_master

Fix/make proto modules imports explicit master
  • Loading branch information
aarmoa authored Jul 3, 2024
2 parents a93aab1 + 4c73d4d commit 6a9c390
Show file tree
Hide file tree
Showing 342 changed files with 856 additions and 848 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## [1.5.4] - 2024-07-03
### Changed
- Fixed all import statements in pyinjective.proto modules to make them explicit

## [1.5.3] - 2024-06-12
### Changed
- Changed parameter `key` from the PaginationOption class.
Expand Down
16 changes: 12 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,25 @@ all:
gen: gen-client

gen-client: clone-all copy-proto
mkdir -p ./pyinjective/proto
@for dir in $(shell find ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq); do \
mkdir -p ./pyinjective/$${dir}; \
python3 -m grpc_tools.protoc \
-I proto \
--proto_path=./proto \
--python_out=./pyinjective/proto \
--grpc_python_out=./pyinjective/proto \
$$(find ./$${dir} -type f -name '*.proto'); \
done; \
done
rm -rf proto
$(call clean_repos)
echo "import os\nimport sys\n\nsys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))" > pyinjective/proto/__init__.py
touch pyinjective/proto/__init__.py
$(MAKE) fix-proto-imports

PROTO_MODULES := cosmwasm exchange gogoproto cosmos_proto cosmos testpb ibc amino tendermint injective
fix-proto-imports:
@for module in $(PROTO_MODULES); do \
find ./pyinjective/proto -type f -name "*.py" -exec sed -i "" -e "s/from $${module}/from pyinjective.proto.$${module}/g" {} \; ; \
done
@find ./pyinjective/proto -type f -name "*.py" -exec sed -i "" -e "s/from google.api/from pyinjective.proto.google.api/g" {} \;

define clean_repos
rm -Rf cosmos-sdk
Expand Down
4 changes: 0 additions & 4 deletions pyinjective/proto/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
import os
import sys

sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyinjective/proto/cosmos/app/v1alpha1/query_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyinjective/proto/cosmos/app/v1alpha1/query_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

from cosmos.app.v1alpha1 import query_pb2 as cosmos_dot_app_dot_v1alpha1_dot_query__pb2
from pyinjective.proto.cosmos.app.v1alpha1 import query_pb2 as cosmos_dot_app_dot_v1alpha1_dot_query__pb2


class QueryStub(object):
Expand Down
2 changes: 1 addition & 1 deletion pyinjective/proto/cosmos/auth/module/v1/module_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyinjective/proto/cosmos/auth/v1beta1/auth_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyinjective/proto/cosmos/auth/v1beta1/genesis_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions pyinjective/proto/cosmos/auth/v1beta1/query_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyinjective/proto/cosmos/auth/v1beta1/query_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

from cosmos.auth.v1beta1 import query_pb2 as cosmos_dot_auth_dot_v1beta1_dot_query__pb2
from pyinjective.proto.cosmos.auth.v1beta1 import query_pb2 as cosmos_dot_auth_dot_v1beta1_dot_query__pb2


class QueryStub(object):
Expand Down
10 changes: 5 additions & 5 deletions pyinjective/proto/cosmos/auth/v1beta1/tx_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyinjective/proto/cosmos/auth/v1beta1/tx_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

from cosmos.auth.v1beta1 import tx_pb2 as cosmos_dot_auth_dot_v1beta1_dot_tx__pb2
from pyinjective.proto.cosmos.auth.v1beta1 import tx_pb2 as cosmos_dot_auth_dot_v1beta1_dot_tx__pb2


class MsgStub(object):
Expand Down
2 changes: 1 addition & 1 deletion pyinjective/proto/cosmos/authz/module/v1/module_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyinjective/proto/cosmos/authz/v1beta1/authz_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyinjective/proto/cosmos/authz/v1beta1/event_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyinjective/proto/cosmos/authz/v1beta1/genesis_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6a9c390

Please sign in to comment.