Skip to content

Commit 8153845

Browse files
committed
update code
1 parent d0b6234 commit 8153845

19 files changed

Lines changed: 174 additions & 74 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ jobs:
3838
with:
3939
shared-key: "linux-build"
4040

41+
- name: Generate protocol files
42+
run: cargo check --package protocol
43+
4144
- name: Check format
4245
run: cargo fmt --all -- --check
4346

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
4545
WORKDIR /app
4646

4747
COPY --from=builder /build/target/release/function-stream bin/
48-
COPY --from=builder /build/python/functionstream-runtime/target/functionstream-python-runtime.wasm data/cache/python-runner/
48+
COPY --from=builder \
49+
/build/python/functionstream-runtime/target/functionstream-python-runtime.wasm \
50+
data/cache/python-runner/
4951
COPY config.yaml conf/
5052
RUN sed -i 's/127.0.0.1/0.0.0.0/' conf/config.yaml
5153

python/functionstream-api/build_package.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,25 +113,30 @@ def clean(self) -> None:
113113
def build(self) -> None:
114114
"""
115115
Executes the build process using the PyPA `build` module.
116-
Runs from work_dir.parent with work_dir as srcdir so that a local build.py
117-
in work_dir cannot shadow "python -m build", avoiding infinite recursion.
116+
Runs from work_dir.parent with work_dir as srcdir so that a local
117+
build.py in work_dir cannot shadow "python -m build", avoiding
118+
infinite recursion.
118119
"""
119120
logger.info("Building python package...")
120121

121122
self.dist_dir.mkdir(parents=True, exist_ok=True)
122123

123-
# Run from parent directory and explicitly pass project path to avoid local build.py shadowing PyPA's build
124+
# Run from parent directory and explicitly pass project path to avoid
125+
# local build.py shadowing PyPA's build
124126
cmd = [
125127
self.python_exec, "-m", "build",
126128
"--outdir", str(self.dist_dir),
127129
str(self.work_dir),
128130
]
129-
run_cwd = self.work_dir.parent # Cannot be work_dir, otherwise "python -m build" will load local build.py causing infinite recursion
131+
# Cannot be work_dir, otherwise "python -m build" will load local
132+
# build.py causing infinite recursion
133+
run_cwd = self.work_dir.parent
130134

131135
logger.info(f"Executing: {' '.join(cmd)}")
132136

133137
try:
134-
# Use inherit (stdout/stderr=None) to avoid PIPE buffer full causing subprocess blocking or timeout
138+
# Use inherit (stdout/stderr=None) to avoid PIPE buffer full
139+
# causing subprocess blocking or timeout
135140
subprocess.run(
136141
cmd,
137142
cwd=run_cwd,
@@ -141,7 +146,8 @@ def build(self) -> None:
141146
)
142147
except subprocess.CalledProcessError as e:
143148
logger.error("Build process failed.")
144-
# When using inherit, no captured content, prompt user to check terminal output above
149+
# When using inherit, no captured content, prompt user to check
150+
# terminal output above
145151
if e.stdout or e.stderr:
146152
logger.error(f"STDOUT:\n{e.stdout}")
147153
logger.error(f"STDERR:\n{e.stderr}")

python/functionstream-api/src/fs_api/context.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,3 @@ def getConfig(self) -> Dict[str, str]:
4646
pass
4747

4848
__all__ = ['Context']
49-

python/functionstream-api/src/fs_api/driver.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import abc
1414
from .context import Context
1515

16+
1617
class FSProcessorDriver(abc.ABC):
1718

1819
@abc.abstractmethod

python/functionstream-api/src/fs_api/store/complexkey.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
# See the License for the specific language governing permissions and
1111
# limitations under the License.
1212

13-
1413
from dataclasses import dataclass
1514

1615

python/functionstream-api/src/fs_api/store/error.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
# See the License for the specific language governing permissions and
1111
# limitations under the License.
1212

13-
1413
class KvError(Exception):
1514
pass
1615

@@ -30,5 +29,6 @@ def __init__(self, message: str):
3029
self.message = message
3130
super().__init__(message)
3231

32+
3333
__all__ = ['KvError', 'KvNotFoundError', 'KvIOError', 'KvOtherError']
3434

python/functionstream-api/src/fs_api/store/iterator.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,3 @@ def next(self) -> Optional[Tuple[bytes, bytes]]:
2626
pass
2727

2828
__all__ = ['KvIterator']
29-

python/functionstream-api/src/fs_api/store/store.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ def list_complex(self, key_group: bytes, key: bytes, namespace: bytes,
6565
start_inclusive: bytes, end_exclusive: bytes) -> List[bytes]:
6666
pass
6767

68-
6968
@abc.abstractmethod
7069
def scan_complex(self, key_group: bytes, key: bytes, namespace: bytes) -> KvIterator:
7170
pass

python/functionstream-client/scripts/codegen.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ def __init__(self, proto_root: Path, output_dir: Path, proto_files: List[str]):
5050
def _check_paths(self):
5151
"""Validates input paths."""
5252
if not self.proto_root.exists():
53-
raise FileNotFoundError(f"Proto root directory not found: {self.proto_root}")
53+
raise FileNotFoundError(
54+
f"Proto root directory not found: {self.proto_root}"
55+
)
5456

5557
for p_file in self.proto_files:
5658
if not (self.proto_root / p_file).exists():
@@ -94,7 +96,9 @@ def _get_protoc_args(self) -> List[str]:
9496
)
9597
logger.info("Enabled mypy-protobuf type generation.")
9698
else:
97-
logger.warning("mypy-protobuf not found. Skipping .pyi generation.")
99+
logger.warning(
100+
"mypy-protobuf not found. Skipping .pyi generation."
101+
)
98102

99103
for p_file in self.proto_files:
100104
args.append(str(self.proto_root / p_file))
@@ -106,15 +110,18 @@ def _resolve_protoc_gen_mypy() -> Optional[str]:
106110
"""
107111
Resolves the protoc-gen-mypy executable path.
108112
Protoc looks for plugins via PATH; when run from make/CI, venv bin may
109-
not be on PATH. Prefer the executable next to sys.executable, then PATH.
113+
not be on PATH. Prefer the executable next to sys.executable,
114+
then PATH.
110115
"""
111116
import sys as _sys
112117

113118
# 1. Same dir as current Python (venv bin when run via make)
114119
bin_dir = Path(_sys.executable).resolve().parent
115120
for name in ("protoc-gen-mypy", "protoc-gen-mypy.exe"):
116121
candidate = bin_dir / name
117-
if candidate.exists() and (candidate.is_file() or candidate.is_symlink()):
122+
if candidate.exists() and (
123+
candidate.is_file() or candidate.is_symlink()
124+
):
118125
return str(candidate)
119126

120127
# 2. On PATH
@@ -166,7 +173,9 @@ def run(self):
166173
logger.info(f"Code generation complete. Output: {self.output_dir}")
167174

168175
except Exception:
169-
logger.exception("An unexpected error occurred during code generation.")
176+
logger.exception(
177+
"An unexpected error occurred during code generation."
178+
)
170179
sys.exit(1)
171180

172181

@@ -195,7 +204,10 @@ def main():
195204
"files",
196205
nargs="*",
197206
default=["function_stream.proto"],
198-
help="Specific .proto files to compile (default: function_stream.proto)",
207+
help=(
208+
"Specific .proto files to compile "
209+
"(default: function_stream.proto)"
210+
),
199211
)
200212

201213
args = parser.parse_args()

0 commit comments

Comments
 (0)