Python version constraints: common wisdom vs pragmatic realities #24
Replies: 2 comments 3 replies
-
@aaronsteers You've probably read https://iscinumpy.dev/post/app-vs-library/ and https://iscinumpy.dev/post/bound-version-constraints. I agree on all the points for the revised guidance 👍 |
Beta Was this translation helpful? Give feedback.
-
@aaronsteers I was unsure about your proposal at first (and to a small extent still am), but https://iscinumpy.dev/post/bound-version-constraints (thanks @edgarrmondragon!) makes a strong case for it. I agree with the revised guidance.
Do we have an issue open for this?
Maybe we can have Meltano try to force them to work with newer versions of Python by using |
Beta Was this translation helpful? Give feedback.
-
History and background
It was not very long long ago at all that we did not have python version constraints that poetry provides. Version constraints for dependencies have existed for quite some time, but dependencies can be deployed anywhere, so long as they don't conflict with other constraints on the same package within the same virtual environment. (And even then, those sometimes those would be overridden or ignored depending on circumstance.)
Current situation
Unfortunately, the exact same "best practice" constraint policies of dependency management have been applied to environment runtime restrictions.
Now: If conventional best practices are followed, a Python package which has not been updated since the latest Python X.Y version was release cannot be run on Python X.Y unless and until the maintainer updates the repo to declare it to be so.
Worse: No Python packages or applications can be installed on newer Python versions until and unless the maintainers of all of their dependent packages have removed or bumped their Python version restrictions to include the newest Python release.
Worst case: If even a single important package is abandoned - even if the package is 'stable with no changes needed' - then all packages and applications which rely on that package will reach an artificial and premature 'dead end' of their own Python version support lifecycle.
Paradigm mismatch
The dependency constraint is designed to prefer and install only compatible versions of dependencies.
The runtime constraint (often conservatively and prematurely) prevents installation for the package in question and also all packages which might depend upon it.
Impact
The impact of conventional best practice of "always restrict to the unreleased next version" is that many, many, many Python applications and libraries will be dead-ended prematurely. This effect will increase over time as more and more packages and libraries adopt Poetry and strict Python version constraints.
Pragmatic Solution: change the best practice guidance to apply only 'major' Python version constraints for most use cases
For library maintainers:
<3.10
or<3.11
Python version constraints with a<4.0
constraint.For application maintainers:
Revised Guidance in Practice
In practice, for the many types of Python packages we're concerned with for the Meltano community:
<4.0
instead of<3.11
).Note / Caveat
While the above guidance seems at first bold (and perhaps controversial), the reality is that it may turn out to be mostly inconsequential, since as soon as we start to apply more relaxed constraints, many/most maintainers following this guidance will find that they cannot bump their max Python version constraint - that we are already blocked on bumping max Python version constraints until all of our dependencies are likewise bumped.
Hence, why this conversation is important.
Beta Was this translation helpful? Give feedback.
All reactions