Install dependencies in Streamlit cloud based on uv pyproject.toml

Hi,

I am using uv as the package manager for my project. I have a project.toml with the section [tool.uv].
I realized that I could not deploy my app on the cloud, and that I needed poetry:

[tool.poetry] section not found

Is it planned to support uv soon? I thought it would be a great addition, since Streamlit Cloud is also using uv under the hood. It forces me to also use poetry, which I’d like not to use anymore.

For reference, this is my pyproject.toml built with uv and not poetry:

[project]
name = "finance-assistant"
version = "0.0.0"
description = "Personal finance assistant"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
    "fastapi>=0.112.1",
    "pandas>=2.2.2",
    "plotly>=5.23.0",
    "pydantic>=2.8.2",
    "pyyaml>=6.0.2",
    "streamlit>=1.37.1",
    "structlog>=24.4.0",
    "tqdm>=4.66.5",
    "watchdog>=4.0.2",
    "yfinance>=0.2.41",
]

[tool.uv]
dev-dependencies = [
    "pyright>=1.1.377",
    "pytest>=8.3.2",
    "ruff>=0.6.1",
    "pylyzer>=0.0.61",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

The syntax differs quite a bit compared to poetry generated pyproject.toml.

Thanks a lot!

Are you referring to deploying your app on the community cloud? Why not just use a simple requirements.txt?

Because I am using a package manager which resolves dependencies, as poetry or uv would do. This eliminates many hassles that come with only using a requirements.txt.

Here is my workaround:

#!/bin/bash

echo "Updating requirements.txt"
uv sync
uv pip compile pyproject.toml -o requirements.txt >/dev/null
echo "-e ." >>requirements.txt
echo "Successfully updated requirements.txt"

This automatically generates a requirements.txt file from my uv-generated pyproject.toml.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.

I ran into this problem too and filed an issue Native `uv` support in Community Cloud · Issue #9502 · streamlit/streamlit · GitHub

1 Like