Skip to content

Commit

Permalink
TLK-1990 VSCode/PyCharm debugger and documentation - review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneLightsOn committed Nov 26, 2024
1 parent 592eac5 commit cdba412
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 201 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ dev-sync-down:

.PHONY: vscode-debug
vscode-debug:
@docker compose -f docker-compose.vscode.debug.yml up --build
@DEBUGGER_IDE=vscode docker compose -f docker-compose.debug.yml up --build

.PHONY: pycharm-debug
pycharm-debug:
@docker compose -f docker-compose.pycharm.debug.yml up --build
@DEBUGGER_IDE=pycharm docker compose -f docker-compose.debug.yml up --build



Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ services:
context: .
args:
INSTALL_COMMUNITY_DEPS: false
dockerfile: ./src/backend/pycharm.debug.Dockerfile
DEBUGGER_IDE: ${DEBUGGER_IDE}
dockerfile: ./src/backend/debug.Dockerfile
develop:
watch:
- action: sync
Expand Down
128 changes: 0 additions & 128 deletions docker-compose.vscode.debug.yml

This file was deleted.

9 changes: 9 additions & 0 deletions docker_scripts/debugrun-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

if [ "$DEBUGGER_IDE" = "vscode" ]; then
python -m debugpy --listen 0.0.0.0:5678 -m uvicorn backend.main:app --reload --host 0.0.0.0 --port ${PORT} --timeout-keep-alive 300
elif [ "$DEBUGGER_IDE" = "pycharm" ]; then
python src/backend/pycharm_debug_main.py
else
echo "Debugger IDE is not set to a recognized value. Fix the value of DEBUGGER_IDE."
fi
53 changes: 37 additions & 16 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ optional = true
[tool.poetry.group.local-model.dependencies]
llama-cpp-python = "^0.2.67"

[tool.poetry.group.local-debug]
optional = true

[tool.poetry.group.local-debug.dependencies]
debugpy = "^1.8.9"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,29 @@ ENV PORT=${PORT}

# Build with community packages
ARG INSTALL_COMMUNITY_DEPS

ARG DEBUGGER_IDE
ENV DEBUGGER_IDE=${DEBUGGER_IDE}
# Copy dependency files to avoid cache invalidations
COPY pyproject.toml poetry.lock ./
COPY docker_scripts/debugrun-entrypoint.sh ./debugrun-entrypoint.sh
RUN ["chmod", "+x", "./debugrun-entrypoint.sh"]

# Install poetry
RUN pip install --no-cache-dir poetry==1.6.1
# Conditional installation of dependencies
RUN if [ "$INSTALL_COMMUNITY_DEPS" = "true" ]; then \
poetry install --with dev,community; \
if [ "$DEBUGGER_IDE" = "vscode" ]; then \
poetry install --with dev,community,local-debug; \
else \
poetry install --with dev,community; \
fi; \
else \
poetry install --with dev; \
if [ "$DEBUGGER_IDE" = "vscode" ]; then \
poetry install --with dev,local-debug; \
else \
poetry install --with dev; \
fi; \
fi
RUN poetry add debugpy

COPY src/backend/ src/backend/
COPY src/community src/community/
Expand All @@ -48,4 +58,5 @@ COPY .en[v] .env
EXPOSE ${PORT}
EXPOSE 5678

CMD python3 -m debugpy --listen 0.0.0.0:5678 -m uvicorn backend.main:app --reload --host 0.0.0.0 --port ${PORT} --timeout-keep-alive 300

CMD ["/workspace/debugrun-entrypoint.sh"]
49 changes: 0 additions & 49 deletions src/backend/pycharm.debug.Dockerfile

This file was deleted.

0 comments on commit cdba412

Please sign in to comment.