@@ -6,9 +6,31 @@ with the GUI.
66
77## Install the stable release
88
9- ### Linux and macOS
9+ ### Recommended: uv
1010
11- Create and activate a virtual environment, then install phy from PyPI:
11+ Install [ ` uv ` ] ( https://docs.astral.sh/uv/getting-started/installation/ ) if it is
12+ not already available, then install phy as an isolated command-line tool:
13+
14+ ``` bash
15+ uv tool install --python 3.12 phy
16+ ```
17+
18+ This command is the same on Linux, macOS, and Windows PowerShell. ` uv ` installs
19+ Python 3.12 if necessary, creates an environment dedicated to phy, and makes the
20+ ` phy ` command available without manually activating that environment.
21+
22+ To upgrade the stable installation later:
23+
24+ ``` bash
25+ uv tool upgrade phy
26+ ```
27+
28+ ### Alternative: venv and pip
29+
30+ If you prefer Python's standard environment tools, create and activate a virtual
31+ environment before installing phy.
32+
33+ On Linux and macOS:
1234
1335``` bash
1436python3 -m venv phy-env
@@ -17,30 +39,25 @@ python -m pip install --upgrade pip
1739python -m pip install phy
1840```
1941
20- If ` python3 ` is not available but ` python ` is Python 3.10 or newer, use ` python `
21- in the first command.
22-
23- ### Windows PowerShell
42+ On Windows PowerShell:
2443
2544``` powershell
26- py -3.10 -m venv phy-env
45+ py -3.12 -m venv phy-env
2746.\phy-env\Scripts\Activate.ps1
2847python -m pip install --upgrade pip
2948python -m pip install phy
3049```
3150
32- You may choose another installed Python version from 3.10 onward. For example,
33- use ` py -3.12 ` for Python 3.12. If PowerShell prevents activation, either adjust
34- its execution policy for your user or run the environment's Python directly:
51+ If PowerShell prevents activation, either adjust its execution policy for your
52+ user or run ` .\phy-env\Scripts\python.exe -m pip install phy ` followed by
53+ ` .\phy-env\Scripts\phy.exe --version ` .
3554
36- ``` powershell
37- .\phy-env\Scripts\python.exe -m pip install phy
38- .\phy-env\Scripts\phy.exe --version
39- ```
55+ To upgrade this pip installation later, activate its environment and run
56+ ` python -m pip install --upgrade phy ` .
4057
4158### Check the installation
4259
43- With the environment active :
60+ After either installation method :
4461
4562``` bash
4663phy --version
@@ -50,12 +67,6 @@ phy --help
5067The first command prints the installed phy version. The second should list
5168commands including ` template-gui ` and ` template-describe ` .
5269
53- To upgrade the stable installation later:
54-
55- ``` bash
56- python -m pip install --upgrade phy
57- ```
58-
5970## Install the latest phy and phylib source
6071
6172Use this installation when testing an unreleased fix or developing phy. It
@@ -74,81 +85,65 @@ can live side by side.
7485mkdir phy-source
7586cd phy-source
7687
77- python3 -m venv .venv
78- source .venv/bin/activate
79- python -m pip install --upgrade pip
80-
8188git clone https://github.com/cortex-lab/phylib.git
8289git clone https://github.com/cortex-lab/phy.git
8390
84- python -m pip install --editable ./phylib
85- python -m pip install --editable ./phy
91+ cd phy
92+ uv sync --dev
93+ uv pip install --editable ../phylib
8694```
8795
88- To run the phy test suite or build its documentation, install phy's development
89- dependencies instead in the final command:
90-
91- ``` bash
92- python -m pip install --editable " ./phy[dev]"
93- ```
96+ ` uv sync ` creates ` phy/.venv ` , installs phy editably, and installs the locked
97+ development dependencies. The final command replaces the released phylib
98+ package with the sibling source checkout.
9499
95100### Windows PowerShell
96101
97102``` powershell
98103New-Item -ItemType Directory phy-source
99104Set-Location phy-source
100105
101- py -3.10 -m venv .venv
102- .\.venv\Scripts\Activate.ps1
103- python -m pip install --upgrade pip
104-
105106git clone https://github.com/cortex-lab/phylib.git
106107git clone https://github.com/cortex-lab/phy.git
107108
108- python -m pip install --editable .\phylib
109- python -m pip install --editable .\phy
109+ Set-Location phy
110+ uv sync --dev
111+ uv pip install --editable ..\phylib
110112```
111113
112- For the phy test and documentation dependencies, replace the final command with:
113-
114- ``` powershell
115- python -m pip install --editable ".\phy[dev]"
116- ```
114+ These commands create the same editable development environment as the Linux and
115+ macOS instructions.
117116
118117### Verify which source is running
119118
120119Run the following commands from either operating system:
121120
122121``` bash
123- phy --version
124- python -m pip show phy phylib
125- git -C phy log -1 --oneline
126- git -C phylib log -1 --oneline
122+ uv run phy --version
123+ uv pip show phy phylib
124+ git log -1 --oneline
125+ git -C ../ phylib log -1 --oneline
127126```
128127
129- For both packages, ` pip show ` should include an ** Editable project location**
128+ For both packages, ` uv pip show` should include an ** Editable project location**
130129pointing to the checkout you just cloned. The Git commands identify the exact
131130commits being used. Development builds of phy may also show a development
132131version or Git suffix in ` phy --version ` .
133132
134133### Update both checkouts
135134
136- Save or commit your own source changes before updating. From the ` phy-source `
137- directory, with the virtual environment active:
135+ Save or commit your own source changes before updating. From the ` phy ` checkout:
138136
139137``` bash
140- git -C phylib pull --ff-only
141- git -C phy pull --ff-only
142- python -m pip install --upgrade --editable ./phylib
143- python -m pip install --upgrade -- editable ./phy
138+ git -C ../ phylib pull --ff-only
139+ git pull --ff-only
140+ uv sync --dev
141+ uv pip install --editable ../phylib
144142```
145143
146- In Windows PowerShell, the same commands work; ` ./phylib ` and ` ./phy ` may also be
147- written as ` .\phylib ` and ` .\phy ` .
148-
149- Re-running the editable installation is worthwhile after an update because
150- dependencies and package metadata can change even though ordinary Python source
151- edits are already visible.
144+ In Windows PowerShell, ` ../phylib ` may also be written as ` ..\phylib ` .
145+ Re-running the sync picks up lockfile and package metadata changes, while the
146+ last command ensures the sibling phylib checkout remains installed.
152147
153148## Start phy
154149
@@ -166,10 +161,15 @@ phy template-gui /path/to/output/params.py
166161## Legacy Kwik support
167162
168163The Template GUI is the recommended workflow for current template-based sorters.
169- The legacy Kwik GUI needs additional packages:
164+ The legacy Kwik GUI needs additional packages. Install them in a separate
165+ uv-managed environment because ` klustakwik2 ` needs NumPy, setuptools, and Cython
166+ available while it builds:
170167
171168``` bash
172- python -m pip install klusta klustakwik2
169+ uv venv --python 3.12 phy-kwik-env
170+ uv pip install --python phy-kwik-env phy klusta cython
171+ uv pip install --python phy-kwik-env --no-build-isolation klustakwik2
173172```
174173
175- It can then be opened with ` phy kwik-gui path/to/file.kwik ` .
174+ Activate the environment using the command printed by ` uv venv ` . It can then be
175+ opened with ` phy kwik-gui path/to/file.kwik ` .
0 commit comments