Skip to content

Commit

Permalink
fix: Bump versions and build mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr0p42 committed May 1, 2024
1 parent 36fd3e3 commit 8a3b25c
Show file tree
Hide file tree
Showing 40 changed files with 575 additions and 540 deletions.
11 changes: 6 additions & 5 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
ENV PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/go/bin"

RUN python3 -m pip install virtualenv --break-system-packages
RUN python3 -m pip install poetry --break-system-packages

# Removing version pining to try to follow new versions.
RUN bash -c 'virtualenv venv \
&& source venv/bin/activate \
&& python3 -m pip install --upgrade pip \
&& pip install protobuf-to-pydantic protobuf-to-pydantic[mypy-protobuf] protobuf protobuf2pydantic grpcio-tools'
# RUN bash -c 'virtualenv venv \
# && source venv/bin/activate \
# && python3 -m pip install --upgrade pip \
# && pip install protobuf-to-pydantic[mypy-protobuf]=="0.2.6.2" protobuf grpcio-tools'
# # && pip install protobuf-to-pydantic=="0.1.7.4" protobuf-to-pydantic[mypy-protobuf]=="0.1.7.4" protobuf protobuf2pydantic grpcio-tools'


#ENTRYPOINT ["/usr/local/bin/protoc"]
21 changes: 6 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
d=docker run --rm -it -v `pwd`:/data --workdir /data naas-models-builder:latest
protoc=$(d) protoc

generate: clean python go build submodules
docker-compose run --rm -it python
cd python/naas_models && sed -i.bak 's/import validate_pb2/import naas_models.validate_pb2/g' *.py && rm *.bak
cd python/naas_models/pydantic && sed -i.bak 's/common_p2p/naas_models.pydantic.common_p2p/g' *.py && rm *.bak

build:
#@ docker buildx create --name multiarch --driver docker-container --use 2>&1 > /dev/null || true
#@ docker buildx build -f .docker/Dockerfile -t naas-models-builder --platform=linux/arm64,linux/amd64 .
@ .docker/load.sh
docker-compose build

python: python/naas_models python/naas_models/pydantic

Expand All @@ -23,17 +26,5 @@ clean:
submodules:
git submodule init && git submodule update

generate: clean python go build submodules
$(d) bash -c 'source /venv/bin/activate && python3 -m grpc_tools.protoc \
-I=protos \
-I=lib/protoc-gen-validate/validate \
--protobuf-to-pydantic_out=python/naas_models/pydantic \
--python_out=python/naas_models \
--go_out=go \
--validate_out="lang=go:go" \
space.proto registry.proto iam.proto aimodel.proto chat.proto credit.proto secret.proto storage.proto workspace.proto asset.proto validate.proto common.proto'
cd python/naas_models && sed -i.bak 's/import validate_pb2/import naas_models.validate_pb2/g' *.py && rm *.bak
cd python/naas_models/pydantic && sed -i.bak 's/..common_p2p/naas_models.pydantic.common_p2p/g' *.py && rm *.bak

bash:
$(d) /bin/bash

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

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

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

2 changes: 1 addition & 1 deletion go/github.com/jupyter-naas/naas-models/go/chat/chat.pb.go

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

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

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

2 changes: 1 addition & 1 deletion go/github.com/jupyter-naas/naas-models/go/iam/iam.pb.go

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

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

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

225 changes: 112 additions & 113 deletions go/github.com/jupyter-naas/naas-models/go/space/space.pb.go

Large diffs are not rendered by default.

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

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

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

16 changes: 8 additions & 8 deletions python/naas_models/aimodel_pb2.py

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

32 changes: 16 additions & 16 deletions python/naas_models/asset_pb2.py

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

30 changes: 15 additions & 15 deletions python/naas_models/chat_pb2.py

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

8 changes: 4 additions & 4 deletions python/naas_models/common_pb2.py

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

Loading

0 comments on commit 8a3b25c

Please sign in to comment.