Skip to content
Open
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
12 changes: 12 additions & 0 deletions .devcontainer/Dockerfile
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/*
30 changes: 30 additions & 0 deletions .devcontainer/devcontainer.json
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}"
// },
Comment on lines +7 to +14
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to remove

"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"
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

]
}
}
}
58 changes: 58 additions & 0 deletions .devcontainer/post-create.sh
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
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Always reference these instructions first and fallback to search or bash command

**Prerequisites:**

- Install Python 3.9+ from https://www.python.org/downloads/
- Install Python 3.11+ from https://www.python.org/downloads/
- Install Hatch: `pip install hatch`
- Install Bun JavaScript runtime: `curl -fsSL https://bun.sh/install | bash && source ~/.bashrc`
- Install Git
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ pip-wheel-metadata

# --- IDE ---
.idea
.vscode
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the .idea folder is intended to be private to a user, this is not the case for .vscode which is intended to be a workspace specific configuration.


# --- JS ---
node_modules
Expand Down
22 changes: 22 additions & 0 deletions .vscode/launch.json
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"
}
}
]
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
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
}
2 changes: 1 addition & 1 deletion docs/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["rmorshea <ryan.morshead@gmail.com>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.9"
python = "^3.11"
furo = "2022.04.07"
reactpy = { path = "..", extras = ["all"], develop = false }
sphinx = "*"
Expand Down
2 changes: 1 addition & 1 deletion docs/source/about/contributor-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Creating a development environment
If you plan to make code changes to this repository, you will need to install the following dependencies first:

- `Git <https://www.python.org/downloads/>`__
- `Python 3.9+ <https://www.python.org/downloads/>`__
- `Python 3.11+ <https://www.python.org/downloads/>`__
- `Hatch <https://hatch.pypa.io/latest/>`__
- `Bun <https://bun.sh/>`__
- `Docker <https://docs.docker.com/get-docker/>`__ (optional)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Below are some ways to update dictionaries without mutating them:

{**d, "key": value}

# Python >= 3.9
# Python >= 3.11
d | {"key": value}

# Equivalent to dict.setdefault()
Expand Down Expand Up @@ -192,7 +192,7 @@ Updating Dictionary Items

{**d, key: value}

# Python >= 3.9
# Python >= 3.11
d | {key: value}

# Equivalent to setdefault()
Expand Down
Loading