Skip to content

Commit 5aca2e4

Browse files
northpowereddmastapkovichDmitriy Astapkovich
authored
Removed robyn dependency
* Update python matrix * Fix robyn depency * Fix multiprocess import * ASGI run arg fix * Added worker kwargs * Add grpcio to pyproject.toml * Lint fixes * Bump pydantic up to ^2.10.0 * Lock file update * fix: apply code style improvements and typing enhancements (#29) Co-authored-by: Dmitriy Astapkovich <[email protected]> * Replace robyn dep to seperate group * Set straight dependency for st and wheel * Remove robyn * Ignoring robyn dependency --------- Co-authored-by: Dmitriy Astapkovich <[email protected]> Co-authored-by: Dmitriy Astapkovich <[email protected]>
1 parent a5a53ea commit 5aca2e4

34 files changed

+1206
-1318
lines changed

.github/workflows/ci_prepare.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
timeout-minutes: 30
1313
strategy:
1414
matrix:
15-
python-version: ["3.10", "3.11"]
15+
python-version: ["3.10", "3.11", "3.12", "3.13"]
1616

1717
steps:
1818
- uses: actions/checkout@v3
@@ -35,7 +35,7 @@ jobs:
3535
timeout-minutes: 30
3636
strategy:
3737
matrix:
38-
python-version: ["3.10", "3.11"]
38+
python-version: ["3.10", "3.11", "3.12", "3.13"]
3939
steps:
4040
- uses: actions/checkout@v3
4141
- name: Set up Python ${{ matrix.python-version }}

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
"python.analysis.extraPaths": [
1212
"./temporal_boost"
1313
]
14-
}
14+
}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class TestCronWorkflow:
5656

5757
app.add_worker(
5858
"worker_1",
59-
"task_q_1",
59+
"task_q_1",
6060
activities=[test_boost_activity_1],
6161
metrics_endpoint="0.0.0.0:9000"
6262
)
@@ -81,7 +81,7 @@ app.run()
8181
```
8282

8383
```bash
84-
python3 main.py
84+
python3 main.py
8585

8686
# Usage: main.py [OPTIONS] COMMAND [ARGS]...
8787

@@ -122,4 +122,4 @@ python3 main.py run worker_1
122122
# 2023-09-20T21:25:12 | INFO | Worker test_cron was registered in CLI
123123
# 2023-09-20T21:25:12 | INFO | Worker worker_1 started on task_q_1 queue
124124

125-
```
125+
```

docs/creating_application.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ app: BoostApp = BoostApp(
1818
bind_extra={"foo": "bar",},
1919
level="DEBUG",
2020
multiprocess_safe=True
21-
),
21+
),
2222
otlp_config=BoostOTLPConfig(
2323
otlp_endpoint="otlp-collector",
2424
service_name="example-app"
@@ -153,7 +153,7 @@ app.add_worker(
153153

154154
Now, internal worker can be used for autogenerated documentation for Temporal objects
155155

156-
In future, opportunities of this object will be expanded
156+
In future, opportunities of this object will be expanded
157157

158158
```python
159159
app.add_internal_worker("0.0.0.0", 8888, doc_endpoint="/doc")
@@ -181,4 +181,4 @@ Now, you can add it to Temporal-boost application:
181181
app.add_asgi_worker("asgi_worker", fastapi_app, "0.0.0.0", 8000)
182182
```
183183

184-
This application will be executed with [Hypercorn](https://github.com/pgjones/hypercorn) + [Trio](https://github.com/python-trio/trio) in asyncio runtime
184+
This application will be executed with [Hypercorn](https://github.com/pgjones/hypercorn) + [Trio](https://github.com/python-trio/trio) in asyncio runtime

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ from temporal_boost import BoostApp, BoostLoggerConfig
5050
app: BoostApp = BoostApp(
5151
logger_config=BoostLoggerConfig(
5252
json=True,
53-
bind_extra={"logging_extra_data": "foo_bar"},
53+
bind_extra={"logging_extra_data": "foo_bar"},
5454
level="DEBUG"),
5555
use_pydantic=True,
5656
)
@@ -103,4 +103,4 @@ Starting workers one by one
103103
```bash
104104
python3 main.py run worker_1
105105
python3 main.py run worker_2
106-
```
106+
```

docs/runnig_application.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ To run cron worker, use this command:
5656

5757
```bash
5858
python3 main.py cron worker_4
59-
```
59+
```

examples/example_app.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,25 @@
2121
name="BoostApp example",
2222
temporal_endpoint="localhost:7233",
2323
temporal_namespace="default",
24-
otlp_config=BoostOTLPConfig(otlp_endpoint="otlp-collector", service_name="example-app")
24+
otlp_config=BoostOTLPConfig(otlp_endpoint="otlp-collector", service_name="example-app"),
2525
)
2626

27+
2728
@dataclass
2829
class TestModel:
2930
foo: str
3031
bar: int
3132
spam: int = 3
3233
eggs: bool | None = None
3334

35+
3436
def fake_db_migration():
3537
"""
36-
Fake fn for db migrations
38+
Fake fn for db migrations
3739
"""
3840
print("fake")
3941

42+
4043
# Describe your activities/workflows
4144
@activity.defn(name="test_boost_activity_1")
4245
async def test_boost_activity_1(payload: TestModel) -> TestModel:
@@ -93,19 +96,20 @@ async def my_signal(self, signal_arg: TestModel):
9396
print(signal_arg)
9497

9598

96-
97-
9899
class TestAsyncRuntime:
99100
"""
100-
Class must implement `run` method
101+
Class must implement `run` method
101102
"""
103+
102104
async def _test_async_runtime(self):
103105
while True:
104106
print(random.random())
105107
await asyncio.sleep(1)
108+
106109
def run(self):
107110
asyncio.run(self._test_async_runtime())
108111

112+
109113
# Add async workers to your app
110114
if __name__ == "__main__":
111115
app.add_worker(
@@ -119,14 +123,17 @@ def run(self):
119123

120124
app.add_worker("worker_3", "task_q_3", workflows=[MyWorkflow])
121125

122-
#app.add_worker("worker_4", "task_q_4", workflows=[MyWorkflow], cron_runner=MyWorkflow.run, cron_schedule="* * * * *")
126+
# app.add_worker("worker_4", "task_q_4", workflows=[MyWorkflow], cron_runner=MyWorkflow.run, cron_schedule="* * * * *")
123127

124128
app.add_asgi_worker("asgi_worker", fastapi_app, "0.0.0.0", 8001)
125-
126-
app.add_internal_worker("0.0.0.0", 8888, doc_endpoint="/doc")
129+
"""
130+
Internal worker is not supported for Pyhton3.13 yet
131+
To use it, install `robyn` first
132+
"""
133+
# app.add_internal_worker("0.0.0.0", 8998, doc_endpoint="/doc")
127134

128135
app.add_exec_method_sync("migrate_db", fake_db_migration)
129136

130-
app.add_async_runtime("test_async", runtime=TestAsyncRuntime())
137+
# app.add_async_runtime("test_async", runtime=TestAsyncRuntime())
131138
# Run your app and start workers with CLI
132139
app.run()

mkdocs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ theme:
1212
- navigation.tracking
1313
- content.code.copy
1414
icon:
15-
annotation: material/arrow-right-circle
15+
annotation: material/arrow-right-circle
1616

1717

1818
plugins:
@@ -38,4 +38,4 @@ markdown_extensions:
3838
nav:
3939
- Getting started: index.md
4040
- Creating application: creating_application.md
41-
- Running application: runnig_application.md
41+
- Running application: runnig_application.md

0 commit comments

Comments
 (0)