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

run app.py with 'uv run' (deps managed by uv add --script) #8

Merged
merged 2 commits into from
Aug 20, 2024
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
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ source venv/bin/activate
pip install -r requirements.txt
```

or just install uv and let it manage everything else just-in-time.

```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```


### Get HTTPS working
<details>
Expand Down Expand Up @@ -68,10 +74,18 @@ Also set USE_NGROK or USE_TAILSCALE to something nonempty, to pick one of them t

Inside the python virtual environment, run:

```
```bash
python app.py
```

or if you are using uv, just run

```bash
./app.py
```

and it will manage the virtualenv and dependencies for you.

This will start the server on http port 8000, which tailscale will expose as https://yourhostname.your-tailnet-domain.ts.net/.

<!-- TODO: add a jupyter-style auth token to the url and print it somehow? -->
Expand Down
14 changes: 14 additions & 0 deletions app.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#!/usr/bin/env uv run
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "flask==3.*",
# "rerun-sdk==0.17.0",
# "opencv-python==4.*",
# "pyquaternion==0.9.*",
# "pyngrok==7.*",
# "python-dotenv==1.*",
# "pymycobot==3.*",
# "requests==2.*",
# ]
# ///
import hashlib
import hmac
import json
Expand Down