Closed zevisert closed 2 years ago
More info about what I mean: given the following pyproject.toml:
[tool.poetry]
name = "larkjs-issue-8"
version = "0.1.0"
description = "demo"
authors = ["@zevisert"]
[tool.poetry.dependencies]
python = "^3.10"
lark-js = "^0.0.7"
lark-parser = "^0.12.0"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
Running poetry
results in this log:
$ poetry update
Updating dependencies
Resolving dependencies... (0.0s)
SolverProblemError
Because lark-js (0.0.7) depends on lark-parser (>=0.11.1,<0.12.0)
and no versions of lark-js match >0.0.7,<0.0.8, lark-js (>=0.0.7,<0.0.8) requires lark-parser (>=0.11.1,<0.12.0).
So, because larkjs-issue-8 depends on both lark-js (^0.0.7) and lark-parser (^0.12.0), version solving failed.
But I can get around it for now with pip install
, but even pip complains about the mismatch:
$ pip install 'lark-parser==0.12.0'
Collecting lark-parser==0.12.0
Using cached lark_parser-0.12.0-py2.py3-none-any.whl (103 kB)
Installing collected packages: lark-parser
Attempting uninstall: lark-parser
Found existing installation: lark-parser 0.11.3
Uninstalling lark-parser-0.11.3:
Successfully uninstalled lark-parser-0.11.3
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
lark-js 0.0.7 requires lark-parser<0.12.0,>=0.11.1, but you have lark-parser 0.12.0 which is incompatible.
Successfully installed lark-parser-0.12.0
Thanks for bringing this to my attention.
So, is there a way to say 0.x.y where x>=11? Or is upgrading to version 1 the only solution?
I realize now I didn't word my initial issue as clearly as I could have, I was going on memory / experience rather than quoting poetry's docs directly. Here's how caret requirements work for v0
versions:
An update is allowed if the new version number does not modify the left-most non-zero digit in the major, minor, patch grouping.
But there is a way! We just have to use multiple specifiers; which there's lots of ways of doing.
[tool.poetry.dependencies]
lark = "^0, >= 0.11.1" # Versions allowed: >= 0.11.1 <1.0.0
[tool.poetry.dependencies]
lark = "0.*, >= 0.11.1" # Versions allowed: >= 0.11.1 <1.0.0
[tool.poetry.dependencies]
lark = "<1.0.0, >= 0.11.1" # Versions allowed: >= 0.11.1 <1.0.0
But beware, if lark needs a v0.13
release with breaking changes from v0.12
, these specifiers would allow that breaking change in v0.13
.
I'll make a PR right now with your ask for 0.x.y where x>=11
.
Of course, after lark v1 is ready, this can go back to semantic versioning.
lark-js 0.0.7
is incompatible with the newly-releasedlark 0.12.0
.This is because poetry follows semver clause 4 when you use the
^
operator to define dependencies, and treats v0.Y.Z as unstable.As an example, while people correctly expect that
^1.2.3
is also be compatible with1.3.0
, this doesn't apply to packages with a major version of0
. In the case of a version like^0.Y.Z
, the only compatible versions are those which only changeZ
.I'm not sure if you intended on also updating and releasing pypi packages of
lark-js
when new versions oflark
are released, à la the live code thing, but as it stands - I can't uselark 0.12
withlark-js
. I see that you're working on a v1 release for lark, which is great, but until then, maybe we can use the inequality>=
dependency specifiers?