-
Notifications
You must be signed in to change notification settings - Fork 0
fix(main): ensure compatibility with the latest connect-python
#123
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8128850
chore: update "connect-python[compiler] package
b-long 1bfb7a2
chore: add 'protoc-gen-connect-python' package (now separate)
b-long bcad2d7
chore: fix ConnectRPC Python client generation path
b-long 7dcc265
chore: update connect-python references in dependency checks and gene…
b-long c9a9c53
chore: remove old generated ConnectRPC code
b-long 4a9df96
chore(core): migrate to connect-python 0.6.0
b-long fca4293
chore: fix AccessServiceClientSync instantiation
b-long 64245da
chore: fix tests
b-long 461238b
fix(main): 'KAS.close()' method
b-long 1acd754
fix(main): warn & recommend context-manager use
b-long 6b7be10
fix(main): run 'uv sync -U' for 'otdf-python-proto'
b-long 7d6998e
fix(main): run 'uv sync -U' for 'otdf-python'
b-long File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
otdf-python-proto/src/otdf_python_proto/authorization/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,11 @@ | ||
| """authorization protobuf definitions.""" | ||
|
|
||
| from .authorization_connect import ( | ||
| AuthorizationServiceClient, | ||
| AuthorizationServiceClientSync, | ||
| ) | ||
|
|
||
| __all__ = [ | ||
| "AuthorizationServiceClient", | ||
| "AuthorizationServiceClientSync", | ||
| ] |
250 changes: 250 additions & 0 deletions
250
otdf-python-proto/src/otdf_python_proto/authorization/authorization_connect.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,250 @@ | ||
| # -*- coding: utf-8 -*- | ||
| # Generated by https://github.com/connectrpc/connect-python. DO NOT EDIT! | ||
| # source: authorization/authorization.proto | ||
|
|
||
| from collections.abc import AsyncGenerator, AsyncIterator, Iterable, Iterator, Mapping | ||
| from typing import Protocol | ||
|
|
||
| from connectrpc.client import ConnectClient, ConnectClientSync | ||
| from connectrpc.code import Code | ||
| from connectrpc.errors import ConnectError | ||
| from connectrpc.interceptor import Interceptor, InterceptorSync | ||
| from connectrpc.method import IdempotencyLevel, MethodInfo | ||
| from connectrpc.request import Headers, RequestContext | ||
| from connectrpc.server import ConnectASGIApplication, ConnectWSGIApplication, Endpoint, EndpointSync | ||
| from . import authorization_pb2 as authorization_dot_authorization__pb2 | ||
|
|
||
|
|
||
| class AuthorizationService(Protocol): | ||
| async def get_decisions(self, request: authorization_dot_authorization__pb2.GetDecisionsRequest, ctx: RequestContext) -> authorization_dot_authorization__pb2.GetDecisionsResponse: | ||
| raise ConnectError(Code.UNIMPLEMENTED, "Not implemented") | ||
|
|
||
| async def get_decisions_by_token(self, request: authorization_dot_authorization__pb2.GetDecisionsByTokenRequest, ctx: RequestContext) -> authorization_dot_authorization__pb2.GetDecisionsByTokenResponse: | ||
| raise ConnectError(Code.UNIMPLEMENTED, "Not implemented") | ||
|
|
||
| async def get_entitlements(self, request: authorization_dot_authorization__pb2.GetEntitlementsRequest, ctx: RequestContext) -> authorization_dot_authorization__pb2.GetEntitlementsResponse: | ||
| raise ConnectError(Code.UNIMPLEMENTED, "Not implemented") | ||
|
|
||
|
|
||
| class AuthorizationServiceASGIApplication(ConnectASGIApplication[AuthorizationService]): | ||
| def __init__(self, service: AuthorizationService | AsyncGenerator[AuthorizationService], *, interceptors: Iterable[Interceptor]=(), read_max_bytes: int | None = None) -> None: | ||
| super().__init__( | ||
| service=service, | ||
| endpoints=lambda svc: { | ||
| "/authorization.AuthorizationService/GetDecisions": Endpoint.unary( | ||
| method=MethodInfo( | ||
| name="GetDecisions", | ||
| service_name="authorization.AuthorizationService", | ||
| input=authorization_dot_authorization__pb2.GetDecisionsRequest, | ||
| output=authorization_dot_authorization__pb2.GetDecisionsResponse, | ||
| idempotency_level=IdempotencyLevel.UNKNOWN, | ||
| ), | ||
| function=svc.get_decisions, | ||
| ), | ||
| "/authorization.AuthorizationService/GetDecisionsByToken": Endpoint.unary( | ||
| method=MethodInfo( | ||
| name="GetDecisionsByToken", | ||
| service_name="authorization.AuthorizationService", | ||
| input=authorization_dot_authorization__pb2.GetDecisionsByTokenRequest, | ||
| output=authorization_dot_authorization__pb2.GetDecisionsByTokenResponse, | ||
| idempotency_level=IdempotencyLevel.UNKNOWN, | ||
| ), | ||
| function=svc.get_decisions_by_token, | ||
| ), | ||
| "/authorization.AuthorizationService/GetEntitlements": Endpoint.unary( | ||
| method=MethodInfo( | ||
| name="GetEntitlements", | ||
| service_name="authorization.AuthorizationService", | ||
| input=authorization_dot_authorization__pb2.GetEntitlementsRequest, | ||
| output=authorization_dot_authorization__pb2.GetEntitlementsResponse, | ||
| idempotency_level=IdempotencyLevel.UNKNOWN, | ||
| ), | ||
| function=svc.get_entitlements, | ||
| ), | ||
| }, | ||
| interceptors=interceptors, | ||
| read_max_bytes=read_max_bytes, | ||
| ) | ||
|
|
||
| @property | ||
| def path(self) -> str: | ||
| """Returns the URL path to mount the application to when serving multiple applications.""" | ||
| return "/authorization.AuthorizationService" | ||
|
|
||
|
|
||
| class AuthorizationServiceClient(ConnectClient): | ||
| async def get_decisions( | ||
| self, | ||
| request: authorization_dot_authorization__pb2.GetDecisionsRequest, | ||
| *, | ||
| headers: Headers | Mapping[str, str] | None = None, | ||
| timeout_ms: int | None = None, | ||
| ) -> authorization_dot_authorization__pb2.GetDecisionsResponse: | ||
| return await self.execute_unary( | ||
| request=request, | ||
| method=MethodInfo( | ||
| name="GetDecisions", | ||
| service_name="authorization.AuthorizationService", | ||
| input=authorization_dot_authorization__pb2.GetDecisionsRequest, | ||
| output=authorization_dot_authorization__pb2.GetDecisionsResponse, | ||
| idempotency_level=IdempotencyLevel.UNKNOWN, | ||
| ), | ||
| headers=headers, | ||
| timeout_ms=timeout_ms, | ||
| ) | ||
|
|
||
| async def get_decisions_by_token( | ||
| self, | ||
| request: authorization_dot_authorization__pb2.GetDecisionsByTokenRequest, | ||
| *, | ||
| headers: Headers | Mapping[str, str] | None = None, | ||
| timeout_ms: int | None = None, | ||
| ) -> authorization_dot_authorization__pb2.GetDecisionsByTokenResponse: | ||
| return await self.execute_unary( | ||
| request=request, | ||
| method=MethodInfo( | ||
| name="GetDecisionsByToken", | ||
| service_name="authorization.AuthorizationService", | ||
| input=authorization_dot_authorization__pb2.GetDecisionsByTokenRequest, | ||
| output=authorization_dot_authorization__pb2.GetDecisionsByTokenResponse, | ||
| idempotency_level=IdempotencyLevel.UNKNOWN, | ||
| ), | ||
| headers=headers, | ||
| timeout_ms=timeout_ms, | ||
| ) | ||
|
|
||
| async def get_entitlements( | ||
| self, | ||
| request: authorization_dot_authorization__pb2.GetEntitlementsRequest, | ||
| *, | ||
| headers: Headers | Mapping[str, str] | None = None, | ||
| timeout_ms: int | None = None, | ||
| ) -> authorization_dot_authorization__pb2.GetEntitlementsResponse: | ||
| return await self.execute_unary( | ||
| request=request, | ||
| method=MethodInfo( | ||
| name="GetEntitlements", | ||
| service_name="authorization.AuthorizationService", | ||
| input=authorization_dot_authorization__pb2.GetEntitlementsRequest, | ||
| output=authorization_dot_authorization__pb2.GetEntitlementsResponse, | ||
| idempotency_level=IdempotencyLevel.UNKNOWN, | ||
| ), | ||
| headers=headers, | ||
| timeout_ms=timeout_ms, | ||
| ) | ||
|
|
||
|
|
||
| class AuthorizationServiceSync(Protocol): | ||
| def get_decisions(self, request: authorization_dot_authorization__pb2.GetDecisionsRequest, ctx: RequestContext) -> authorization_dot_authorization__pb2.GetDecisionsResponse: | ||
| raise ConnectError(Code.UNIMPLEMENTED, "Not implemented") | ||
| def get_decisions_by_token(self, request: authorization_dot_authorization__pb2.GetDecisionsByTokenRequest, ctx: RequestContext) -> authorization_dot_authorization__pb2.GetDecisionsByTokenResponse: | ||
| raise ConnectError(Code.UNIMPLEMENTED, "Not implemented") | ||
| def get_entitlements(self, request: authorization_dot_authorization__pb2.GetEntitlementsRequest, ctx: RequestContext) -> authorization_dot_authorization__pb2.GetEntitlementsResponse: | ||
| raise ConnectError(Code.UNIMPLEMENTED, "Not implemented") | ||
|
|
||
|
|
||
| class AuthorizationServiceWSGIApplication(ConnectWSGIApplication): | ||
| def __init__(self, service: AuthorizationServiceSync, interceptors: Iterable[InterceptorSync]=(), read_max_bytes: int | None = None) -> None: | ||
| super().__init__( | ||
| endpoints={ | ||
| "/authorization.AuthorizationService/GetDecisions": EndpointSync.unary( | ||
| method=MethodInfo( | ||
| name="GetDecisions", | ||
| service_name="authorization.AuthorizationService", | ||
| input=authorization_dot_authorization__pb2.GetDecisionsRequest, | ||
| output=authorization_dot_authorization__pb2.GetDecisionsResponse, | ||
| idempotency_level=IdempotencyLevel.UNKNOWN, | ||
| ), | ||
| function=service.get_decisions, | ||
| ), | ||
| "/authorization.AuthorizationService/GetDecisionsByToken": EndpointSync.unary( | ||
| method=MethodInfo( | ||
| name="GetDecisionsByToken", | ||
| service_name="authorization.AuthorizationService", | ||
| input=authorization_dot_authorization__pb2.GetDecisionsByTokenRequest, | ||
| output=authorization_dot_authorization__pb2.GetDecisionsByTokenResponse, | ||
| idempotency_level=IdempotencyLevel.UNKNOWN, | ||
| ), | ||
| function=service.get_decisions_by_token, | ||
| ), | ||
| "/authorization.AuthorizationService/GetEntitlements": EndpointSync.unary( | ||
| method=MethodInfo( | ||
| name="GetEntitlements", | ||
| service_name="authorization.AuthorizationService", | ||
| input=authorization_dot_authorization__pb2.GetEntitlementsRequest, | ||
| output=authorization_dot_authorization__pb2.GetEntitlementsResponse, | ||
| idempotency_level=IdempotencyLevel.UNKNOWN, | ||
| ), | ||
| function=service.get_entitlements, | ||
| ), | ||
| }, | ||
| interceptors=interceptors, | ||
| read_max_bytes=read_max_bytes, | ||
| ) | ||
|
|
||
| @property | ||
| def path(self) -> str: | ||
| """Returns the URL path to mount the application to when serving multiple applications.""" | ||
| return "/authorization.AuthorizationService" | ||
|
|
||
|
|
||
| class AuthorizationServiceClientSync(ConnectClientSync): | ||
| def get_decisions( | ||
| self, | ||
| request: authorization_dot_authorization__pb2.GetDecisionsRequest, | ||
| *, | ||
| headers: Headers | Mapping[str, str] | None = None, | ||
| timeout_ms: int | None = None, | ||
| ) -> authorization_dot_authorization__pb2.GetDecisionsResponse: | ||
| return self.execute_unary( | ||
| request=request, | ||
| method=MethodInfo( | ||
| name="GetDecisions", | ||
| service_name="authorization.AuthorizationService", | ||
| input=authorization_dot_authorization__pb2.GetDecisionsRequest, | ||
| output=authorization_dot_authorization__pb2.GetDecisionsResponse, | ||
| idempotency_level=IdempotencyLevel.UNKNOWN, | ||
| ), | ||
| headers=headers, | ||
| timeout_ms=timeout_ms, | ||
| ) | ||
|
|
||
| def get_decisions_by_token( | ||
| self, | ||
| request: authorization_dot_authorization__pb2.GetDecisionsByTokenRequest, | ||
| *, | ||
| headers: Headers | Mapping[str, str] | None = None, | ||
| timeout_ms: int | None = None, | ||
| ) -> authorization_dot_authorization__pb2.GetDecisionsByTokenResponse: | ||
| return self.execute_unary( | ||
| request=request, | ||
| method=MethodInfo( | ||
| name="GetDecisionsByToken", | ||
| service_name="authorization.AuthorizationService", | ||
| input=authorization_dot_authorization__pb2.GetDecisionsByTokenRequest, | ||
| output=authorization_dot_authorization__pb2.GetDecisionsByTokenResponse, | ||
| idempotency_level=IdempotencyLevel.UNKNOWN, | ||
| ), | ||
| headers=headers, | ||
| timeout_ms=timeout_ms, | ||
| ) | ||
|
|
||
| def get_entitlements( | ||
| self, | ||
| request: authorization_dot_authorization__pb2.GetEntitlementsRequest, | ||
| *, | ||
| headers: Headers | Mapping[str, str] | None = None, | ||
| timeout_ms: int | None = None, | ||
| ) -> authorization_dot_authorization__pb2.GetEntitlementsResponse: | ||
| return self.execute_unary( | ||
| request=request, | ||
| method=MethodInfo( | ||
| name="GetEntitlements", | ||
| service_name="authorization.AuthorizationService", | ||
| input=authorization_dot_authorization__pb2.GetEntitlementsRequest, | ||
| output=authorization_dot_authorization__pb2.GetEntitlementsResponse, | ||
| idempotency_level=IdempotencyLevel.UNKNOWN, | ||
| ), | ||
| headers=headers, | ||
| timeout_ms=timeout_ms, | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.