MousaZeidBaker / poetry-plugin-up

Poetry plugin that updates dependencies and bumps their versions in pyproject.toml file
MIT License
316 stars 10 forks source link

poetry up breaks versions #5

Closed ta-soft closed 1 year ago

ta-soft commented 1 year ago

After executing

poetry up --latest

a couple times, I get the following error message:

Because no versions of databases match >0.7.0,<0.8.0 and databases (0.7.0) depends on sqlalchemy (>=1.4.42,<1.5), databases (>=0.7.0,<0.8.0) requires sqlalchemy (>=1.4.42,<1.5). And because sqlmodel (0.0.8) depends on SQLAlchemy (>=1.4.17,<=1.4.41) and no versions of sqlmodel match >0.0.8,<0.0.9, databases (>=0.7.0,<0.8.0) is incompatible with sqlmodel (>=0.0.8,<0.0.9). So, because jobtracker depends on both sqlmodel (^0.0.8) and databases (^0.7.0), version solving failed.

So looks like poetry up puts the project in a situation where version solving fails.

I believe you only need to have "sqlmodel" as a dependency to get to this situation.

MousaZeidBaker commented 1 year ago

Thanks for reporting an issue, can you share your pyproject.toml

ta-soft commented 1 year ago

This version is before poetry up.

[tool.poetry] name = "jobtracker" version = "0.1.0" description = "Job Tracker FastAPI backend" authors = ["TA SOFT bla@bla.com"]

[tool.poetry.dependencies] python = "^3.10" sqlmodel = "^0.0.6" requests = "^2.28.1" google-api-python-client = "^2.56.0" google-auth-httplib2 = "^0.1.0" google-auth-oauthlib = "^0.5.2" psycopg2-binary = "^2.9.3" uvicorn = "^0.18.2" gunicorn = "^20.1.0" databases = {extras = ["postgresql"], version = "^0.6.1"} fastapi = "^0.79.0" selenium = "^4.4.0" python-multipart = "^0.0.5" APScheduler = "^3.9.1" pyTelegramBotAPI = "^4.7.0" aiohttp = "^3.8.1" oauth2client = "^4.1.3" pytest = "^7.1.2" loguru = "^0.6.0" python-jose = {extras = ["cryptography"], version = "^3.3.0"} passlib = {extras = ["bcrypt"], version = "^1.7.4"} munkres = "^1.1.4" pandas = "^1.5.0" xlrd = "^2.0.1" openpyxl = "^3.0.10" XlsxWriter = "^3.0.3" Jinja2 = "^3.1.2" fpdf2 = "^2.5.7" dataframe-image = "^0.1.3" matplotlib = "^3.6.1" demoji = "^1.1.0"

[tool.poetry.dev-dependencies]

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

MousaZeidBaker commented 1 year ago

So the issue is databases 0.7.0 is incompatible with sqlmodel 0.0.8 because both depend on different sqlalchemy versions.

Running following in an empty project yields the same error

poetry add sqlmodel "databases[postgresql]"

so Poetry itself can't resolve them.

I'd suggest to pin packages that depend on same sub-package but with different specific versions so that they are ignored when updating to latest.

MousaZeidBaker commented 1 year ago

I'll add a fix that reverts pyproject.toml changes on error in order not to end up with a "broken" pyproject.toml

ta-soft commented 1 year ago

I'll add a fix that reverts pyproject.toml changes on error in order not to end up with a "broken" pyproject.toml

excellent stuff, thank you!