-
-
Notifications
You must be signed in to change notification settings - Fork 330
Add devcontainer configuration #1344
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| FROM mcr.microsoft.com/devcontainers/python:1-3.11-bookworm | ||
|
|
||
| # Add Yarn GPG key and APT repo securely | ||
| RUN curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarn-archive-keyring.gpg > /dev/null | ||
|
|
||
| RUN apt-get update \ | ||
| && apt-get install -y --no-install-recommends \ | ||
| ca-certificates \ | ||
| curl \ | ||
| git \ | ||
| gnupg \ | ||
| && rm -rf /var/lib/apt/lists/* |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| { | ||
| "name": "ReactPy", | ||
| "build": { | ||
| "dockerfile": "Dockerfile", | ||
| "context": ".." | ||
| }, | ||
| // "remoteUser": "vscode", | ||
| // "containerEnv": { | ||
| // "BUN_INSTALL": "/home/vscode/.bun" | ||
| // }, | ||
| // "remoteEnv": { | ||
| // "BUN_INSTALL": "/home/vscode/.bun", | ||
| // "PATH": "/home/vscode/.bun/bin:${containerEnv:PATH}" | ||
| // }, | ||
| "postCreateCommand": "bash .devcontainer/post-create.sh", | ||
| "customizations": { | ||
| "vscode": { | ||
| "settings": { | ||
| "python.defaultInterpreterPath": "/usr/local/bin/python", | ||
| "python.terminal.activateEnvironment": false | ||
| }, | ||
| "extensions": [ | ||
| "ms-python.python", | ||
| "ms-python.vscode-pylance", | ||
| "charliermarsh.ruff", | ||
| "ms-playwright.playwright" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extensions were plugged in with AI and should be updated to respect a sane workflow. No idea what this playwright extension is. |
||
| ] | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| # Workaround for hatch/virtualenv incompatibility | ||
| python3 -m pip install --upgrade "virtualenv==20.25.1" | ||
|
|
||
| # Install core ReactPy dependencies | ||
| pip install fastjsonschema requests lxml anyio typing-extensions | ||
|
|
||
| # Install ASGI dependencies for server functionality | ||
| pip install orjson asgiref asgi-tools servestatic uvicorn fastapi | ||
|
|
||
| # Optional: Install additional servers | ||
| pip install flask sanic tornado | ||
|
|
||
| export BUN_INSTALL="${BUN_INSTALL:-$HOME/.bun}" | ||
| export PATH="$BUN_INSTALL/bin:$PATH" | ||
|
|
||
| if [[ -f /etc/apt/sources.list.d/yarn.list ]]; then | ||
| echo "Refreshing Yarn APT keyring..." | ||
| curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg \ | ||
| | gpg --dearmor \ | ||
| | sudo tee /usr/share/keyrings/yarn-archive-keyring.gpg >/dev/null | ||
| fi | ||
|
|
||
| if ! command -v hatch >/dev/null 2>&1; then | ||
| echo "Installing Hatch..." | ||
| python3 -m pip install --user hatch | ||
| fi | ||
|
|
||
| if ! command -v bun >/dev/null 2>&1; then | ||
| echo "Installing Bun..." | ||
| curl -fsSL https://bun.sh/install | bash | ||
| fi | ||
|
|
||
| echo "Building JavaScript packages..." | ||
| hatch run javascript:build --dev | ||
|
|
||
| echo "Building Python package..." | ||
| hatch build --clean | ||
|
|
||
| echo "Running ReactPy smoke test..." | ||
| hatch run python - <<'PY' | ||
| from reactpy import component, html | ||
|
|
||
|
|
||
| @component | ||
| def test_component(): | ||
| return html.div([ | ||
| html.h1("Test"), | ||
| html.p("ReactPy is working"), | ||
| ]) | ||
|
|
||
|
|
||
| vdom = test_component() | ||
| print(type(vdom).__name__) | ||
| PY |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,7 +43,6 @@ pip-wheel-metadata | |
|
|
||
| # --- IDE --- | ||
| .idea | ||
| .vscode | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While the |
||
|
|
||
| # --- JS --- | ||
| node_modules | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| { | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
|
|
||
| { | ||
| "name": "Python: Uvicorn main:app", | ||
| "type": "debugpy", | ||
| "request": "launch", | ||
| "module": "uvicorn", | ||
| "args": [ | ||
| "main:app", | ||
| "--reload" | ||
| ], | ||
| "jinja": true, | ||
| "justMyCode": false, | ||
| "console": "integratedTerminal", | ||
| "env": { | ||
| "PYTHONPATH": "./src" | ||
| } | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "python.testing.pytestArgs": [ | ||
| "tests" | ||
| ], | ||
| "python.testing.unittestEnabled": false, | ||
| "python.testing.pytestEnabled": true | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to remove