Skip to content
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

Small refactorings to fix CLI import errors for replicator #68

Merged
merged 1 commit into from
Jul 1, 2024

Conversation

whummer
Copy link
Member

@whummer whummer commented Jul 1, 2024

Small refactorings to fix CLI import errors for replicator. This was detected in a debugging session together with @robertlcx , where we saw a couple of errors related to importing the CLI code from Python 3.9.

...
  File "/Users/localstack/SynologyDrive/repos/localstack-snowflake-samples/airflow-dbt-transformation/.venv/lib/python3.9/site-packages/localstack/aws/protocol/parser.py", line 1047, in VirtualHostRewriter
    def _is_vhost_address_get_bucket(request: Request) -> str | None:
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

...

  File "/Users/localstack/SynologyDrive/repos/localstack-snowflake-samples/airflow-dbt-transformation/.venv/lib/python3.9/site-packages/localstack/services/cloudformation/service_models.py", line 27, in <module>
    class GenericBaseModel:
  File "/Users/localstack/SynologyDrive/repos/localstack-snowflake-samples/airflow-dbt-transformation/.venv/lib/python3.9/site-packages/localstack/services/cloudformation/service_models.py", line 110, in GenericBaseModel
    def physical_resource_id(self) -> str | None:
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

...

  File "/Users/localstack/SynologyDrive/repos/localstack-snowflake-samples/airflow-dbt-transformation/.venv/lib/python3.9/site-packages/rolo/websocket/websocket.py", line 10, in <module>
    from rolo.asgi import ASGIWebSocket, WebSocketEnvironment, WebSocketListener
  File "/Users/localstack/SynologyDrive/repos/localstack-snowflake-samples/airflow-dbt-transformation/.venv/lib/python3.9/site-packages/rolo/asgi.py", line 46, in <module>
    WebSocketEnvironment: t.TypeAlias = t.Dict[str, t.Any]
AttributeError: module 'typing' has no attribute 'TypeAlias'

In this PR we're removing a couple of imports or try to defer them to later stages, to be able to run the replicator proxy from the CLI (in container mode) via:

$ localstack aws proxy --container -s s3
... 

@whummer whummer merged commit 0c5c0c2 into main Jul 1, 2024
1 check passed
@whummer whummer deleted the cli-imports branch July 1, 2024 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant