support for clone
Browse files- README.md +4 -1
- fetch.py +15 -6
- pyproject.toml +4 -1
README.md
CHANGED
@@ -18,7 +18,10 @@ See https://github.com/liquidcarbon/puppy
|
|
18 |
The `pup-py-fetch` API accepts query parameters that allow specifying the exact environment recipe you want to build:
|
19 |
- `python`: [3.10](https://pup-py-fetch.hf.space?python=3.10) through [3.13](https://pup-py-fetch.hf.space?python=3.13)
|
20 |
- `pixi`: [comma-separated list of pixi/Conda dependencies](https://pup-py-fetch.hf.space?pixi=jupyter,quarto)
|
21 |
-
-
|
|
|
|
|
|
|
22 |
|
23 |
> [!NOTE]
|
24 |
> As of Dec 2024, many packages still do not support python 3.13; thus, the default version in puppy is 3.12.
|
|
|
18 |
The `pup-py-fetch` API accepts query parameters that allow specifying the exact environment recipe you want to build:
|
19 |
- `python`: [3.10](https://pup-py-fetch.hf.space?python=3.10) through [3.13](https://pup-py-fetch.hf.space?python=3.13)
|
20 |
- `pixi`: [comma-separated list of pixi/Conda dependencies](https://pup-py-fetch.hf.space?pixi=jupyter,quarto)
|
21 |
+
- `clone`: [comma-separated list of GitHub repos to clone and install](https://pup-py-fetch.hf.space?clone=marimo-team/marimo) (only GitHub at this time)
|
22 |
+
- virtual environments: [all other query parameters with comma-separated package names](https://pup-py-fetch.hf.space?env1=duckdb,pandas&env2=cowsay), including:
|
23 |
+
- regular PyPI packages (no support for version pinning at this time)
|
24 |
+
- packages from GitHub repos using <username>/<reponame>
|
25 |
|
26 |
> [!NOTE]
|
27 |
> As of Dec 2024, many packages still do not support python 3.13; thus, the default version in puppy is 3.12.
|
fetch.py
CHANGED
@@ -47,12 +47,15 @@ def read_root(request: Request) -> Response:
|
|
47 |
Query parameters can be used to install specific things, e.g.
|
48 |
curl -fsSL "https://pup-py-fetch.hf.space?python=3.11&pixi=marimo&myenv=cowsay,duckdb"
|
49 |
|
50 |
-
A slash ("/") in package name is interpreted as a
|
51 |
Package specs "duckdb>=1.1" are not supported.
|
52 |
"""
|
53 |
|
54 |
query_params = dict(request.query_params)
|
55 |
|
|
|
|
|
|
|
56 |
# python version
|
57 |
py_ver = query_params.pop("python", "3.12")
|
58 |
if "Windows" in request.headers.get("user-agent"):
|
@@ -71,16 +74,22 @@ def read_root(request: Request) -> Response:
|
|
71 |
pixi_packages = query_params.pop("pixi", "")
|
72 |
if pixi_packages:
|
73 |
for pkg in pixi_packages.split(","):
|
74 |
-
if "/" in pkg:
|
75 |
-
pkg = f"https://github.com/{pkg}.git"
|
76 |
script.append(f"pixi add {pkg}")
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
# remaining query params are venvs
|
79 |
for venv, uv_packages in query_params.items():
|
80 |
-
if venv in ["logs"]:
|
81 |
-
continue
|
82 |
for pkg in uv_packages.split(","):
|
83 |
-
if "/" in pkg:
|
84 |
pkg = f"https://github.com/{pkg}.git"
|
85 |
script.append(f"pup add {venv} {pkg}")
|
86 |
|
|
|
47 |
Query parameters can be used to install specific things, e.g.
|
48 |
curl -fsSL "https://pup-py-fetch.hf.space?python=3.11&pixi=marimo&myenv=cowsay,duckdb"
|
49 |
|
50 |
+
A slash ("/") in package name is interpreted as a GitHub repo.
|
51 |
Package specs "duckdb>=1.1" are not supported.
|
52 |
"""
|
53 |
|
54 |
query_params = dict(request.query_params)
|
55 |
|
56 |
+
# exclude internal endpoints
|
57 |
+
_ = query_params.pop("logs", "")
|
58 |
+
|
59 |
# python version
|
60 |
py_ver = query_params.pop("python", "3.12")
|
61 |
if "Windows" in request.headers.get("user-agent"):
|
|
|
74 |
pixi_packages = query_params.pop("pixi", "")
|
75 |
if pixi_packages:
|
76 |
for pkg in pixi_packages.split(","):
|
|
|
|
|
77 |
script.append(f"pixi add {pkg}")
|
78 |
|
79 |
+
# repos to be cloned
|
80 |
+
to_clone = query_params.pop("clone", "")
|
81 |
+
if to_clone:
|
82 |
+
for repo in to_clone.split(","):
|
83 |
+
if "/" in repo:
|
84 |
+
pkg = f"https://github.com/{repo}.git"
|
85 |
+
script.append(f"pup clone {pkg}")
|
86 |
+
else:
|
87 |
+
script.append(f"# can't clone `{repo}`: expected <username>/<reponame>")
|
88 |
+
|
89 |
# remaining query params are venvs
|
90 |
for venv, uv_packages in query_params.items():
|
|
|
|
|
91 |
for pkg in uv_packages.split(","):
|
92 |
+
if "/" in pkg: # slash implies GitHub repo
|
93 |
pkg = f"https://github.com/{pkg}.git"
|
94 |
script.append(f"pup add {venv} {pkg}")
|
95 |
|
pyproject.toml
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
[project]
|
2 |
name = "fetch"
|
3 |
-
version = "0.
|
4 |
description = "Puppy Installer"
|
5 |
authors = [
|
6 |
{ name = "Alex Kislukhin" }
|
@@ -11,3 +11,6 @@ dependencies = [
|
|
11 |
"apscheduler>=3.11.0",
|
12 |
"fastapi[standard]>=0.115.6",
|
13 |
]
|
|
|
|
|
|
|
|
1 |
[project]
|
2 |
name = "fetch"
|
3 |
+
version = "0.6.0"
|
4 |
description = "Puppy Installer"
|
5 |
authors = [
|
6 |
{ name = "Alex Kislukhin" }
|
|
|
11 |
"apscheduler>=3.11.0",
|
12 |
"fastapi[standard]>=0.115.6",
|
13 |
]
|
14 |
+
|
15 |
+
[project.urls]
|
16 |
+
homepage = "https://github.com/liquidcarbon/puppy"
|