Skip to content

Commit d954318

Browse files
committed
Add fs python sdk docker
Signed-off-by: Zike Yang <zike@apache.org>
1 parent 0aeeba0 commit d954318

File tree

8 files changed

+53
-15
lines changed

8 files changed

+53
-15
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ jobs:
6262
with:
6363
python-version: '3.11'
6464
- name: Install dependencies
65+
working-directory: sdks/fs-python
6566
run: |
66-
cd sdks/fs-python
6767
pip install .
6868
python -m pip install --upgrade pip
6969
pip install -r requirements.txt
7070
pip install pytest
7171
- name: Run Python SDK tests
72+
working-directory: sdks/fs-python
7273
run: |
73-
cd sdks/fs-python
74-
pytest
74+
make test
7575

sdks/fs-python/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM python:3.13-slim
2+
3+
WORKDIR /function
4+
5+
# Copy the SDK files
6+
COPY . /function/
7+
8+
# Install the SDK
9+
RUN pip install .
10+
11+
# Set the default command
12+
CMD ["python", "/function/function.py"]

sdks/fs-python/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.PHONY: build-image
2+
3+
build-image:
4+
docker build -t functionstream/fs-python-base .
5+
6+
test:
7+
pytest -v

sdks/fs-python/examples/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM functionstream/fs-python-base:latest
2+
3+
WORKDIR /function
4+
5+
COPY requirements.txt .
6+
RUN pip install -r requirements.txt
7+
8+
COPY string_function.py .
9+
COPY config.yaml .
10+
COPY package.yaml .
11+
12+
CMD ["python", "string_function.py"]

sdks/fs-python/examples/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
build-image:
3+
docker build -t my-function:latest .
4+
5+
.DEFAULT_GOAL := build-image

sdks/fs-python/examples/config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# This configuration file defines the settings for the string processing function example.
1717

1818
pulsar:
19-
serviceUrl: "pulsar://localhost:6650" # Required: URL of the Pulsar broker
19+
serviceUrl: "pulsar://192.168.31.80:6650" # Required: URL of the Pulsar broker
2020
authPlugin: "" # Optional: Authentication plugin class name
2121
authParams: "" # Optional: Authentication parameters
2222

@@ -28,14 +28,14 @@ sources:
2828
- pulsar: # SourceSpec structure with pulsar configuration
2929
topic: "topic-a" # Topic name for regular message consumption
3030

31-
# Required: Name of the subscription for the consumer
32-
subscriptionName: "test-sub"
33-
34-
# Optional: List of request source topics
31+
# Optional: request source
3532
requestSource:
3633
pulsar: # SourceSpec structure with pulsar configuration
3734
topic: "string-topic" # Topic name for request messages
3835

36+
# Required: Name of the subscription for the consumer
37+
subscriptionName: "test-sub"
38+
3939
# Optional: Output sink configuration
4040
sink:
4141
pulsar: # SinkSpec structure with pulsar configuration
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# None. Please add your own deps here.

sdks/fs-python/setup.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@
88
"pulsar-client>=3.0.0",
99
"pyyaml>=6.0",
1010
"aiohttp>=3.8.0",
11+
"pydantic>=2.0.0"
1112
],
12-
author="FuncionStream Org",
13-
author_email="your.email@example.com",
14-
description="A simple RPC service SDK that allows users to focus on their core business logic",
13+
author="FunctionStream Org",
14+
author_email="",
15+
description="FunctionStream SDK is a powerful Python library for building and deploying serverless functions that process messages from Apache Pulsar.",
1516
long_description=open("README.md").read(),
1617
long_description_content_type="text/markdown",
17-
url="https://github.com/yourusername/fs-sdk",
18+
url="https://github.com/functionstream/function-stream/sdks/fs-python",
1819
classifiers=[
1920
"Programming Language :: Python :: 3",
20-
"License :: OSI Approved :: MIT License",
21+
"License :: OSI Approved :: Apache Software License",
2122
"Operating System :: OS Independent",
2223
],
23-
python_requires=">=3.7",
24-
)
24+
python_requires=">=3.9",
25+
)

0 commit comments

Comments
 (0)