question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pyproject.toml option equivalent to "--no-root"

See original GitHub issue
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

Can we add an option to the pyproject.toml or poetry.toml that defaults poetry to using the install --no-root behaviour by default, the fact I’m constantly having to run poetry install --no-root almost every time (I honestly cant recall a time I haven’t used this… so for me its close to always) rather than poetry install makes this feel like something I should be able to configure.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:43
  • Comments:39 (10 by maintainers)

github_iconTop GitHub Comments

11reactions
kikyouscommented, Nov 12, 2021

please make --no-root default

9reactions
techdragoncommented, Oct 14, 2020

I’d argue this option actually belongs in both poetry.toml and pyproject.toml since a developer wanting to control their personal environment should use poetry.toml as this is their local config for their environments, however if a project were to for some reason require this option, then it makes sense for them to have this in the pyproject.toml that will be checked into git and shared with other developers.

One reason why a project might require this option is the popular testing tool Tox. Currently tox and poetry don’t play very well together, the current best practice recommends using --no-root in the tox configuration files. I wont reiterate the entire history of these other issues, but https://github.com/python-poetry/poetry/issues/1941 does a good job of summarising.

Another is Docker builds. https://github.com/python-poetry/poetry/issues/2760 and https://github.com/python-poetry/poetry/issues/1879 cover various issues in Docker environments where --no-root has come up as either the solution or a potential solution.

This is doubly problematic in the case of a web based project deployed using docker and tested with tox, where there is potentially (I’d argue this is quite likely) no scenario where the developers actually want to “install” the code they are writing and then the test setup will cause problems, in this situation there is no reason to ever install “the package” at all and forcing this as default behaviour only causes problems by constantly requiring users of poetry to use the --no-root option to avoid problems. I don’t come across many Flask or Django tutorials that even suggest a user define their code as an installable package at all so many web based projects are not written with installation as a package in mind. It was a Django package where I was testing using Tox that I had the most issues with poetry. Compounded with issues related to namespaced packages and having parts of the namespaced package in different pythonpath locations I got very frustrated with having to constantly use --no-root and opened this issue.

There are definitely legitimate uses for having a config file option for always doing the same thing as --no-root and it likely belongs in pyproject.toml but once theres an option for this I don’t see any reason why it shouldn’t also be a personal preference option on poetry.toml, but I’m less bothered by that not being available than I am at the lack of a project specific option for when this is necessary.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Basic usage | Documentation | Poetry - Python dependency ...
The pyproject.toml file is what is the most important here. This will orchestrate your project and its dependencies. For now, it looks like...
Read more >
Implementing dependency management with Python Poetry
Poetry creates two files for the project: pyproject.toml and poetry.lock ... from installing your local project, use the '--no-root' option.
Read more >
A Practical Guide to Setuptools and Pyproject.toml
An example driven guide to setting up and building a python package using Setuptools together with pyproject.toml.
Read more >
Integrating Python Poetry with Docker - Stack Overflow
Also, pin this version in your pyproject.toml as well: ... It is already isolated. So, we use poetry config virtualenvs.create false setting to...
Read more >
Python Poetry Cheat Sheet - YippeeCode
If you are familiar with pip package manager then this is similar to ... Update all poetry packages that are defined in pyproject.toml...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found