Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poetry add does not add package to pyproject.toml #7230

Open
jbencina opened this issue Dec 21, 2022 · 3 comments
Open

poetry add does not add package to pyproject.toml #7230

jbencina opened this issue Dec 21, 2022 · 3 comments
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@jbencina
Copy link

jbencina commented Dec 21, 2022

  • Poetry version: Poetry (version 1.3.1)
  • Python version: Python: 3.10.8
  • OS version and name: macOS 11.5.2
  • pyproject.toml:
[tool.poetry]
name = "project"
version = "0.1.0"
description = ""
authors = ["myemail"]

[tool.isort]
profile = "black"

[tool.poetry.dependencies]
python = "^3.9"
pydantic = "^1.10.2"
requests = "^2.28.1"
click = "^8.1.3"
pyyaml = "^6.0"
flask = "^2.2.2"
psycopg2 = "^2.9.5"

[tool.poetry.group.dev.dependencies]
black = "^22.10.0"
isort = "^5.10.1"
flake8 = "^5.0.4"
mypy = "^0.982"
pytest = "^7.2.0"
pre-commit = "^2.20.0"
types-requests = "^2.28.11.5"
types-pyyaml = "^6.0.12.2"

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

[tool.poetry.scripts]
smarthome = 'myapp.cli.entry:cli'
  • [ x] I am on the latest stable Poetry version, installed using a recommended method.
  • [ x] I have searched the issues of this repo and believe that this is not a duplicate.
  • [ x] I have consulted the FAQ and blog for any relevant entries or release notes.
  • [x ] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

My pyproject.toml file will not update the contents of the [tool.poetry.dependencies] section after using poetry add pyemvue. When I run the command I see

❯ poetry add pyemvue
Using version ^0.16.1 for pyemvue

Updating dependencies
Resolving dependencies... (0.4s)

Writing lock file

Package operations: 16 installs, 0 updates, 0 removals
...

The package + dependencies are installed and I can use them in the virtual environment. However the pyproject.toml file is not updated. If I run poetry install, I get an error that the lock file is out of sync. If I run poetry update the package and its dependencies are uninstalled.

I have tried:

  • Remove the .venv path in my project created by Poetry
  • Deleting the lock file
  • Re-running the install / add commands after the two steps above
  • Updating Poetry
  • Clearing all Poetry caches

There's no issue if I manually add the package to the pyproject.toml myself. Any thoughts why the file is not being updated via the add command?

@jbencina jbencina added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Dec 21, 2022
@jbencina
Copy link
Author

I think I have found the culprit. If I move the:

[tool.isort]
profile = "black"

Section to the very bottom of the pyproject.toml file the issue goes away. Is there some known conflict here?

@neersighted
Copy link
Member

Looks like another issue with OutOfOrderTableProxy and Tomlkit. Probably a change in Tomlkit we didn't have good enough test coverage to catch.

@neersighted
Copy link
Member

Related: python-poetry/tomlkit#196

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants