You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Puppy can be used as a CLI in a Linux or Windows shell, or as a [module](#using-pup-as-a-module-pupfetch) in any python shell/script/[notebook](#puppy--environments-in-notebooks).
51
51
52
52
Installing puppy preps the folder to house python, in complete isolation from system or any other python on your system:
53
53
54
54
0) 🐍 this folder is home to one and only one python executable, managed by pixi
2) ⚙ [Bash](https://github.com/liquidcarbon/puppy/blob/main/pup.sh) or [Powershell](https://github.com/liquidcarbon/puppy/blob/main/pup.ps1) runner/installer is placed into `~/.pixi/bin` (the only folder that goes on PATH)
57
-
3) 🐶 `pup.py` is the python/[click](https://github.com/pallets/click) CLI that wraps pixi and uv commands
57
+
3) 🐶 `pup.py` is the python/click CLI that wraps pixi and uv commands
58
58
4) 🟣 `pup new` and `pup add` use uv to handle projects, packages and virtual environments
59
59
5) 📀 `pup clone` and `pup sync` help build environments from external `pyproject.toml` project files
Pup can help you construct and activate python projects interactively, such as from (i)python shells, jupyter notebooks, or [marimo notebooks](https://github.com/marimo-team/marimo/discussions/2994).
66
66
@@ -142,12 +142,61 @@ Specify what to install:
142
142
Hello from test-only-root!
143
143
```
144
144
145
-
## Notebooks (WIP)
145
+
## Puppy & Environments in Notebooks
146
146
147
-
Coming soon: templates for Jupyter and Marimo notebooks.
148
-
[Unified environment management for any computational notebooks](https://github.com/marimo-team/marimo/discussions/2994) - no more Jupyter kernels!
147
+
> [!NOTE]
148
+
> Conda or PyPI packages installed with `pixi add ...` always remain on `sys.path` and stay available across all environments. Though one could exclude them, I have yet to find a reason to do so.
149
+
150
+
### Jupyter
151
+
152
+
There's a good chance you're confused about how Jupyter kernels work and find setting up kernels with virtual environments too complicated to bother. Puppy's [v1](https://github.com/liquidcarbon/puppy/tree/v1) was addressing that problem, but in v2 (current version) this is taken care of by `pup.fetch`. Here's the gist:
153
+
154
+
1) install ONE instance of jupyter with `pixi add jupyter` per major version of python
155
+
2) run it with `pixi run jupyter lab` or `pixi run jupyter notebook`
156
+
3) use `pup.fetch` to build and activate your environment - THAT'S IT!
157
+
158
+
For details, scan through the [previous section](#using-pup-as-a-module-pupfetch). In brief, `pup.fetch` creates/modifies and/or activates your venv by appending its folder to `sys.path`. This is pretty very similar to how venvs and kernels work. A jupyter kernel is a pointer to a python executable. Within a venv, the executable `.venv/bin/python` is just a symlink to the parent python - in our case, to pixi's python. The activation and separation of packages is achieved by manipulating `sys.path` to include local `site-packages` folder(s).
159
+
160
+
161
+
### Marimo
162
+
163
+
With marimo, you have more options: [Unified environment management for any computational notebooks](https://github.com/marimo-team/marimo/discussions/2994) - no more Jupyter kernels!
164
+
165
+
## Multi-Puppy-Verse
166
+
167
+
Can I have multiple puppies? As many as you want! Puppy is not just a package installer, but also a system to organize multiple python projects.
168
+
169
+
A pup/py home is defined by one and only one python executable, which is managed by pixi, along with tools like uv, jupyter, hatch, pytest, and conda-managed packages. We use home-specific tools through a pixi shell from anywhere within the folder, e.g. `pixi run python`, `pixi run jupyter`, or, to be explicit, by calling their absolute paths.
170
+
171
+
> [!NOTE]
172
+
> If you need a "kernel" with a different version of python, install puppy in a new folder. **Puppy's folders are completely isolated from each other and any other python installation on your system.** Remember, one puppy folder = one python executable, managed by Pixi. Pup commands work the same from anywhere within a pup folder, run relative to its root, via `.pixi/envs/default/bin/python`. Place puppy folders side-by-side, not within other puppy folders - nested puppies might misbehave.
173
+
174
+
```
175
+
# ├── puphome/ # python 3.12 lives here
176
+
# │ ├── public-project/
177
+
# │ │ ├── .git # this folder may be a git repo (see pup clone)
178
+
# │ │ ├── .venv
179
+
# │ │ └── pyproject.toml
180
+
# │ ├── env2/
181
+
# │ │ ├── .venv/ # this one is in pre-git development
182
+
# │ │ └── pyproject.toml
183
+
# │ ├── pixi.toml
184
+
# │ └── pup.py
185
+
# ├── pup311torch/ # python 3.11 here
186
+
# │ ├── env3/
187
+
# │ ├── env4/
188
+
# │ ├── pixi.toml
189
+
# │ └── pup.py
190
+
# └── pup313beta/ # 3.13 here
191
+
# ├── env5/
192
+
# ├── pixi.toml
193
+
# └── pup.py
194
+
```
195
+
196
+
The blueprint for a pup/py home is in `pixi.toml`; at this level, git is usually not needed. The inner folders are git-ready project environments managed by pup and uv. In each of the inner folders, there is a classic `.venv` folder and a `pyproject.toml` file populated by uv. When you run `pup list`, pup scans this folder structure and looks inside each `pyproject.toml`. The whole setup is very easy to [containerize](examples/) (command to generate `Dockerfile` coming soon!).
149
197
150
-
`pup play --help`
198
+
> [!TIP]
199
+
> Use `pup list -f` to list all dependencies spelled out in `uv.lock`.
0 commit comments