Skip to content

Commit 6a9c390

Browse files
authored
Merge pull request #334 from InjectiveLabs/fix/make_proto_modules_imports_explicit_master
Fix/make proto modules imports explicit master
2 parents a93aab1 + 4c73d4d commit 6a9c390

File tree

342 files changed

+856
-848
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

342 files changed

+856
-848
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

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

5+
## [1.5.4] - 2024-07-03
6+
### Changed
7+
- Fixed all import statements in pyinjective.proto modules to make them explicit
8+
59
## [1.5.3] - 2024-06-12
610
### Changed
711
- Changed parameter `key` from the PaginationOption class.

Makefile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,25 @@ all:
33
gen: gen-client
44

55
gen-client: clone-all copy-proto
6+
mkdir -p ./pyinjective/proto
67
@for dir in $(shell find ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq); do \
7-
mkdir -p ./pyinjective/$${dir}; \
88
python3 -m grpc_tools.protoc \
9-
-I proto \
9+
--proto_path=./proto \
1010
--python_out=./pyinjective/proto \
1111
--grpc_python_out=./pyinjective/proto \
1212
$$(find ./$${dir} -type f -name '*.proto'); \
13-
done; \
13+
done
1414
rm -rf proto
1515
$(call clean_repos)
16-
echo "import os\nimport sys\n\nsys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))" > pyinjective/proto/__init__.py
16+
touch pyinjective/proto/__init__.py
17+
$(MAKE) fix-proto-imports
18+
19+
PROTO_MODULES := cosmwasm exchange gogoproto cosmos_proto cosmos testpb ibc amino tendermint injective
20+
fix-proto-imports:
21+
@for module in $(PROTO_MODULES); do \
22+
find ./pyinjective/proto -type f -name "*.py" -exec sed -i "" -e "s/from $${module}/from pyinjective.proto.$${module}/g" {} \; ; \
23+
done
24+
@find ./pyinjective/proto -type f -name "*.py" -exec sed -i "" -e "s/from google.api/from pyinjective.proto.google.api/g" {} \;
1725

1826
define clean_repos
1927
rm -Rf cosmos-sdk

pyinjective/proto/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
import os
2-
import sys
3-
4-
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))

pyinjective/proto/cosmos/app/runtime/v1alpha1/module_pb2.py

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyinjective/proto/cosmos/app/v1alpha1/query_pb2.py

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyinjective/proto/cosmos/app/v1alpha1/query_pb2_grpc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""Client and server classes corresponding to protobuf-defined services."""
33
import grpc
44

5-
from cosmos.app.v1alpha1 import query_pb2 as cosmos_dot_app_dot_v1alpha1_dot_query__pb2
5+
from pyinjective.proto.cosmos.app.v1alpha1 import query_pb2 as cosmos_dot_app_dot_v1alpha1_dot_query__pb2
66

77

88
class QueryStub(object):

pyinjective/proto/cosmos/auth/module/v1/module_pb2.py

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyinjective/proto/cosmos/auth/v1beta1/auth_pb2.py

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyinjective/proto/cosmos/auth/v1beta1/genesis_pb2.py

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyinjective/proto/cosmos/auth/v1beta1/query_pb2.py

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)