Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Poetry specify dependency on `sentry-sdk[flask]`

I'm trying to add support for Sentry to an existing Python Flask application that uses Python Poetry for dependency management.

The Sentry docs say to run this:

pip install --upgrade 'sentry-sdk[flask]

That works. But I want to convert that into a pyproject.toml dependency entry for Python Poetry. If I try just this:

[tool.poetry.dependencies]
# <snip>
sentry-sdk = "1.5.12"

I get a SolverProblemError:

... depends on sentry-sdk (1.5.12) which doesn't match any versions, version solving failed.

If I try:

[tool.poetry.dependencies]
# <snip>
sentry-sdk[flask] = "1.5.12"

I get Invalid TOML file.

How do I convert this pip dependency to Python pyproject.toml format?

like image 804
clay Avatar asked Jan 22 '26 21:01

clay


1 Answers

This worked for me:

poetry add sentry-sdk --extras=flask
like image 106
Dmytro Shyshov Avatar answered Jan 25 '26 12:01

Dmytro Shyshov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!