8000 uv packaging by deruyter92 · Pull Request #3184 · DeepLabCut/DeepLabCut · GitHub 8000
[go: up one dir, main page]

Skip to content

Conversation

@deruyter92
Copy link
Collaborator

Replacement PR for #3134 by @arashsm79
(cannot push changes to the original branch)

Summary
This PR performs an overhaul on how DLC is packaged.
uv is an extremely fast Python package and project manager that has seen incredible adoption from the Python community.
Here, the first steps are taken to package DLC with uv for different platforms and Python version.

The CI has also been updated accordingly to use uv.
The CI will be updated accordingly in a separate PR

How to use this PR
Checkout this PR on a local copy of DLC.
Install uv
If you are not familiar with uv, you can take a look at their Getting Started page.
Run uv sync with the extra dependencies you may want (you can take a look at the ci.yml file in this PR for example usage of uv.
Like: uv sync --extra gui --python 3.11
uv run deeplabcut

@deruyter92 deruyter92 mentioned this pull request Jan 16, 2026
@deruyter92 deruyter92 force-pushed the arash_and_jaap/uv_packaging branch 2 times, most recently from 81c9b12 to e824a5b Compare January 16, 2026 13:59
@deruyter92 deruyter92 requested a review from Copilot January 16, 2026 16:01
Copy link
Contributor
Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates DeepLabCut's packaging system from the traditional setup.py to a modern pyproject.toml-based configuration using uv as the package manager. The migration streamlines dependency management and follows current Python packaging best practices.

Changes:

  • Migrated package configuration from setup.py to pyproject.toml with support for multiple Python versions and platforms
  • Removed obsolete development tools and scripts that are no longer needed with the new packaging approach
  • Updated documentation to reflect the new installation methods using both uv and pip

Reviewed changes

Copilot reviewed 10 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pyproject.toml Complete package configuration with dependencies, optional extras, and platform-specific requirements
setup.py Simplified to a compatibility shim that delegates to pyproject.toml
README.md Updated installation instructions for both PyPI and source installations
.pre-commit-config.yaml Replaced black with ruff for code formatting
.github/workflows/python-package.yml Updated CI to install package directly instead of using requirements.txt
tools/update_license_headers.py Removed obsolete developer tool
tools/README.md Removed documentation for obsolete developer tools
testscript_cli.py Removed obsolete test script
reinstall.sh Removed obsolete installation script
dlc.py Removed obsolete CLI entry point file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@deruyter92 deruyter92 marked this pull request as ready for review January 21, 2026 17:05
@deruyter92 deruyter92 requested a review from C-Achard January 21, 2026 17:05
@deruyter92 deruyter92 added enhancement New feature or request dependencies Pull requests that update a dependency file labels Jan 21, 2026
@deruyter92 deruyter92 marked this pull request as draft January 22, 2026 06:45
@deruyter92 deruyter92 marked this pull request as ready for review January 22, 2026 08:59
@deruyter92 deruyter92 force-pushed the arash_and_jaap/uv_packaging branch from f906c5d to a1e370b Compare January 22, 2026 09:06
arashsm79 and others added 2 commits January 22, 2026 12:02
- Edit pyproject.toml
- Keep setup.py for backward compatibility
@deruyter92 deruyter92 force-pushed the arash_and_jaap/uv_packaging branch from 5763d4b to eb04efa Compare January 22, 2026 11:09
@deruyter92
Copy link
Collaborator Author

Rebased this PR to leave a cleaner history after merging.

Comment on lines +68 to 71
Install the latest pre-release with GUI directly from PyPI, this automatically installs all required dependencies, including PyTorch (recommended for most users).
```
- [2] Then, [install `pytables`](https://www.pytables.org/usersguide/installation.html):
```bash
conda install -c conda-forge pytables==3.8.0
pip install --pre deeplabcut[gui]
```
Copy link
Collaborator
@C-Achard C-Achard Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it would be worth it to show how to use uv venv to install ?
e.g. see below

Suggested change
Install the latest pre-release with GUI directly from PyPI, this automatically installs all required dependencies, including PyTorch (recommended for most users).
```
- [2] Then, [install `pytables`](https://www.pytables.org/usersguide/installation.html):
```bash
conda install -c conda-forge pytables==3.8.0
pip install --pre deeplabcut[gui]
```
OR (with uv only, conda not required)
uv venv deeplabcut_env --python 3.12 # creates a venv in the deeplabcut_env folder
source deeplabcut_env/bin/activate # activate the venv, do this every time you want to run DLC
uv pip install deeplabcut[gui] # install DLC (once)
uv run deeplabcut # run DLC after activating venv

Copy link
Collaborator Author
@deruyter92 deruyter92 Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good one, I wasn't sure. Might be a bit too many new commands for some of the users that are used to conda (especially the venv activation, which is also different on windows). I would like to refrain from having to provide a full user guide to uv since there are a lot of them online. However, I agree with you that it's a shame to not use its advantages (even when you are installing directly from PyPI)..

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, it does complicate things. Perhaps we can relay the question


[project.optional-dependencies]
gui = [
# Avoid 6.10.0 only on Linux x86_64 (fails for older glib versions)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still the case ? Should we check ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah good point. Well on my own linux server this seems to be an issue. But I don't know if we are missing out on relevant things by restricting the version. Would be nice to restrict it only when necessary, but the problem is that pyproject.toml has no flags to check glib. An alternative is that we don't restrict pyside6 by default and instruct users of old linux versions with low glib versions to downgrade pyside6 when necessary.

Copy link
Collaborator Author
@deruyter92 deruyter92 Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be in favor of restricting the pyside6 version for now to avoid issues from users with old glib versions

@C-Achard
Copy link
Collaborator

Tested on Win11, py 3.12, works well. Checking on Linux now

or `pip install --pre "deeplabcut"` (headless
version with PyTorch)!
# For installation with the GUI
uv sync --extra gui --python 3.12

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If standardizing on python 3.12, you should be able to use "uv python pin" to pin the python version to whatever you'd like people to install when building from source.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, thanks. Well its included here as an example, but people can choose the version they prefer themselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

0