Questions tagged [python-poetry]

Poetry is a Python tool to handle dependency installation, as well as the building and packaging of Python packages. Do NOT use this tag for poems written in the Python language, since this is off-topic on Stack Overflow.

Poetry is a Python tool to handle dependency installation as well as building and packaging of Python packages. Do not use this tag for poems written in Python language since this is off-topic on Stack Overflow.

What are the advantages of Poetry compared to other types of package management? From the documentation:

Packaging systems and dependency management in Python are rather convoluted and hard to understand for newcomers. Even for seasoned developers it might be cumbersome at times to create all files needed in a Python project: setup.py, requirements.txt, setup.cfg, MANIFEST.in and the newly added Pipfile.

So I wanted a tool that would limit everything to a single configuration file to do: dependency management, packaging and publishing.

It takes inspiration in tools that exist in other languages, like Composer (PHP) or Cargo (Rust).

And, finally, there is no reliable tool to properly resolve dependencies in Python, so I started poetry to bring an exhaustive dependency resolver to the Python community.

1108 questions
24
votes
4 answers

poetry returns 'dyld: Library not loaded ... image not found' following brew install while inside virtual environment

I ran brew install postgresql while inside a poetry environment. Since then, I can't interact with poetry. λ ~/ poetry dyld: Library not loaded: /usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/Python Referenced from:…
24
votes
1 answer

Does Poetry have an equivalent for the flag "--trusted-host" that is available on Pip?

I wish to start using poetry on some projects at work, where I am stuck behind corporate filters that sometimes interfere with certs. If I use pip, I can ignore SSL errors by doing something like the below: $ pip install --trusted-host pypi.org…
Devasta
  • 1,489
  • 2
  • 17
  • 28
23
votes
2 answers

How to find the list of available versions for an specific package with Poetry?

Using Poetry, I want to find all versions of an specific package that are available for install. Is it possible to achieve that? (Similar to Python and pip, list all versions of a package that's available?)
Fábio Perez
  • 23,850
  • 22
  • 76
  • 100
22
votes
5 answers

'poetry install' command fails; *.whl files are not found

I am managing dependencies in my Python project via Poetry. Now I want to run this project in a machine which is different from my dev machine. To install dependecies, I simply run this command from the root directory: $ poetry install but then it…
tteguayco
  • 766
  • 1
  • 6
  • 16
22
votes
4 answers

Why does poetry build raise ModuleOrPackageNotFound exception?

I want to use poetry to build and distribute Python source packages, but after poetry init I get an error running poetry build. ModuleOrPackageNotFound No file/folder found for package mdspliter.tree
Andy
  • 1,077
  • 1
  • 8
  • 20
21
votes
2 answers

How to reuse pyproject.toml in monorepo with Poetry?

There are multiple projects in my monorepo, which has package management via Poetry individually. For instance, monorepo ├── a │   └── pyproject.toml ├── b │   └── pyproject.toml └── c └── pyproject.toml Each project has its own sessions for…
northtree
  • 8,569
  • 11
  • 61
  • 80
21
votes
1 answer

How can I specify which Python version poetry should create venv?

I started using Poetry recently. I really like straightforward package management, but I can’t seem to resolve one thing: The Python version it should use. I have Python 3.9 and 3.7 on my machine. 3.7 is higher in priority in system environmental…
M.wol
  • 901
  • 3
  • 10
  • 21
21
votes
5 answers

How to run FastAPI application from Poetry?

I have a fastapi project built by poetry. I want to run the application with a scripts section in pyproject.tom like below: poetry run start What is inside double quotes in the section? [tool.poetry.scripts] start = "" I tried to run the following…
BrainVader
  • 383
  • 1
  • 3
  • 7
21
votes
1 answer

Why does PIP convert underscores to dashes

I am trying to install a Pyramid app -- let's say test_app. inside a virtual environment and it is getting installed as test-app (pip freeze output shows it test-app==0.0). Because of this, I can not import the package. How should I fix this…
treecoder
  • 43,129
  • 22
  • 67
  • 91
20
votes
2 answers

How to have a single source of truth for poetry and pre-commit package version?

I'm looking into this Python project template. They use poetry to define dev dependencies [tool.poetry.dev-dependencies] black = {version = "*", allow-prereleases = true} flake8 = "*" isort = "^5.6" mypy = ">0.900,<1" ... They use also pre-commit…
floatingpurr
  • 7,749
  • 9
  • 46
  • 106
20
votes
2 answers

using python-poetry to publish to test.pypi.org

I have been investigating the use of Poetry to publish Python projects. I wanted to test the publishing process using a trivial project similar to the Python Packaging Authority tutorial. Since this is a trivial project, I want to publish it to the…
Leon Webster
  • 203
  • 2
  • 6
20
votes
2 answers

Have PermissionError when I run "poetry run" command

Environment Ubuntu 20.04 Python 3.7.3 Poetry 1.0.8 My Problem I installed poetry to manage packages, and I tried it with following simple project, . └── myproject ├── README.rst ├── myproject │   ├── __init__.py │   ├── main.py …
Y. P
  • 506
  • 1
  • 5
  • 12
20
votes
3 answers

Python Poetry: how to specify platform-specific dependency alternatives?

Some background: The project I'm working on uses python-ldap library. Since we are a mixed-OS development team (some use Linux, some macOS and some Windows), I'm trying to make the project build on all environments. Unfortunately, python-ldap is…
Igor Brejc
  • 18,714
  • 13
  • 76
  • 95
20
votes
1 answer

How can I get tox and poetry to work together to support testing multiple versions of a Python dependency?

I am switching a project that currently uses pipenv to poetry as a test to see what the differences are. The project is a simple, redistributable, Django app. It supports Python 3.6-8, and Django 2.2 and 3.0. I have a tox.ini file that covers all…
Hugo Rodger-Brown
  • 11,054
  • 11
  • 52
  • 78
19
votes
2 answers

Warning: The lock file is not up to date with the latest changes in pyproject.toml

When I am using a poetry command with Python 3.7, in my case: poetry export -f requirements.txt I am getting the following error: Warning: The lock file is not up to date with the latest changes in pyproject.toml. You may be getting outdated…
marcuse
  • 3,389
  • 3
  • 29
  • 50
1 2
3
73 74