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.

poetry add breaks existing [build-system]

See original GitHub issue
  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04

  • Poetry version: Poetry version 1.0.10

  • Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/ycd/2311f6e9a48cb7e1e8811c87247dc3a6

Issue

When adding a new dependency with poetry add example[extra1, extra2] it tries to override existing [build-system] and breaks it.

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

poetry Also streamable link: https://streamable.com/xwvej8

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
abncommented, Aug 10, 2020

Had a quick look, it’s a bug in how we parse the name. That should really change and be normalised in core.

0reactions
jaklancommented, Aug 14, 2020

@abn the biggest issue is resolved, but it’s not yet working correctly (I’m using the latest pre-release). That’s the end of my pyproject.toml (I concatenate two pyproject.toml files during project generation with cookiecutter - one with poetry stuff, ending with [build-system] table, and another one with tool configs like isort):

[build-system]
requires = ["poetry-core>=1.0.0a5"]
build-backend = "poetry.core.masonry.api"

[tool.isort]
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
known_first_party = ["some_package"]
profile = "black"

Then, when I run poetry add ... during development, TOML tables are automatically reordered, but there’s an empty line missing between tables:

[tool.isort]
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
known_first_party = ["some_package"]
profile = "black"
[build-system]
requires = ["poetry-core>=1.0.0a5"]
build-backend = "poetry.core.masonry.api"

To make it work properly, you have to have an additional empty line at the end of the file, but it would be really annoying to especially exclude pyproject.toml from end-of-file-fixer pre-commit hook to fix this behaviour. Regardless of the error - I don’t really understand what’s the reason behind that reordering behaviour?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Basic usage | Documentation | Poetry - Python dependency ...
This is by design, it ensures that your project does not break because of unexpected changes in dependencies. Commit your poetry.lock file to...
Read more >
Dependency Management With Python Poetry
Start a new Poetry project; Add Poetry to an existing project; Use the pyproject.toml file; Pin dependencies; Install dependencies with poetry.
Read more >
Implementing dependency management with Python Poetry
lock' file, the process changes slightly. Assuming the .toml and .lock files are in sync, Poetry will use the existing .lock file to...
Read more >
Python Virtual Environments tutorial using Virtualenv and Poetry
pip install virtualenv. Create environment folder inside the current package/project directory: $ python -m venv env ...
Read more >
How I break up with pip and fall in love with poetry my new ...
In the following sections, I will guide you on how to migrate an existing project from pip to poetry. Installing Poetry in your...
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