Skip to content

Chore/migrate poetry to uv#7755

Open
zachliu wants to merge 5 commits into
getredash:masterfrom
zachliu:chore/migrate-poetry-to-uv
Open

Chore/migrate poetry to uv#7755
zachliu wants to merge 5 commits into
getredash:masterfrom
zachliu:chore/migrate-poetry-to-uv

Conversation

@zachliu

@zachliu zachliu commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • Refactor
  • Feature
  • Bug Fix
  • New Query Runner (Data Source)
  • New Alert Destination
  • Other

Description

Migrate Python dependency management from poetry to uv.

This is a pure tooling swap with zero dependency changes. Every resolved package version in uv.lock matches the previous poetry.lock exactly (all 237 packages), so no application behavior changes and there is no new testing surface from version bumps.

Changes:

  • pyproject.toml: convert [tool.poetry.dependencies] to PEP 621 [project.dependencies], and the all_ds/ldap3/dev groups to PEP 735 [dependency-groups]. Drop the Poetry [build-system] and mark the project non-packaged via [tool.uv] package = false (equivalent to Poetry's --no-root).
  • Replace poetry.lock with uv.lock.
  • Dockerfile: install a pinned uv binary from the official image and use uv sync --frozen. The install_groups build-arg interface is preserved, so CI and existing build invocations need no changes.
  • Update a stale "poetry dependency group" reference in an LDAP error message.

How is this tested?

  • uv lock --locked confirms the lockfile is consistent with the manifest.
  • Docker image builds successfully with the default install_groups="main,all_ds,dev" (236 distributions, versions identical to the previous lockfile).
  • Console scripts (gunicorn, supervisord, rq, etc.) resolve on PATH and core imports load.
  • The optional ldap3 group remains excluded by default and installs only when requested via install_groups.

Notes

  • Future transitive-dependency upgrades are intentionally left out of this PR so the tooling migration can be reviewed in isolation. They can follow as separate, focused PRs.

How is this tested?

  • Unit tests (pytest, jest)
  • E2E Tests (Cypress)
  • Manually
  • N/A

Related Tickets & Documents

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 5 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="pyproject.toml">

<violation number="1" location="pyproject.toml:162">
P2: Missing explicit `default-groups` in [tool.uv] causes `uv sync` to install the dev group by default, unlike Poetry where dev was optional and excluded from `poetry install`. This is a behavior change in the migration.</violation>
</file>

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

Comment thread pyproject.toml
@lucydodo

Copy link
Copy Markdown
Member

I support this PR as well, but since it involves changing part of the ecosystem, I will delegate the review to someone else.

@lucydodo lucydodo removed their request for review June 16, 2026 09:23
@eradman

eradman commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

What changes would be made to https://github.com/getredash/redash/wiki/Local-development-setup?

@zachliu

zachliu commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

@eradman The Python dependency section of the wiki would change as follows. The venv creation, pip3 install wheel, and the make format/pre-commit steps stay the same.

Remove:

(redashvenv1) $ pip3 install poetry==2.1.4
(redashvenv1) $ poetry install --only main,all_ds,dev

Replace with:

(redashvenv1) $ pip3 install uv==0.11.6
(redashvenv1) $ uv sync --no-default-groups --group all_ds --group dev

Notes:

  • main (the project's base dependencies) is installed implicitly by uv sync, so it's no longer named explicitly; all_ds and dev are passed as --group flags.
  • --no-default-groups mirrors the old Poetry behavior where the dev group was optional and not pulled in unless requested (this matches the default-groups = [] setting in pyproject.toml).
  • uv can also manage the interpreter itself (uv python install + uv sync against a project venv), but the venv + pip3 install uv flow above keeps the wiki's existing structure with minimal edits.

I'm happy to prepare the wiki edit once the approach here looks good to you.

@eradman

eradman commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

After running uv sync --no-default-groups --group all_ds --group dev, it appears that pre-commit is not installed. Or is there a different way to run it? (This is on Ubuntu 24.04)

(redashvenv1) $ make format
pre-commit run --all-files
make: pre-commit: No such file or directory
make: *** [Makefile:44: format] Error 127

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants