Skip to content

Commit d8e98e6

Browse files
authored
Merge pull request #210 from KumarLabJax/switch-from-poetry-to-uv
Adding uv.lock, updating readme, and adding future build system change
2 parents db875df + 0917987 commit d8e98e6

File tree

5 files changed

+1751
-33
lines changed

5 files changed

+1751
-33
lines changed

README.md

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ packages. These packages are available from the Python Package Index (PyPI).
3333

3434
Currently, JABS supports Python 3.10 through 3.13.
3535

36-
## Python Env Setup
36+
## Python Environment Setup
3737

3838
We recommend creating a Python Virtualenv for JABS:
3939

@@ -105,27 +105,46 @@ startup times should be significantly reduced.**
105105
The following instructions are for Linux or macOS Developers. Commands for JABS developers using Windows might be
106106
slightly different.
107107

108-
This project uses Poetry for packaging and dependency management. JABS developers will need to install Poetry by
109-
following the instructions on [Poetry's official website](https://python-poetry.org/docs/#installation).
108+
This project now uses **uv** for dependency management and building. Poetry is no longer required.
110109

111-
You can use Poetry to manage your virtualenv, or manage your virtualenv externally to Poetry and use Poetry only for
112-
installing dependencies. The following instructions assume that you've already created and activated a Python
113-
environment for JABS using whichever method you prefer.
110+
JABS developers will need to install uv by following the instructions on
111+
[uv's official website](https://docs.astral.sh/uv/getting-started/installation/).
114112

115-
Clone the JABS git repository, and with your JABS virtualenv activated, run the following command in the project root:
113+
1) **Clone** the repository and enter the project directory.
116114

117-
```commandline
118-
poetry install
115+
2) **Create/activate** a virtual environment (uv recommended):
116+
117+
Note, if you don't want to activate the virtualenv, you can use `uv run <command>` to run commands in the virtualenv.
118+
If you don't want to activate the virtualenv, you can skip this step.
119+
120+
```bash
121+
uv venv
122+
source .venv/bin/activate # Linux/macOS
123+
# .venv\Scripts\Activate.ps1 # Windows PowerShell
124+
```
125+
126+
3) **Install dependencies** in editable mode:
127+
128+
```bash
129+
uv sync
119130
```
120131

121132
This will install all dependencies and JABS will be installed in "editable" mode, meaning that the JABS Python modules
122133
installed in the virtualenv will be links to the files in the cloned git repository. JABS code changes will be
123134
reflected immediately in the Python environment.
124135

125136
Note to Developers: JABS uses package metadata to determine the version number. If you change the version number in the
126-
pyproject.toml file, you will need to run `poetry install` to update the version number in the installed package so
137+
pyproject.toml file, you will need to run `uv sync` to update the version number in the installed package so
127138
that the GUI will display the correct version.
128139

140+
141+
#### Adding Dependencies
142+
```
143+
uv add <package> # runtime dependency
144+
uv add --dev <package> # dev-only dependency
145+
```
146+
147+
129148
#### Code Style
130149

131150
JABS uses [ruff](https://docs.astral.sh/ruff/) for linting and formatting. Developers should run `ruff check` and `ruff format` before
@@ -146,10 +165,18 @@ ruff format src/packagepath/modulename.py
146165

147166
#### Building Python Packages
148167

149-
Developers can build a Python package using the `poetry build` command. This will produce both a .tar.gz and a Python
150-
Wheel file (.whl) in the dist directory. The wheel file can be installed with pip:
168+
Build wheels and source distributions with uv:
169+
170+
```bash
171+
uv build
172+
```
173+
174+
This will produce both a .tar.gz and a Python Wheel file (.whl) in the dist directory.
151175

152-
```pip install jabs_behavior_classifier-<version>-py3-none-any.whl```
176+
The wheel file can be installed with pip:
177+
```
178+
pip install jabs_behavior_classifier-<version>-py3-none-any.whl
179+
```
153180

154181
Since the Wheel does not contain any compiled code it is platform independent.
155182

pyproject.toml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,16 @@ dependencies = [
3434

3535
[dependency-groups]
3636
dev = [
37-
"matplotlib>=3.9.3,<4.0.0",
37+
{include-group = "lint"},
38+
{include-group = "test"},
39+
"pre-commit>=4.2.0,<5.0.0",
40+
]
41+
test = [
3842
"pytest>=8.3.4,<9.0.0",
43+
"matplotlib>=3.9.3,<4.0.0",
44+
]
45+
lint = [
3946
"ruff>=0.11.5,<0.12.0",
40-
"pre-commit>=4.2.0,<5.0.0",
4147
]
4248

4349
[project.urls]
@@ -60,5 +66,8 @@ packages = [
6066
]
6167

6268
[build-system]
63-
requires = ["poetry-core"]
64-
build-backend = "poetry.core.masonry.api"
69+
requires = ["uv_build>=0.7.19,<0.8.0"]
70+
build-backend = "uv_build"
71+
72+
[tool.uv.build-backend]
73+
module-name = "jabs"

0 commit comments

Comments
 (0)