Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor comments #22

Merged
merged 10 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions python/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,7 @@ pyrightconfig.json

# data files
*.rrd

# benchmark artifacts
benchmarks/payload
benchmarks/results
56 changes: 56 additions & 0 deletions python/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# TODO: remove
# FROm python:3.12-slim-bookworm
#
# WORKDIR /app
# COPY python_grpc_bench /app
# COPY proto /app/proto
#
# RUN python -m pip install grpcio grpcio-tools
# RUN python -m grpc_tools.protoc -I/app/proto/helloworld --python_out=. --grpc_python_out=. helloworld.proto
#
# ENTRYPOINT [ "python", "/app/server.py" ]

# FROM python:3.12-alpine AS base
FROM python:3.12-slim-bookworm AS base

ENV VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH"

# RUN apk update && \
# apk add libpq


FROM base AS builder

ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache

# RUN apk update && \
# apk add musl-dev build-base gcc gfortran openblas-dev

WORKDIR /app

RUN pip install --no-cache-dir poetry==1.8.4

COPY pyproject.toml poetry.lock ./
RUN poetry install --without dev --no-root && rm -rf $POETRY_CACHE_DIR;


FROM base AS runtime

COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}


WORKDIR /app

COPY arflow ./arflow
COPY cakelab ./cakelab

EXPOSE 8500

ENV PORT=8500

# TODO: Vary entrypoint to include save mode
ENTRYPOINT ["python", "-m", "arflow._cli", "view"]
20 changes: 20 additions & 0 deletions python/arflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,20 @@
SessionStream as SessionStream,
)
from cakelab.arflow_grpc.v1.ar_frame_pb2 import ARFrame as ARFrame
from cakelab.arflow_grpc.v1.audio_frame_pb2 import AudioFrame as AudioFrame
from cakelab.arflow_grpc.v1.color_frame_pb2 import ColorFrame as ColorFrame
from cakelab.arflow_grpc.v1.depth_frame_pb2 import DepthFrame as DepthFrame
from cakelab.arflow_grpc.v1.device_pb2 import Device as Device
from cakelab.arflow_grpc.v1.gyroscope_frame_pb2 import GyroscopeFrame as GyroscopeFrame
from cakelab.arflow_grpc.v1.mesh_detection_frame_pb2 import (
MeshDetectionFrame as MeshDetectionFrame,
)
from cakelab.arflow_grpc.v1.plane_detection_frame_pb2 import (
PlaneDetectionFrame as PlaneDetectionFrame,
)
from cakelab.arflow_grpc.v1.point_cloud_detection_frame_pb2 import (
PointCloudDetectionFrame as PointCloudDetectionFrame,
)
from cakelab.arflow_grpc.v1.session_pb2 import Session as Session
from cakelab.arflow_grpc.v1.transform_frame_pb2 import TransformFrame as TransformFrame

Expand All @@ -19,6 +32,13 @@
"ARFlowServicer",
"ARFrame",
"TransformFrame",
"ColorFrame",
"DepthFrame",
"GyroscopeFrame",
"AudioFrame",
"PlaneDetectionFrame",
"PointCloudDetectionFrame",
"MeshDetectionFrame",
"SessionStream",
"Session",
"Device",
Expand Down
2 changes: 1 addition & 1 deletion python/arflow/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def parse_args(
"-p",
"--port",
type=int,
default=8500,
default=int(os.getenv("PORT", 8500)),
help=f"Port to run the server on (default: %(default)s).",
)
view_parser.add_argument(
Expand Down
Loading