-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
uv packaging #3184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
uv packaging #3184
Conversation
81c9b12 to
e824a5b
Compare
There was a problem hiding this 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.pytopyproject.tomlwith 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
uvandpip
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.
f906c5d to
a1e370b
Compare
- Edit pyproject.toml - Keep setup.py for backward compatibility
5763d4b to
eb04efa
Compare
|
Rebased this PR to leave a cleaner history after merging. |
| 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] | ||
| ``` |
There was a problem hiding this comment.
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
| 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 |
There was a problem hiding this comment.
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)..
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
|
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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