-
Notifications
You must be signed in to change notification settings - Fork 17
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
Loosen version constraint on core dependencies and re-pin lock file #409
Conversation
Did you run |
I ran When I run I don't know yet why this does not update to the latest versions available on PyPI... |
It could be because another dependency, most probably in the extra deps (lint, format, dev, nox, test) is pinned to an older version of setuptools. I had a look (with pipdeptree), and couldn't find the offender. In a way it doesn't matter, when resolving dependencies, pip will use the information in the main dependencies section of the pyproject, it won't look at the loc file. The only reason we'd want setuptools to be updated the lock file is if we want to run the test against a newer version of setup tools. |
@jherland might this be due to how the version bound for Line 109 in a071f87
|
@dorranh: changing our I think the reason setuptools is stuck at This fact was not obvious from our FWIW, I think this might point to a bug in Poetry... If I change our -setuptools = ">=68.0.0"
+setuptools = [
+ # setuptools 68.1.0 drops support for Python v3.7:
+ {version = ">=68.0.0", python = ">=3.8"},
+ {version = ">=68.0.0,<68.1.0", python = "<3.8"},
+] then I shouldn't really have changed anything in Poetry's dependency calculation; in both cases:
However, with the above diff applied I do get newer setuptools installed in all venvs that have Python >=3.8.
FTR, the same argument applied to importlib_metadata (which dropped support for Python 3.7 in v6.8.0). Applying the equivalent "over-specification" convinces Poetry to install the latest version on Python >=3.8:
So it seems to me that Poetry mistakenly applies its Python 3.7 calculations to all other Python versions unless we jump through hoops to "over-specify" our dependencies. I'm not sure though, am I missing something here? |
I've created a minimal demo at https://github.com/jherland/poetry_overspecify_deps_demo. AFAICS this exact issue does not exist on the Poetry issue tracker yet? |
I opened a discussion at https://github.com/orgs/python-poetry/discussions/8857 for now. Let's see if it is promoted into a bug. In the meantime, I guess maybe the best approach for this PR is to "over-specify" our dependencies, to improve test coverage across appplicable dependency versions? |
Discussion concluded: This is a known shortcoming, unlikely to change in the near future. I guess we need to keep over-specifying our (main) dependencies for now. |
This is _not_ our usual `poetry lock --no-update`, instead we run `poetry lock` to re-pin all our dependencies to the latest available version that matches our version constraints in pyproject.toml.
Over-specify our main dependencies to get the latest versions of dependencies installed on more recent Python versions. Without this, the versions of these dependencies chosen by Poetry will be the ones that are compatible with Python 3.7, even if the current Python version is much newer. We do this to improve our test coverage for dependency versions that are more likely to be used when FawltyDeps are installed with pip (in which case Poetry is not involved, and the looser version constraints in pyproject.toml are followed). See https://github.com/orgs/python-poetry/discussions/8857 and https://github.com/jherland/poetry_overspecify_deps_demo for more details.
bc02226
to
577fdd2
Compare
I apologise for sending you in this rabbit hole. I guess it's not a huge deal to over specify the deps for now, given you don't have many of them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Johan for that fix! This is not an obvious thing that Poetry does, and it is good we can at leas work our way around that complication.
My comments are in the spirit of "specify narrow if you can". You did two changes in some places - split requirement version dependening on the Python version and changed caret requirement to ">=". I think the latter change is not necessary. Following poetry documentation on the version specification:
For instance, if we previously ran poetry add
requests@^2.13.0
and wanted to update the library and ranpoetry update requests
, poetry would update us to version2.14.0
if it was available, but would not update us to3.0.0
. If instead we had specified the version string as^0.1.13
, poetry would update to0.1.14
but not0.2.0
.0.0.x
is not considered compatible with any other version.
Looking also at the examples they gave, caret requirement is allowing a change in the second meaningful digit in the version number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After discussion with @jherland I agree that being more restrictive about the major version may not help us ensure that FawltyDeps will not fail.
We better create tests that check for the drift of requirements version bounds and a check if FawltyDEps is working on the updated versions. Described in #411.
Fixes #408.
Use
>=
instead of^
in pyproject.toml to not be too restrictive asto which version of our dependencies is acceptable when a user installs
FawltyDeps into their project's venv.
The
^
specifier allows for "SemVer compatible" updates to the specifiedversion, but the exact rules around these are complex, and - it seems -
more restrictive than what we want (at least for most of our deps.
The new
>=
will allow for any newer version of a dependency to beused. We will need to be somewhat careful (and frequent) in checking that
a new version a dependency does not break the APIs we are using.
See https://python-poetry.org/docs/dependency-specification/ for more
details about the different available specifiers.
To verify that upgraded dependencies do not break FawltyDeps, we upgrade
all our pinned versions to the latest available and modulo two small
nitpicks reported by the latest Mypy version, it seems we're all good to
go! :-)
Commits:
pyproject.toml
changes in issue Stop pinning core dependencies #408