Last active
May 12, 2021 17:59
-
-
Save gwerbin/1b844b6253a896a041e277769f1adbfb to your computer and use it in GitHub Desktop.
Attempt at setting up Debugpy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let g:remote_dap_host = '127.0.0.1' | |
let g:remote_dap_port = 9001 | |
lua <<LUA | |
local dap = require('dap') | |
dap.adapters.generic_remote = function(callback, config) | |
callback({ | |
type = 'server', | |
host = vim.g.dap_host, | |
port = vim.g.dap_port, | |
}) | |
end | |
dap.configurations.python = { | |
{ | |
type = 'generic_remote', | |
request = 'attach', | |
name = 'Generic remote', | |
}, | |
} | |
LUA | |
nnoremap <localleader>do <cmd>call v:lua.dap.repl.open()<cr> | |
nnoremap <localleader>dc <cmd>call v:lua.dap.continue()<cr> | |
nnoremap <localleader>dx <cmd>call v:lua.dap.stop()<cr> | |
nnoremap <localleader>dr <cmd>call v:lua.dap.run_last()<cr> | |
nnoremap <localleader>dbb <cmd>call v:lua.dap.toggle_breakpoint()<cr> | |
nnoremap <localleader>dbB <cmd>call v:lua.dap.set_breakpoint()<cr> | |
nnoremap <localleader>dbe <cmd>call v:lua.dap.set_exception_breakpoints('uncaught')<cr> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.8" | |
services: | |
api: | |
container_name: api | |
hostname: api | |
build: | |
context: . | |
ports: | |
- 8001:8001 # service | |
- 9001:9001 # debugpy | |
volumes: | |
- ./runtime:/app/runtime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM $REDACTED | |
# Install basics | |
RUN /opt/venv/bin/python -m pip install -U pip | |
RUN /opt/venv/bin/pip install -U setuptools wheel | |
# Install runtime deps | |
COPY requirements.txt /app/requirements.txt | |
RUN /opt/venv/bin/pip install -r /app/requirements.txt | |
# Install dev deps | |
COPY requirements-dev.txt /app/requirements-dev.txt | |
RUN /opt/venv/bin/pip install -r /app/requirements-dev.txt | |
# Copy entrypoint script | |
COPY entrypoint.sh /app/entrypoint.sh | |
# Debugpy | |
EXPOSE 9001/tcp | |
# Service | |
EXPOSE 8001/tcp | |
CMD ["/app/entrypoint.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cd /app/runtime | |
/opt/venv/bin/python -m debugpy --listen 0.0.0.0:9001 -m uvicorn --reload --host 0.0.0.0 --port 8001 service:app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
debugpy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trio | |
quart | |
uvicorn[standard] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import quart | |
logger = logging.getLogger(__name__) | |
logging.basicConfig(level=logging.INFO) | |
app = quart.Quart(__name__) | |
@app.route('/') | |
async def handle_hello(): | |
logger.info('Handling request.') | |
return 'Hello, world!\n' | |
@app.route('/bad') | |
async def handle_bad(): | |
logger.critical('Bad request . . .') | |
raise RuntimeError('Oh no!!!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment