Managing dependencies and Poetry

Hi,
Im using poetry for package management.

This is how my current dependencies looks like:

[tool.poetry.dependencies]
python = "^3.8"
streamlit = "^0.85.1"
plotly = "^5.1.0"

[tool.poetry.dev-dependencies]
pytest = "^6.0.2"
pytest-cov = "^2.10.1"
pylint = "^2.6.0"
mypy = "^0.782"
codecov = "^2.1.9"
black = "^20.8b1"
jupyter = "^1.0.0"
jupyter_contrib_nbextensions = "^0.5.1"
ipykernel = "^5.3.4"
jupyter_nbextensions_configurator = "^0.4.1"
flake8 = "^3.8.4"
great-expectations = "^0.13.19"
chardet = "^4.0.0"

When creating app, I don’t need those packages from .dev-dependencies.
Is there a way to install only non-dev dependencies?
You can do this with poetry using poetry install --no-dev command.

1 Like

Probably too late for your needs, but it might be helpful to others.

Streamlit cloud will first search for the requierements.txt file before searching for pyproject.toml. So before pushing your commit run:

poetry export -f requirements.txt --output requirements.txt

You can also use a pre-commit hook to do it automatically.

3 Likes

thanks, I didn’t know about ‘poetry export’. I moved from poetry to pyenv (I needed to add airflow, which doesn’t work with poetry), but this is really helpful.

It helped me one year later. =)
Thanks!