Package: poetry-relax
poetry-relaxAPoetryplugin to relax dependency versions when publishing libraries. Relax your project's dependencies fromfoobar^2.0.0tofoobar>=2.0.0.By default, Poetry uses caret constraints which would limitfoobarversions to<3.0.poetry-relaxremoves these upper version bounds, allowing dependencies to be upgraded.Removing upper version bounds is important when publishing libraries.
When searching for versions of dependencies to install, the resolver (e.g.pip) must respect the bounds your library specifies.
When a new version of the dependency is released, consumers of your librarycannotinstall it unless a new version of your library is also released.It is not feasible to release patches for every previous version of most libraries, which forces users to use the most recent version of the library or be stuck without the new version of the dependency.
When many libraries contain upper version bounds, the dependencies can easily becomeunsolvable— where libraries have incompatible dependency version requirements.
By removing upper version bounds from your library, control is returned to the user.Poetry's default behavior is to include upper version bounds. Many people have spoken up against this style of dependency management in the Python ecosystem, including members of the Python core development team. Seethe bottom of the readmefor links and additional context.Since the Poetry project will not allow this behavior to be configured, maintainers have resorted to manual editing of dependency constraints after adding.poetry-relaxaims to automate and simplify this process.poetry-relaxprovides:Automated removal of upper bound constraints specified with^Safety check if package requirements are still solvable after relaxing constraintsUpgrade of dependencies after relaxing constraintsUpdate of the lock file without upgrading dependenciesLimit dependency relaxation to specific dependency groupsRetention of intentional upper bounds indicating true incompatibilitiesCLI messages designed to match Poetry's outputInstallationThe plugin must be installed in Poetry's environment. This requires use of theselfsubcommand.$poetryselfaddpoetry-relaxUsageRelax constraints for which Poetry set an upper version:$poetryrelaxRelax constraints and check that they are resolvable without performing upgrades:$poetryrelax--checkRelax constraints and upgrade packages:$poetryrelax--updateRelax constraints and update the lock file without upgrading packages:$poetryrelax--lockPreview the changespoetry relaxwould make without modifying the project:$poetryrelax--dry-runRelax constraints for specific dependency groups:$poetryrelax--onlyfoo--onlybarRelax constraints excluding specific dependency groups:$poetryrelax--withoutfoo--withoutbarExamplesThe behavior of Poetry is quite reasonable for local development!poetry relaxis most useful when used in CI/CD pipelines.Relaxing requirements before publishingRunpoetry relaxbefore building and publishing a package.See it at work inthe release workflow for this project.Relaxing requirements for testingRunpoetry relax --updatebefore tests to test against the newest possible versions of packages.See it at work inthe test workflow for this project.Frequently asked questionsCan this plugin change the behavior ofpoetry addto relax constraints?Not at this time. The Poetry project states that plugins must not alter the behavior of core Poetry commands. If this behavior would be useful for you, please chime inon the tracking issue.Does this plugin remove upper constraints I've added?This plugin will only relax constraints specified with a caret (^). Upper constraints added with<and<=will not be changed.Is this plugin stable?This plugin is tested against multiple versions of Poetry and has an integration focused test suite. It is safe to use this in production, though it is recommend to pin versions. Breaking changes will be avoided unless infeasible due to upstream changes in Poetry. This project follows the semantic versioning scheme and breaking changes will be denoted by a change to the major version number.Will this plugin drop the upper bound on Python itself?Believe it or not, this is an even more contentious subset of this issue as Poetry will not allow packages with no upper bound on Python to exist alongside those that include one. This basically means that we cannot relax this requirement without breaking the vast majority of use-cases. For this reason, we cannot relaxpython^3at this time. Seethe post on the Poetry discussion boardfor more details.ContributingThis project is managed with Poetry. Here are the basics for getting started.Clone the repository:$gitclonehttps://github.com/madkinsz/poetry-relax.git
$cdpoetry-relaxInstall packages:$poetryinstallRun the test suite:$pytesttestsRun linters before opening pull requests:$./scripts/lintcheck.
$./scripts/lintfix.ReferencesThere's a lot to read on this topic! It's contentious and causing a lot of problems for maintainers and users.The following blog posts by Henry Schreiner are quite comprehensive:Should You Use Upper Bound Version Constraints?Poetry VersionsContent from some members of the Python core developer team:Semantic Versioning Will Not Save YouWhy I don't like SemVer anymoreVersion numbers: how to use them?Versioning SoftwareDiscussion and issues in the Poetry project:Please stop pinning to major versions by default, especially for Python itselfChange default dependency constraint from ^ to >=Developers should be able to turn off dependency upper-bound calculations