Skip to content

Commit 365cade

Browse files
committed
Add release for python SDK
Signed-off-by: Zike Yang <[email protected]>
1 parent 9fbbb41 commit 365cade

File tree

8 files changed

+149
-81
lines changed

8 files changed

+149
-81
lines changed
Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
from .function import FSFunction
22
from .module import FSModule
3+
from .config import Config, PulsarConfig, PulsarSourceConfig, SourceSpec, SinkSpec, Metric
4+
from .context import FSContext
5+
from .metrics import Metrics, MetricsServer
36

47
__version__ = "0.6.0rc1"
5-
__all__ = ["FSFunction", "FSModule"]
8+
__all__ = [
9+
# Core classes
10+
"FSFunction",
11+
"FSModule",
12+
13+
# Configuration classes
14+
"Config",
15+
"PulsarConfig",
16+
"PulsarSourceConfig",
17+
"SourceSpec",
18+
"SinkSpec",
19+
"Metric",
20+
21+
# Context and utilities
22+
"FSContext",
23+
24+
# Metrics and monitoring
25+
"Metrics",
26+
"MetricsServer"
27+
]

sdks/fs-python/function_stream/config.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,6 @@ class PulsarSourceConfig(BaseModel):
3131
"""
3232
topic: str
3333
"""Pulsar topic name to consume from or produce to"""
34-
35-
serviceUrl: Optional[str] = None
36-
"""Override service URL for this specific source/sink (optional)"""
37-
38-
authPlugin: Optional[str] = None
39-
"""Override authentication plugin for this specific source/sink (optional)"""
40-
41-
authParams: Optional[str] = None
42-
"""Override authentication parameters for this specific source/sink (optional)"""
4334

4435
class SourceSpec(BaseModel):
4536
"""

sdks/fs-python/pyproject.toml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "function-stream"
7+
dynamic = ["version"]
8+
description = "FunctionStream SDK is a powerful Python library for building and deploying serverless streaming functions that runs on Function Stream platform."
9+
readme = "README.md"
10+
license = {text = "Apache-2.0"}
11+
authors = [
12+
{name = "FunctionStream Org"}
13+
]
14+
maintainers = [
15+
{name = "FunctionStream Org"}
16+
]
17+
keywords = ["serverless", "functions", "pulsar", "event-driven", "streaming"]
18+
classifiers = [
19+
"Development Status :: 4 - Beta",
20+
"Intended Audience :: Developers",
21+
"License :: OSI Approved :: Apache Software License",
22+
"Operating System :: OS Independent",
23+
"Programming Language :: Python :: 3",
24+
"Programming Language :: Python :: 3.9",
25+
"Programming Language :: Python :: 3.10",
26+
"Programming Language :: Python :: 3.11",
27+
"Programming Language :: Python :: 3.12",
28+
"Topic :: Software Development :: Libraries :: Python Modules",
29+
"Topic :: System :: Distributed Computing",
30+
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
31+
"Topic :: System :: Networking",
32+
]
33+
requires-python = ">=3.9"
34+
dependencies = [
35+
"pulsar-client>=3.0.0",
36+
"pyyaml>=6.0",
37+
"aiohttp>=3.8.0",
38+
"pydantic>=2.0.0",
39+
]
40+
41+
[project.optional-dependencies]
42+
dev = [
43+
"pytest>=7.0.0",
44+
"pytest-asyncio>=0.21.0",
45+
"black>=22.0.0",
46+
"flake8>=5.0.0",
47+
"mypy>=1.0.0",
48+
"pre-commit>=3.0.0",
49+
]
50+
test = [
51+
"pytest>=7.0.0",
52+
"pytest-asyncio>=0.21.0",
53+
"pytest-cov>=4.0.0",
54+
]
55+
docs = [
56+
"sphinx>=6.0.0",
57+
"sphinx-rtd-theme>=1.0.0",
58+
"myst-parser>=1.0.0",
59+
]
60+
61+
[project.urls]
62+
Homepage = "https://github.com/functionstream/function-stream"
63+
Documentation = "https://github.com/functionstream/function-stream/tree/main/sdks/fs-python"
64+
Repository = "https://github.com/functionstream/function-stream"
65+
"Bug Tracker" = "https://github.com/functionstream/function-stream/issues"
66+
"Source Code" = "https://github.com/functionstream/function-stream"
67+
68+
[tool.setuptools.dynamic]
69+
version = {attr = "function_stream.__version__"}
70+
71+
[tool.setuptools.packages.find]
72+
where = ["."]
73+
include = ["function_stream*"]
74+
exclude = ["tests*", "examples*"]
75+
76+
[tool.black]
77+
line-length = 88
78+
target-version = ['py39']
79+
include = '\.pyi?$'
80+
extend-exclude = '''
81+
/(
82+
# directories
83+
\.eggs
84+
| \.git
85+
| \.hg
86+
| \.mypy_cache
87+
| \.tox
88+
| \.venv
89+
| build
90+
| dist
91+
)/
92+
'''
93+
94+
[tool.isort]
95+
profile = "black"
96+
multi_line_output = 3
97+
line_length = 88
98+
known_first_party = ["function_stream"]
99+
100+
[tool.pytest.ini_options]
101+
minversion = "7.0"
102+
addopts = "-ra -q --strict-markers --strict-config"
103+
testpaths = ["tests"]
104+
python_files = ["test_*.py", "*_test.py"]
105+
python_classes = ["Test*"]
106+
python_functions = ["test_*"]
107+
markers = [
108+
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
109+
"integration: marks tests as integration tests",
110+
"unit: marks tests as unit tests",
111+
]

sdks/fs-python/setup.py

Lines changed: 0 additions & 62 deletions
This file was deleted.

sdks/fs-python/tests/test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import pytest
66
import yaml
7-
from function_stream.config import Config
7+
from function_stream import Config
88

99
class TestConfig:
1010
"""Test suite for Config class."""

sdks/fs-python/tests/test_context.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
import pytest
66
from unittest.mock import Mock, patch
7-
from function_stream.context import FSContext
8-
from function_stream.config import Config
7+
from function_stream import FSContext, Config
98

109
class TestFSContext:
1110
"""Test suite for FSContext class."""

sdks/fs-python/tests/test_function.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,18 @@
77
import asyncio
88
import pulsar
99
from unittest.mock import Mock, patch, AsyncMock
10-
from function_stream.function import FSFunction, MsgWrapper
11-
from function_stream.config import Config, PulsarConfig, SinkSpec, SourceSpec, PulsarSourceConfig
12-
from function_stream.metrics import Metrics, MetricsServer
10+
from function_stream import (
11+
FSFunction,
12+
Config,
13+
PulsarConfig,
14+
SinkSpec,
15+
SourceSpec,
16+
PulsarSourceConfig,
17+
Metrics,
18+
MetricsServer,
19+
FSContext
20+
)
21+
from function_stream.function import MsgWrapper
1322

1423
class TestFSFunction:
1524
"""Test suite for FSFunction class."""
@@ -89,7 +98,6 @@ def function(self, mock_config, mock_client, mock_consumer,
8998
mock_client.subscribe.return_value = mock_consumer
9099
mock_client.create_producer.return_value = mock_producer
91100

92-
from function_stream.context import FSContext
93101
from typing import Dict, Any
94102

95103
async def process_func(context: FSContext, data: Dict[str, Any]) -> Dict[str, Any]:
@@ -105,7 +113,6 @@ async def process_func(context: FSContext, data: Dict[str, Any]) -> Dict[str, An
105113
async def test_init(self):
106114
"""Test FSFunction initialization."""
107115
import inspect
108-
from function_stream.context import FSContext
109116
from typing import Dict, Any
110117

111118
async def process_func(context: FSContext, data: Dict[str, Any]) -> Dict[str, Any]:

sdks/fs-python/tests/test_metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pytest
66
import json
77
from aiohttp.test_utils import make_mocked_request
8-
from function_stream.metrics import Metrics, MetricsServer
8+
from function_stream import Metrics, MetricsServer
99

1010
@pytest.fixture
1111
def metrics():

0 commit comments

Comments
 (0)