-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
Self Checks
- I have searched for existing issues search for existing issues, including closed ones.
- I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- Please do not modify this template :) and fill in all the required fields.
1. Is this request related to a challenge you're experiencing? Tell me about your story.
Proposal: Package manager migration from poetry to uv
Background
Dify’s situation
Dify has started to swiching package manager from pip to poetry in #4513 since Jun 2024.
poetry brought many importance benefits to Dify comparing to pip at the time, as lockfile support, dependency grouping, package caching, isntallation performance etc.
And with Plugin System introduced and sepeating plugin daemon from the main repo, Dify is using different Python package managers.
- Poetry: For Python depdencies of api and worker services in Dify main repo (https://github.com/langgenius/dify)
- uv: For installing Python depdencies of plugins , ( https://github.com/langgenius/dify-plugin-daemon )
However, poetry manager has exposed more shortage and problems, which limits agile delivery, community contribution and daily use.
- Poor performance in updating or syncing the lockfile, which cost ~15 sec with usual operations
- lockfile confilicts from time to time with the version hashes
- unable to set Pip mirror URL at runtime, once the lockfile is set
- lack of support for easier
pipusage support for new comers
Other projects
Many morden popular LLM / API projects have switiching to use uv as package manager, from services, SDKs to Multi-Agent frameworks.
- OpenAI's Agents SDK : https://github.com/openai/openai-agents-python
- Microsoft's Autogen : https://github.com/microsoft/autogen/tree/main/python
- Google's A2A: https://github.com/google/A2A
Objectives
uv is an extremely fast Python package and project manager, written in Rust.
Bringing uv into Dify's main repo, for the following purposes:
- speed up the runtime performance in package installation and lockfile syncing
- prevent single file hash lock in the lockfile, for easier collaboration and community contribution
- bing in
uv pipcommands for easier pip operations
Migration Steps
- migrate
poetrytouvas package manager tool, updating[build-system]inpyprojects.toml - migrate
poetry's dynamic dependencies declaration in[tool.poetry.dependencies]into python standard[dependency-groups]section inpyprojects.toml - construct CI tests and checking the validation and availability of the generated uv lockfile
- update all the workflows' actions usage related to poetry
- replace
poetrytouvDockerfile inapifolder for both api and worker services
PR
2. Additional context or comments
No response
3. Can you help us with this feature?
- I am interested in contributing to this feature.