Install through pyproject.toml (PEP 518/621)#3184
Conversation
9bb8d35 to
2929daa
Compare
81c9b12 to
e824a5b
Compare
restore CI as in main
…eepLabCut into arash_and_jaap/uv_packaging
There was a problem hiding this comment.
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
Re-introduce a missing 'fmpose3d' extras section in pyproject.toml
|
Note : re-added missing fmpose3D dependency |
Add temporary formatting configuration to pyproject.toml to standardize code style during linting changes. Includes a brief yapf config (based_on_style = "google", indent_width = 4) and isort settings (multi_line_output=3, include_trailing_comma=true, line_length=88, skip __init__.py, etc.). These settings are marked TODO and should be removed once the project linting is finalized.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
pyproject.toml:79
- This line has trailing whitespace (a tab after the closing bracket), which will be flagged by the
trailing-whitespacepre-commit hook added/kept in this repo. Please remove the trailing tab to avoid pre-commit/CI failures.
fmpose3d = ["fmpose3d"]
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Functional tests started failing in CI without any repository-side dependency changes. The failure occurs during `deeplabcut.export_model()` when TensorFlow writes the graph, raising: TypeError: MessageToString() got an unexpected keyword argument 'float_format' This is consistent with transitive dependency drift in the runner image / resolver (e.g. ubuntu-latest / Python minor version changes) causing an incompatible protobuf runtime to be installed alongside TensorFlow, even though DeepLabCut itself is pinned to a commit.
|
Important : trying to run CI with pinned protobuf for functional tests, as functional tests started failing in CI without any repository-side dependency changes. The failure occurs during This is likely due to dependency drift in the runner image / resolver (e.g. -latest / Python minor version changes) causing an incompatible protobuf runtime to be installed alongside TensorFlow, even though DeepLabCut itself is pinned to a commit. Note; trying with protobuf<7 seems to be successful so far. I tried to advertise the file clearly and only use it where necessary to minimize potential side-effects, but I would not call this future-proof either. |
This reverts commit 0002ced.
Add .github/versioning/tf-ci-constraints.txt to pin TensorFlow-related dependencies for CI. Update .github/workflows/python-package.yml to apply the constraints file for pip installs and install the package in editable mode (-e .) with the constraints before running example tests, replacing the previous git+https install. This ensures consistent TensorFlow/dependency versions and reproducible CI installs.
|
Maybe squashing this when merging would be cleaner. |
|
I'm helping out 3 (so far) other researchers who are having difficulties installing DLC after getting my own copy installed last week on my Windows 11 machine. Where do they install pytorch? Before or after any of these uv steps? uv sync --extra gui --python 3.11 Also, is this the way to install through a pyproject.toml or am I missing something? Do you know when the official installation instructions will be updated? |
|
Hello @amadorkane, Sorry for the continued trouble, the best would be to install pytorch between those two steps you listed; make sure to check their docs for GPU/CUDA support. However you will need to clone the repo and install from the main branch to benefit from the pyproject.toml based install, and likely update napari to 0.6.6 manually (or install from the napari-DLC repo main branch by cloning). I understand this is complicated, and I apologize for the situation, but we are doing our best to fix this as soon as possible while ensuring we do not worsen the situation either. We are almost finished merging + releasing fixes across repositories, but currently the installation is problematic due to pinned versions in the napari-DLC dependencies. A release is staged but it will take a little longer for us to align everything; sorry again. Once we have this and ideally #3225 merged, we can finally make an easier-to-install rc release and update the docs. Best, |
|
Thank you very much Cyril! When I saw how many pages of dependencies there were after installation, I got the complexity of the problems you are up against! I am not sure how to do this: "clone the repo and install from the main branch". In #3219, I was advised to try: But that led to an error when doing the last step. The method that finally worked did not involved cloning the forked repo so I'm unclear how to do this part correctly still. Also, is the following correct for the additional napari steps? Also, uv sync --extra gui --python 3.11 uv pip3 install -v "napari==0.6.6" <-- correct? uv run deeplabcut |
|
Hello @amadorkane, Apologies for the delay, we are now nearly done with the release. In the meantime, my colleague @arashsm79 kindly suggested the following, which I edited a bit to work on Windows (in PowerShell) : mkdir dlc_project
cd dlc_project
uv venv -p 3.12 .dlc_venv
& .\.dlc_venv\Scripts\activate.ps1
uv pip install torch torchvision --torch-backend=cu<CUDA_VER>
uv pip install "deeplabcut[gui] @ git+https://github.com/deeplabcut/deeplabcut.git"
uv run -m deeplabcutNo cloning, should work out of the box, hopefully. For the CUDA_VER, check the Please let me know if this worked, Best, |

Replacement PR for #3134 by @arashsm79
(cannot push changes to the original branch)
Summary
This PR modernizes how DLC specifies its dependencies and metadata, following latest standards for python packaging and allowing for modern build tools to be used for installation.
Introduces a pyproject.toml‑based configuration as the single source of truth for project metadata and dependencies, in line with current Python packaging standards (PEP 518 / PEP 621).
This does not change the package manager, nor does it require adopting any specific tool, though it is compatible with more modern installation methods. (pip, mamba, uv, conda, pdm...)
For example, 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 allow DLC to be installed with modern package managers, such as 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
Example UV install
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 for a quick install.
(Solves issues #3111 and similar)