Replies: 2 comments 3 replies
-
|
Thanks a lot for tackling this @hsbt ! I'm not attached to any particular DSL, I think this one is flexible enough for most common use cases.
Is it even necessary? I'm not intimately familiar with Bundler's internal design, but it was my understanding that the
So right now if resolution fails, for example: source "https://rubygems.org"
gem "web-push", "3.1.0"
gem "signet", "0.17.0"We get: If one of the involved constraint was overridden we could ideally display a note of where the constraint override is, something like: |
Beta Was this translation helpful? Give feedback.
-
|
Are there plans to add support for completely ignoring a dependency, so that one can bring in a replacement that fulfills the same runtime API? For example, suppose that I have forked the override "grpc", ignore: true
gem "ufuk-grpc"
gem "some-gem-that-depends-on-grpc"(not sure if If this is supported, I think this will need to be recorded in the lockfile. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Background
In the discussion around #9454, reviewers (including @byroot and @Edouard-chin) pointed out that
BUNDLE_IGNORE_RUBY_UPPER_BOUNDSandBUNDLE_IGNORE_RUBYGEMS_UPPER_BOUNDSshould be expressible in the Gemfile, not only via environment variables.Around the same time, @byroot published The Missing Bundler Features arguing that Bundler lacks a way to override constraints imposed by upstream gems, and Shopify released bundler-ignore-dependency as a plugin that prototypes one form of the idea.
This proposal is an attempt to converge those threads into a single Gemfile-level DSL for the constraint-relaxation part of the problem. Aliasing, banning, and additive constraints are intentionally out of scope and deferred to separate discussions.
Proposed syntax
targetis either:all(meaning every gemspec in the resolution graph) or a gem name string.fieldnames which piece of metadata to operate on — currently one ofversion,required_ruby_version, orrequired_rubygems_version.operationis one of three values: a version spec string (absolute replacement), the symbol:ignore_upper(strip<and<=while keeping lower bounds), ornil(remove the constraint entirely). Multiple fields may be given in a single call.Semantics
A version string is an absolute replacement. The target's existing requirement is wholly replaced by the given spec, regardless of what the gemspec or the upstream gem asked for. This follows uv's wording: "Overrides are absolute — they completely replace constituent package requirements."
:ignore_upperremoves only<and<=from the existing requirement and preserves lower bounds; this is the common case of "stale upper bound on a new Ruby release".nilstrips the constraint entirely.The allowed combinations are:
:allrequired_ruby_version:ignore_upper/nil:allrequired_rubygems_version:ignore_upper/nil"gem"version:ignore_upper/nil"gem"required_ruby_version:ignore_upper/nil"gem"required_rubygems_version:ignore_upper/nil:all+version:is not allowed: a dependency version requirement only has meaning relative to a specific gem.Validation rules
:allcombined withversion:ArgumentErrorArgumentErrorversion: 123)ArgumentErrorArgumentErrorThe canonical form is one
overridecall per target. Splitting across multiple statements is allowed but warned so that the intent stays in one place.Supersedes #9454
This proposal supersedes #9454. The environment variables introduced there (
BUNDLE_IGNORE_RUBY_UPPER_BOUNDSandBUNDLE_IGNORE_RUBYGEMS_UPPER_BOUNDS) are better expressed as Gemfile declarations:BUNDLE_IGNORE_RUBY_UPPER_BOUNDS=true→override :all, required_ruby_version: :ignore_upperBUNDLE_IGNORE_RUBYGEMS_UPPER_BOUNDS=true→override :all, required_rubygems_version: :ignore_upperThe reviewers' feedback on #9454 pointed out that this kind of configuration belongs in the Gemfile where the intent is visible to every developer on the project, not in an environment variable that silently changes behavior.
If this proposal is enough to their usecases, I will withdraw #9454.
Open questions
Gemfile.lockso that the lockfile alone is enough to reproduce resolution?Prior art
ignore_ruby_upper_boundsandignore_rubygems_upper_boundssettings #9454 — the env-variable PRBeta Was this translation helpful? Give feedback.
All reactions