Skip to content

Commit 8def965

Browse files
committed
chore: reorganize imports
1 parent 3a8eb92 commit 8def965

21 files changed

+94
-20
lines changed

examples/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Example application package for fastapi-cloudflow demos."""

examples/app/__init__.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
from .flows.resilient_payment import GATEWAY_PAYMENT_FLOW, RESILIENT_PAYMENT_FLOW # noqa: F401
2-
from .flows.retry_contract import RETRY_DEMO_WORKFLOW # noqa: F401
3-
from .flows.subworkflow_contract import SUBWORKFLOW_DEMO # noqa: F401
4-
from .flows.try_catch_contract import TRY_CATCH_DEMO # noqa: F401
1+
from .flows.resilient_payment import GATEWAY_PAYMENT_FLOW, RESILIENT_PAYMENT_FLOW
2+
from .flows.retry_contract import RETRY_DEMO_WORKFLOW
3+
from .flows.subworkflow_contract import SUBWORKFLOW_DEMO
4+
from .flows.try_catch_contract import TRY_CATCH_DEMO
5+
6+
__all__ = [
7+
"GATEWAY_PAYMENT_FLOW",
8+
"RESILIENT_PAYMENT_FLOW",
9+
"RETRY_DEMO_WORKFLOW",
10+
"SUBWORKFLOW_DEMO",
11+
"TRY_CATCH_DEMO",
12+
]

examples/app/flows/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""Example flow definitions for FastAPI Cloudflow demos."""
2+
3+
__all__ = [
4+
"data_pipeline",
5+
"echo_name",
6+
"jokes",
7+
"order",
8+
"order_with_subworkflow",
9+
"payments",
10+
"post_story",
11+
"pubsub_example",
12+
"resilient_payment",
13+
"retry_contract",
14+
"subworkflow_contract",
15+
"try_catch_contract",
16+
"user",
17+
]

examples/app/main.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
from fastapi import FastAPI
2-
from flows import data_pipeline, echo_name, jokes, order, payments, post_story, resilient_payment, user # noqa: F401
32

3+
from examples.app.flows import ( # noqa: F401
4+
data_pipeline,
5+
echo_name,
6+
jokes,
7+
order,
8+
payments,
9+
post_story,
10+
resilient_payment,
11+
user,
12+
)
413
from fastapi_cloudflow import attach_to_fastapi
514

615

716
def create_app() -> FastAPI:
817
app = FastAPI()
918
# Import types used for stub endpoints
10-
from flows.payments import PSPReq, PSPRes
11-
from flows.user import IdentityReq, IdentityRes
19+
from examples.app.flows.payments import PSPReq, PSPRes
20+
from examples.app.flows.user import IdentityReq, IdentityRes
1221

1322
@app.get("/health")
1423
def health() -> dict[str, str]: # noqa: D401

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ known-first-party = ["fastapi_cloudflow", "app", "tests"]
6868

6969

7070
[tool.ty.environment]
71-
root = ["./src", "./examples/app"]
71+
root = [".", "./src"]
7272

7373
[tool.pytest.ini_options]
7474
addopts = [

src/fastapi_cloudflow/core/connectors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def pubsub_message(
4444
if isinstance(attributes, ArgExpr):
4545
message["attributes"] = attributes
4646
else:
47-
message["attributes"] = attributes.copy()
47+
message["attributes"] = dict(attributes)
4848

4949
if ordering_key is not None:
5050
message["orderingKey"] = ordering_key

tests/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
"""Test package for fastapi-cloudflow."""
1+
"""Test suite package for fastapi-cloudflow."""
2+
3+
from . import codegen
4+
5+
__all__ = ["codegen"]

tests/codegen/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"""Code generation tests package."""
2+
3+
from . import fixtures # noqa: F401
4+
5+
__all__ = ["fixtures"]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
graph TD
2+
subgraph retry-demo
3+
retry-entry[retry-entry]
4+
retry-gateway[retry-gateway]
5+
retry-finalize[retry-finalize]
6+
retry-entry --> retry-gateway
7+
retry-gateway --> retry-finalize
8+
end
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
graph TD
2+
subgraph subworkflow-demo
3+
subwf-prepare[subwf-prepare]
4+
call_subwf_child[call_subwf_child]
5+
subwf-finalize[subwf-finalize]
6+
subwf-prepare --> call_subwf_child
7+
call_subwf_child --> subwf-finalize
8+
end

0 commit comments

Comments
 (0)