[ruby-core:120579] [Ruby master Feature#21020] Sync sig directory for prism of default gem.
Issue #21020 has been reported by ksss (Yuki Kurihara). ---------------------------------------- Feature #21020: Sync sig directory for prism of default gem. https://bugs.ruby-lang.org/issues/21020 * Author: ksss (Yuki Kurihara) * Status: Open ---------------------------------------- Currently, the type signatures (RBS) for the default gem is not available. **Prism** is the only default gem with type signatures, but this number is expected to increase in the future. As a first step to resolving this issue, I propose including the `sig` directory of Prism as a default gem in the synchronization process. PR: https://github.com/ruby/ruby/pull/12541 -- https://bugs.ruby-lang.org/
Issue #21020 has been updated by kddnewton (Kevin Newton). I'm fine with this if everyone else is. ---------------------------------------- Feature #21020: Sync sig directory for prism of default gem. https://bugs.ruby-lang.org/issues/21020#change-111447 * Author: ksss (Yuki Kurihara) * Status: Open ---------------------------------------- Currently, the type signatures (RBS) for the default gem is not available. **Prism** is the only default gem with type signatures, but this number is expected to increase in the future. As a first step to resolving this issue, I propose including the `sig` directory of Prism as a default gem in the synchronization process. PR: https://github.com/ruby/ruby/pull/12541 -- https://bugs.ruby-lang.org/
Issue #21020 has been updated by hsbt (Hiroshi SHIBATA). Status changed from Open to Assigned Assignee set to prism I'm interesting that location of signature with fresh installation of ruby. The sig directory under the `prism` is fine if we have only prism signature. Where is the best location if we will add `json` or `psych` signatures? ``` 1. $prefix/lib/ruby/3.5.0+0/$name/sig <- current proposal 2. $prefix/lib/ruby/3.5.0+0/sig/$name 3. $prefix/lib/ruby/sig/$name 4. $prefix/lib/ruby/gems/3.5.0+0/sig/$name 5. $GEM_HOME/sig/$name # This is same as 4 with $GEM_HOME is not specified. 6. $prefix/include/sig/$name 7. $prefix/share/sig/$name ... ``` I prefer 2 or 3. ---------------------------------------- Feature #21020: Sync sig directory for prism of default gem. https://bugs.ruby-lang.org/issues/21020#change-111877 * Author: ksss (Yuki Kurihara) * Status: Assigned * Assignee: prism ---------------------------------------- Currently, the type signatures (RBS) for the default gem is not available. **Prism** is the only default gem with type signatures, but this number is expected to increase in the future. As a first step to resolving this issue, I propose including the `sig` directory of Prism as a default gem in the synchronization process. PR: https://github.com/ruby/ruby/pull/12541 -- https://bugs.ruby-lang.org/
Issue #21020 has been updated by Eregon (Benoit Daloze). How about `$prefix/lib/ruby/gems/3.5.0+0/gems/$name-$version/sig` so it would be consistent between default and bundled gems? ---------------------------------------- Feature #21020: Sync sig directory for prism of default gem. https://bugs.ruby-lang.org/issues/21020#change-111881 * Author: ksss (Yuki Kurihara) * Status: Assigned * Assignee: prism ---------------------------------------- Currently, the type signatures (RBS) for the default gem is not available. **Prism** is the only default gem with type signatures, but this number is expected to increase in the future. As a first step to resolving this issue, I propose including the `sig` directory of Prism as a default gem in the synchronization process. PR: https://github.com/ruby/ruby/pull/12541 -- https://bugs.ruby-lang.org/
Issue #21020 has been updated by kddnewton (Kevin Newton). I think the code in the PR is good, but I agree I don't think the sig should live under `prism/sig`. I think it should be top directory of ruby repository `sig`. When it's installed I agree with @Eregon but I also think @hsbt's solution 2 is fine, provided RBS knows to use the overridden version if one is provided. ---------------------------------------- Feature #21020: Sync sig directory for prism of default gem. https://bugs.ruby-lang.org/issues/21020#change-111894 * Author: ksss (Yuki Kurihara) * Status: Assigned * Assignee: prism ---------------------------------------- Currently, the type signatures (RBS) for the default gem is not available. **Prism** is the only default gem with type signatures, but this number is expected to increase in the future. As a first step to resolving this issue, I propose including the `sig` directory of Prism as a default gem in the synchronization process. PR: https://github.com/ruby/ruby/pull/12541 -- https://bugs.ruby-lang.org/
Issue #21020 has been updated by tenderlovemaking (Aaron Patterson). Status changed from Assigned to Feedback @ksss What do you think? ---------------------------------------- Feature #21020: Sync sig directory for prism of default gem. https://bugs.ruby-lang.org/issues/21020#change-114105 * Author: ksss (Yuki Kurihara) * Status: Feedback * Assignee: prism ---------------------------------------- Currently, the type signatures (RBS) for the default gem is not available. **Prism** is the only default gem with type signatures, but this number is expected to increase in the future. As a first step to resolving this issue, I propose including the `sig` directory of Prism as a default gem in the synchronization process. PR: https://github.com/ruby/ruby/pull/12541 -- https://bugs.ruby-lang.org/
Issue #21020 has been updated by ksss (Yuki Kurihara). Sorry for the late reply. I'd like to resume the discussion. I'd like to install the signatures into the gem directory of each default gem, as @Eregon suggested in #note-3: ``` $prefix/lib/ruby/gems/X.Y.0/gems/$name-$version/sig ``` The reasons are: * rbinstall already creates this directory for every default gem (today it is only used for `exe/`). * Bundled gems and gems installed by RubyGems already put their signatures here, so default gems and bundled gems are handled the same way. * No change is needed in rbs. `RBS::EnvironmentLoader` and `rbs collection` look up `sig` under `Gem::Specification#gem_dir` before the stdlib signatures bundled with the rbs gem, so the installed signatures take precedence. This also satisfies @kddnewton 's condition in #note-4 that RBS should use the overridden version. I also considered options 2 and 3 from @hsbt 's list, but they would require adding new lookup paths to rbs. In addition, only the gem directory approach lets the signatures of a newer gem take precedence naturally when a default gem is updated with `gem update`. In the repository, following @kddnewton 's suggestion, the signatures are synced under the top-level `sig/` directory as `sig/<gem name>/` (e.g. `sig/prism/generated/prism.rbs`). When I opened this issue, prism was the only default gem with type signatures, and the change felt hard to justify for a single gem. Now I see it the other way around. rbs bundles signatures for about 30 default gems in its `stdlib/` directory, and to move them into each gem's own repository, ruby/ruby first needs a place to sync and install them. net-http already ships its own `sig/`, so I included it as well. I've updated https://github.com/ruby/ruby/pull/12541 with this approach, and verified it with `make install` (including with `DESTDIR`), `rbs -r <gem> validate` and `rbs collection install`. While verifying it, I found that prism's signatures on main reference `PP` without declaring the dependency, and opened https://github.com/ruby/prism/pull/4248 to fix it. Validating the installed signatures after `make install` makes it possible to catch this kind of problem. ---------------------------------------- Feature #21020: Sync sig directory for prism of default gem. https://bugs.ruby-lang.org/issues/21020#change-119413 * Author: ksss (Yuki Kurihara) * Status: Feedback * Assignee: prism ---------------------------------------- Currently, the type signatures (RBS) for the default gem is not available. **Prism** is the only default gem with type signatures, but this number is expected to increase in the future. As a first step to resolving this issue, I propose including the `sig` directory of Prism as a default gem in the synchronization process. PR: https://github.com/ruby/ruby/pull/12541 -- https://bugs.ruby-lang.org/
Issue #21020 has been updated by ksss (Yuki Kurihara). I'd like to revise my previous decision. I'm sorry, my understanding of the problem was not deep enough. I reconsidered @hsbt 's option 2 and now think it is the better choice: $prefix/lib/ruby/X.Y.0/sig/$name The reason is separation of responsibility. Default gems' code is installed under `rubylibdir` by Ruby itself, so their signatures should live there as well. The gem directory under `$GEM_HOME` belongs to RubyGems, and I don't think Ruby's installer should put files there. I'll update the PR accordingly. ---------------------------------------- Feature #21020: Sync sig directory for prism of default gem. https://bugs.ruby-lang.org/issues/21020#change-119577 * Author: ksss (Yuki Kurihara) * Status: Feedback * Assignee: prism ---------------------------------------- Currently, the type signatures (RBS) for the default gem is not available. **Prism** is the only default gem with type signatures, but this number is expected to increase in the future. As a first step to resolving this issue, I propose including the `sig` directory of Prism as a default gem in the synchronization process. PR: https://github.com/ruby/ruby/pull/12541 -- https://bugs.ruby-lang.org/
participants (5)
-
Eregon (Benoit Daloze) -
hsbt (Hiroshi SHIBATA) -
kddnewton (Kevin Newton) -
ksss (Yuki Kurihara) -
tenderlovemaking (Aaron Patterson)