Skip to content

Commit 9fbbb41

Browse files
committed
Improve Python SDK
Signed-off-by: Zike Yang <[email protected]>
1 parent 5ff41a9 commit 9fbbb41

File tree

15 files changed

+154
-61
lines changed

15 files changed

+154
-61
lines changed

sdks/fs-python/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ build-image:
44
docker build -t functionstream/fs-python-base .
55

66
test:
7-
pytest -v
7+
PYTHONPATH=. python -m pytest

sdks/fs-python/README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,21 @@ FunctionStream SDK is a powerful Python library for building and deploying serve
2424
- **Message Processing**: Built-in support for Apache Pulsar message processing
2525
- **Metrics Collection**: Automatic collection of performance metrics
2626
- **Resource Management**: Efficient handling of connections and resources
27-
- **Graceful Shutdown**: Proper cleanup of resources during shutdown
2827
- **Configuration Management**: Flexible configuration through YAML files
29-
- **Schema Validation**: Input and output schema validation
3028
- **Error Handling**: Comprehensive error handling and logging
3129

3230
## Installation
3331

3432
```bash
35-
pip install fs-sdk
33+
pip install function-stream
3634
```
3735

3836
## Quick Start
3937

4038
1. Create a function that processes messages:
4139

4240
```python
43-
from fs_sdk import FSFunction
41+
from function_stream import FSFunction
4442

4543
async def my_process_function(request_data: dict) -> dict:
4644
# Process the request data
@@ -180,13 +178,13 @@ source venv/bin/activate # Linux/Mac
180178
pip install -r requirements.txt
181179
182180
# Install the package in development mode
183-
pip install -e .
181+
python -m pip install -e .
184182
```
185183

186184
### Running Tests
187185

188186
```bash
189-
pytest
187+
make test
190188
```
191189

192190
## Support
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from .function import FSFunction
22
from .module import FSModule
33

4-
__version__ = "0.1.0"
4+
__version__ = "0.6.0rc1"
55
__all__ = ["FSFunction", "FSModule"]

sdks/fs-python/fs_sdk/config.py renamed to sdks/fs-python/function_stream/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class Config(BaseModel):
9898
sink: Optional[SinkSpec] = None
9999
"""Output sink configuration (optional)"""
100100

101-
subscriptionName: str = "fs-sdk-subscription"
101+
subscriptionName: str = "function-stream-sdk-subscription"
102102
"""Pulsar subscription name for consuming messages"""
103103

104104
metric: Metric = Field(default_factory=Metric)

sdks/fs-python/pytest.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ testpaths = tests
33
python_files = test_*.py
44
python_classes = Test*
55
python_functions = test_*
6-
asyncio_mode = auto
76
log_cli = true
87
log_cli_level = INFO
98
log_cli_format = %(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)
10-
log_cli_date_format = %Y-%m-%d %H:%M:%S
9+
log_cli_date_format = %Y-%m-%d %H:%M:%S
10+
asyncio_default_fixture_loop_scope = function

sdks/fs-python/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
pulsar-client>=3.0.0
2+
pyyaml>=6.0
23
aiohttp>=3.8.0
34
pydantic>=2.0.0

0 commit comments

Comments
 (0)