fxn / zeitwerk

Efficient and thread-safe code loader for Ruby
MIT License
1.99k stars 118 forks source link

Gemfile/gemspec csv #280

Closed GVisockas closed 10 months ago

GVisockas commented 10 months ago

Reviewing my nightly cron tasks I found a warning that csv is not to be a part of standard library from ruby 3.4.0. It is mentioned, though, that:

Also contact author of zeitwerk-2.6.12 to add csv into its gemspec

Please ignore if this has been handled (as far as I have checked, it has not). Full message:

/shared/bundle/ruby/3.3.0/gems/zeitwerk-2.6.12/lib/zeitwerk/kernel.rb:38: warning: csv was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add csv to your Gemfile or gemspec. Also contact author of zeitwerk-2.6.12 to add csv into its gemspec.
fxn commented 10 months ago

@GVisockas Thanks for reporting this.

Whoever is producing the warning is assuming a certain call stack. There are gems that decorate Kernel#require, so you cannot really know who is the one really loading csv (or any of the ones triggering this).

So, nothing to do here, maybe report the warning is not accurate.

fxn commented 10 months ago

Oh, let me be more clear for people coming here without knowing this aspect of Zeitwerk.

Zeitwerk decorates Kernel#require (here). Therefore, all require calls pass through Zeitwerk. For require calls in projects managed by loaders, Zeitwerk performs some logic, otherwise, it just forwards to the original, decorated require transparently (mod stack traces).

That is, Zeitwerk is not using csv by itself, it is just proxying the require call of some code upwards actually using csv.