mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-17 08:21:12 -05:00
feat: streamline Python package management and code quality with uv and pre-commit #6298
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @khamaileon on GitHub (Sep 2, 2025).
Check Existing Issues
Problem Description
Currently, Open-webui manages Python dependencies in two separate files: pyproject.toml and requirements.txt. This duplication often leads to formatting issues and conflicts, especially during rebases or merges. Maintaining consistency between these files is error-prone and can slow down development.
Desired Solution you'd like
I propose switching to uv as the primary Python dependency management tool. uv can generate and synchronize lockfiles, ensuring that dependencies are always up-to-date and consistent. Additionally, I recommend installing pre-commit to automate code quality checks and dependency file management.
Here is an example of a .pre-commit-config.yaml file:
What pre-commit does:
Automatically checks YAML and TOML files for syntax errors.
Fixes end-of-file and trailing whitespace issues.
Ensures the dependency lockfile is always up-to-date.
Exports the lockfile to backend/requirements.txt automatically.
Runs code formatting tools to maintain code style consistency.
I can submit a PR to implement this setup and update the documentation to reflect these changes.
Alternatives Considered
No response
Additional Context
No response
@rgaricano commented on GitHub (Sep 2, 2025):
personally I prefer don't use uv and even less for development: https://github.com/pypa/packaging.python.org/issues/685#issuecomment-1321616748
@khamaileon commented on GitHub (Sep 2, 2025):
@rgaricano
I see your point about uv and I’m open to alternatives. From your perspective, what would be the best way to avoid having to maintain both pyproject.toml and requirements.txt? That duplication is the main issue I was hoping to address.
I’m also curious about your thoughts on adding pre-commit hooks (for YAML/TOML checks, small formatting fixes, and ruff). Even without uv, this could help us keep things consistent and reduce small errors in day-to-day development.
@Tsafaras commented on GitHub (Oct 15, 2025):
I'm not sure what the state of
uvwas when that was posted (3 years ago), but it holds no merit today.If you work on a Python app that relies on
uvfor managing its dependencies, the best practice is to only have apyproject.tomlfile.@Tsafaras commented on GitHub (Oct 15, 2025):
I'm not sure why that was discarded.
Even though the project does use GitHub Actions for such checks, git hooks have not been set up; whether that's through
pre-commit,lefthook,husky, etc.It leads to people committing changes that fail those checks. Git hooks would prevent that.
@rgaricano commented on GitHub (Oct 16, 2025):
Syncro script
e.g.
@Tsafaras commented on GitHub (Oct 16, 2025):
@rgaricano regarding your "syncro script", did you see https://github.com/open-webui/open-webui/issues/17145#issuecomment-3408404924?