diff --git a/Taskfile.yaml b/Taskfile.yaml index d241054..66de54c 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -14,6 +14,7 @@ tasks: - ./api/**/*.py sources: - ./proto/**/*.proto + - poetry.lock cmds: - >- poetry run python -m grpc_tools.protoc @@ -34,10 +35,18 @@ tasks: --noviews 'mysql+pymysql://{{.MYSQL_USER}}:{{.MYSQL_PASS}}@{{.MYSQL_HOST}}:{{.MYSQL_PORT}}/{{.MYSQL_DB}}' + dev: + dotenv: + - .env + sources: + - chii/**/*.py + - rpc/**/*.py + generates: + - a-file-not-exists-so-it-always-rerun + cmd: python start_grpc_server.py - dev: poetry run watchgod start_grpc_server.main mypy: mypy --show-column-numbers chii rpc lint: - - poetry run mypy chii rpc - poetry run ruff check . + - poetry run mypy chii rpc diff --git a/api/__init__.py b/api/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/api/v1/__init__.py b/api/v1/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/api/v1/timeline_pb2.py b/api/v1/timeline_pb2.py index 0450777..79234bb 100644 --- a/api/v1/timeline_pb2.py +++ b/api/v1/timeline_pb2.py @@ -1,12 +1,22 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: api/v1/timeline.proto -# Protobuf Python Version: 5.26.1 +# Protobuf Python Version: 5.27.2 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion( + _runtime_version.Domain.PUBLIC, + 5, + 27, + 2, + '', + 'api/v1/timeline.proto' +) # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() diff --git a/api/v1/timeline_pb2_grpc.py b/api/v1/timeline_pb2_grpc.py index 7bd5fcc..6e1f5c0 100644 --- a/api/v1/timeline_pb2_grpc.py +++ b/api/v1/timeline_pb2_grpc.py @@ -5,10 +5,8 @@ from api.v1 import timeline_pb2 as api_dot_v1_dot_timeline__pb2 -GRPC_GENERATED_VERSION = '1.63.0' +GRPC_GENERATED_VERSION = '1.66.1' GRPC_VERSION = grpc.__version__ -EXPECTED_ERROR_RELEASE = '1.65.0' -SCHEDULED_RELEASE_DATE = 'June 25, 2024' _version_not_supported = False try: @@ -18,15 +16,12 @@ _version_not_supported = True if _version_not_supported: - warnings.warn( + raise RuntimeError( f'The grpc package installed is at version {GRPC_VERSION},' + f' but the generated code in api/v1/timeline_pb2_grpc.py depends on' + f' grpcio>={GRPC_GENERATED_VERSION}.' + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}' + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.' - + f' This warning will become an error in {EXPECTED_ERROR_RELEASE},' - + f' scheduled for release on {SCHEDULED_RELEASE_DATE}.', - RuntimeWarning ) @@ -116,6 +111,7 @@ def add_TimeLineServiceServicer_to_server(servicer, server): generic_handler = grpc.method_handlers_generic_handler( 'api.v1.TimeLineService', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) + server.add_registered_method_handlers('api.v1.TimeLineService', rpc_method_handlers) # This class is part of an EXPERIMENTAL API. diff --git a/poetry.lock b/poetry.lock index ba828e1..0103730 100644 --- a/poetry.lock +++ b/poetry.lock @@ -148,27 +148,6 @@ files = [ {file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"}, ] -[[package]] -name = "anyio" -version = "3.7.1" -description = "High level compatibility layer for multiple asynchronous event loop implementations" -optional = false -python-versions = ">=3.7" -files = [ - {file = "anyio-3.7.1-py3-none-any.whl", hash = "sha256:91dee416e570e92c64041bd18b900d1d6fa78dff7048769ce5ac5ddad004fbb5"}, - {file = "anyio-3.7.1.tar.gz", hash = "sha256:44a3c9aba0f5defa43261a8b3efb97891f2bd7d804e0e1f56419befa1adfc780"}, -] - -[package.dependencies] -exceptiongroup = {version = "*", markers = "python_version < \"3.11\""} -idna = ">=2.8" -sniffio = ">=1.1" - -[package.extras] -doc = ["Sphinx", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme (>=1.2.2)", "sphinxcontrib-jquery"] -test = ["anyio[trio]", "coverage[toml] (>=4.5)", "hypothesis (>=4.0)", "mock (>=4)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"] -trio = ["trio (<0.22)"] - [[package]] name = "async-timeout" version = "4.0.3" @@ -1651,17 +1630,6 @@ files = [ {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, ] -[[package]] -name = "sniffio" -version = "1.3.1" -description = "Sniff out which async library your code is running under" -optional = false -python-versions = ">=3.7" -files = [ - {file = "sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2"}, - {file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"}, -] - [[package]] name = "sqlacodegen" version = "3.0.0rc5" @@ -1836,17 +1804,6 @@ typing-extensions = ">=4.10.0" doc = ["Sphinx (>=7)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme (>=1.3.0)"] test = ["coverage[toml] (>=7)", "mypy (>=1.2.0)", "pytest (>=7)"] -[[package]] -name = "types-protobuf" -version = "4.25.0.20240417" -description = "Typing stubs for protobuf" -optional = false -python-versions = ">=3.8" -files = [ - {file = "types-protobuf-4.25.0.20240417.tar.gz", hash = "sha256:c34eff17b9b3a0adb6830622f0f302484e4c089f533a46e3f147568313544352"}, - {file = "types_protobuf-4.25.0.20240417-py3-none-any.whl", hash = "sha256:e9b613227c2127e3d4881d75d93c93b4d6fd97b5f6a099a0b654a05351c8685d"}, -] - [[package]] name = "typing-extensions" version = "4.12.2" @@ -1895,20 +1852,6 @@ platformdirs = ">=3.9.1,<5" docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2,!=7.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"] test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"] -[[package]] -name = "watchgod" -version = "0.8.2" -description = "Simple, modern file watching and code reload in python." -optional = false -python-versions = ">=3.7" -files = [ - {file = "watchgod-0.8.2-py3-none-any.whl", hash = "sha256:2f3e8137d98f493ff58af54ea00f4d1433a6afe2ed08ab331a657df468c6bfce"}, - {file = "watchgod-0.8.2.tar.gz", hash = "sha256:cb11ff66657befba94d828e3b622d5fb76f22fbda1376f355f3e6e51e97d9450"}, -] - -[package.dependencies] -anyio = ">=3.0.0,<4" - [[package]] name = "yarl" version = "1.11.1" @@ -2017,4 +1960,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "95f830b2d457e4bc962e8a80cafb60af57e86a919a8c62f6d3c09b5255d853d8" +content-hash = "1b0f93fc2459e20c34b082eec40792e6256b24ae7ba22a25b2bcc5fee422a9cc" diff --git a/pyproject.toml b/pyproject.toml index 55c3024..0141e08 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,7 @@ aiohttp = "3.10.5" pydantic-settings = "2.5.2" typing-extensions = '4.12.2' sslog = "0.0.0a45" +protobuf = "^5.28.2" [tool.poetry.group.dev.dependencies] sqlacodegen = "3.0.0rc5" @@ -33,8 +34,6 @@ pytest-env = "==1.1.5" # linter and formatter pre-commit = "==3.8.0" mypy = "==1.11.2" -watchgod = "0.8.2" -types-protobuf = "^4.21.0.2" [tool.poetry-plugin-bump] commit_msg = 'bump: v{version}' diff --git a/start_grpc_server.py b/start_grpc_server.py index b10020e..69072e7 100644 --- a/start_grpc_server.py +++ b/start_grpc_server.py @@ -6,6 +6,7 @@ from concurrent import futures import etcd3 +import google.protobuf import grpc from etcd3 import Lease from etcd3.utils import retry @@ -15,6 +16,8 @@ from chii.config import config from rpc.timeline_service import TimeLineService +print(google.protobuf.__version__) + class Register(threading.Thread): """