Puppy helps you set up and manage your python projects. It's the easiest way to get started with modern python on any platform, install packages in virtual environments, and contribute to external projects.
You need only curl
/ iwr
and an empty folder; pup will handle the rest, with a little help from its powerful friends pixi and uv.
curl -fsSL https://pup-py-fetch.hf.space | bash
iex (iwr https://pup-py-fetch.hf.space).Content
The pup-py-fetch
API accepts query parameters that allow specifying the exact environment recipe you want to build:
python
: 3.10 through 3.13pixi
: comma-separated list of pixi/Conda dependenciesclone
: comma-separated list of GitHub repos to clone and build in a virtual environment- virtual environments: all other query parameters with comma-separated package names, including:
- regular PyPI packages (no support for version pinning at this time)
- packages from GitHub repos using
<username>/<reponame>
(only GitHub at this time; repo must contain must contain buildablepyproject.toml
in its root)
Note
As of Dec 2024, many packages still do not support python 3.13; thus, the default version in puppy is 3.12.
The URLs above return installation scripts. You can mix and match query parameters, unlocking single-command recipes for complex builds:
curl -fsSL "https://pup-py-fetch.hf.space?pixi=marimo&env1=duckdb,pandas&env2=cowsay" | bash
iex (iwr "https://pup-py-fetch.hf.space?python=3.11&pixi=marimo&tables=duckdb,pandas,polars").Content
Or just grab the base build and use pup commands:
pup-clone-1212.mp4
Puppy is a transparent wrapper around pixi and uv, two widely used Rust-based tools that belong together.
Puppy can be used as a CLI in a Linux or Windows shell, or as a module in any python shell/script/notebook.
Installing puppy preps the folder to house python, in complete isolation from system or any other python on your system:
- π this folder is home to one and only one python executable, managed by pixi
- β¨ puppy installs pixi; pixi installs core components: python, uv, click
- β Bash or Powershell runner/installer is placed into
~/.pixi/bin
(the only folder that goes on PATH) - πΆ
pup.py
is the python/click CLI that wraps pixi and uv commands - π£
pup new
andpup add
use uv to handle projects, packages and virtual environments - π
pup clone
andpup sync
help build environments from externalpyproject.toml
project files
Pup can help you construct and activate python projects interactively, such as from (i)python shells, jupyter notebooks, or marimo notebooks.
a@a-Aon-L1:~/Desktop/puppy$ .pixi/envs/default/bin/python
Python 3.12.7
>>> import pup; pup.fetch()
[2024-10-26 16:50:37] πΆ said: woof! run `pup.fetch()` to get started
[2024-10-26 16:50:37] πΆ virtual envs available: ['tbsky', 't1/web', 't2', 'tmpl', 'test-envs/e1']
Choose venv to fetch: t1/web
[2024-10-26 16:51:56] πΆ heard: pup list t1/web
{
"t1/web": [
"httpx>=0.27.2",
"requests>=2.32.3"
]
}
[2024-10-26 16:51:56] fetched packages from 't1/web': /home/a/Desktop/puppy/t1/web/.venv/lib/python3.12/site-packages added to `sys.path`
Now the "kernel" t1/web
is activated. In other words, packages installed t1/web/.venv
are available on sys.path
.
Need to install more packages on the go, or create a new venv? Just provide the destination, and list of packages.
pup.fetch("t1/web", "awswrangler", "cloudpathlib")
pup.fetch("data", "duckdb", "polars", root=True)
Here is the signature of pup.fetch()
:
def fetch(
venv: str | None = None,
*packages: Optional[str],
site_packages: bool = True,
root: bool = False,
) -> None:
"""Create, modify, or fetch (activate) existing venvs.
Activating an environment means placing its site-packages folder on `sys.path`,
allowing to import the modules that are installed in that venv.
`venv`: folder containing `pyproject.toml` and installed packages in `.venv`
if venv does not exist, puppy will create it, install *packages,
and fetch newly created venv
`*packages`: names of packages to `pup add`
`site_packages`: if True, appends venv's site-packages to `sys.path`
`root`: if True, appends venv's root folder to `sys.path`
(useful for packages under development)
"""
With root=True
, you also add new project's root folder to your environment, making its modules available for import.
This is useful for working with projects that themselves aren't yet packaged and built.
You also have the option to omit the site-packages folder with site_packages=False
.
pixi run python
Python 3.12.7 | packaged by conda-forge | (main, Oct 4 2024, 16:05:46) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pup; pup.fetch("test-only-root", root=True, site_packages=False)
[2024-11-22 13:10:49] πΆ said: woof! run `pup.fetch()` to get started
[2024-11-22 13:10:49] πΆ virtual envs available: ['gr']
[2024-11-22 13:10:49] πΆ heard: pup new test-only-root
[2024-11-22 13:10:49] πΆ said: pixi run uv init /home/a/puppy/test-only-root -p /home/a/puppy/.pixi/envs/default/bin/python --no-workspace
Initialized project `test-only-root` at `/home/a/puppy/test-only-root`
[2024-11-22 13:10:49] πΆ said: pixi run uv venv /home/a/puppy/test-only-root/.venv -p /home/a/puppy/.pixi/envs/default/bin/python
Using CPython 3.12.7 interpreter at: .pixi/envs/default/bin/python
Creating virtual environment at: test-only-root/.venv
Activate with: source test-only-root/.venv/bin/activate
Specify what to install:
[2024-11-22 13:10:50] πΆ virtual envs available: ['gr', 'test-only-root']
[2024-11-22 13:10:50] fetched packages from 'test-only-root': /home/a/puppy/test-only-root added to `sys.path`
[2024-11-22 13:10:50] πΆ heard: pup list test-only-root
{
"test-only-root": []
}
>>> import hello; hello.main() # `hello.py` is included in uv's project template
Hello from test-only-root!
Note
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.
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 was addressing that problem, but in v2 (current version) this is taken care of by pup.fetch
. Here's the gist:
- install ONE instance of jupyter with
pixi add jupyter
per major version of python - run it with
pixi run jupyter lab
orpixi run jupyter notebook
- use
pup.fetch
to build and activate your environment - THAT'S IT!
For details, scan through the previous section. 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).
With marimo, you have more options: Unified environment management for any computational notebooks - no more Jupyter kernels!
UV is rightfully getting much love in the community, but Pixi is indispensable for:
- Conda channels support
- Setting up really complex build environments for multi-language projects. For example, try pulling together what's done here in one API call (python, NodeJS, pnpm, cloned and synced repo):
\
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.
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.
Note
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.
# βββ puphome/ # python 3.12 lives here
# β βββ public-project/
# β β βββ .git # this folder may be a git repo (see pup clone)
# β β βββ .venv
# β β βββ pyproject.toml
# β βββ env2/
# β β βββ .venv/ # this one is in pre-git development
# β β βββ pyproject.toml
# β βββ pixi.toml
# β βββ pup.py
# βββ pup311torch/ # python 3.11 here
# β βββ env3/
# β βββ env4/
# β βββ pixi.toml
# β βββ pup.py
# βββ pup313beta/ # 3.13 here
# βββ env5/
# βββ pixi.toml
# βββ pup.py
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 (command to generate Dockerfile
coming soon!).
Tip
Use pup list -f
to list all dependencies spelled out in uv.lock
.
Python packages, virtual environments, notebooks, and how they all play together remains a confusing and controversial topic in the python world.
The problems began when the best idea from the Zen of python was ignored by pip:
~$ python -c 'import this'
The Zen of Python, by Tim Peters
...
Explicit is better than implicit.
...
~$ pip install numpy
Collecting numpy
Downloading numpy-2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)
Downloading numpy-2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.3 MB)
ββββββββββββββββββββββββββββββββββββββββ 16.3/16.3 MB 62.5 MB/s eta 0:00:00
Installing collected packages: numpy
Successfully installed numpy-2.1.2
The command worked, yay! Antigravity! But which pip did the work and where did the packages go?
Most tools that came later followed the same pattern.
Puppy makes implicitly sensible choices while being explicitly transparent. Compare:
PS C:\Users\a\Desktop\code\puppy> pup add try-ml numpy
[2024-10-13 00:02:19] πΆ heard: pup new try-ml
[2024-10-13 00:02:19] πΆ said: pixi run uv init C:\Users\a\Desktop\code\puppy\try-ml -p C:\Users\a\Desktop\code\puppy\.pixi\envs\default\python.exe --no-workspace
Initialized project `try-ml` at `C:\Users\a\Desktop\code\puppy\try-ml`
[2024-10-13 00:02:20] πΆ said: pixi run uv venv C:\Users\a\Desktop\code\puppy\try-ml/.venv -p C:\Users\a\Desktop\code\puppy\.pixi\envs\default\python.exe
Using CPython 3.12.7 interpreter at: .pixi\envs\default\python.exe
Creating virtual environment at: try-ml/.venv
Activate with: try-ml\.venv\Scripts\activate
[2024-10-13 00:02:21] πΆ heard: pup add try-ml numpy
[2024-10-13 00:02:21] πΆ said: pixi run uv add numpy --project C:\Users\a\Desktop\code\puppy\try-ml
Resolved 2 packages in 87ms
Installed 1 package in 344ms
+ numpy==2.1.2
Then came Jupyter notebooks, a wonderful tool that unlocked the floodgates of interest to python. But the whole import
thing remained a confusing mess.
(to be continued)
pup swim
(build Dockerfiles)- you tell me?
See examples.
Thanks for checking out this repo. Hope you try it out and like it! Feedback, discussion, and βs are welcome!
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ~===========@ >>> .-. β
| >>> (___________________________()6 `-, |
β %%%%%%%%%%%%%%% >>> ( ______________________ /''"` β
β %site_packages% >>> //\\ //\\ |
β %%%%%%%%%%%%%%% |
β !!!!!!!!!!!!!!!!!!!!! +++++ β
β ******* !ModuleNotFoundError! β
β *.venv* """ !!!!!!!!!!!!!!!!!!!!! ~~~~~~~~~~~~~~ β
β ******* ../.. ~ (base) :~$ ~ β
β """ [================] ~~~~~~~~~~~~~~ β
β @ + [ pyproject.toml ] β
β @ $$$$$$$$$$$$$$$$$ + [================] β
β @ $ Collecting $ +++ + + β
β @ $ Downloading $ + + + β
β $$$$$$$$$$$$$$$$$ +++ ######################### + + β
β + + # >>> from bla import * # + + β
β @ &&&&&&&&&&&&&&& + +++ ######################### + + β
β @ & dist & + + + + β
β @ & ββββ.tar.gz & + +++ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + β
β @ & ββββ.whl & + !ERROR: ResolutionImpossible:! + + β
β @ &&&&&&&&&&&&&&& +++++ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Eat fruits and vegetables. Don't run into walls. Don't eat your own tail.
ASCII dog by Joan Stark, the rest by author