Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop pry #360

Merged
merged 2 commits into from Mar 14, 2024
Merged

Drop pry #360

merged 2 commits into from Mar 14, 2024

Conversation

hunchr
Copy link
Member

@hunchr hunchr commented Mar 13, 2024

this is how I debug:

Suppose we have this code

class ApplicationController < ActionController::Base
  @hi = 'hello'
  @hello = 'world'
  debugger
end

If I run it with with pry (byebug)

image

no autocompletion, no syntax highlighting, nothing

If I run it with with irb (debug)

image

it's so much better. maybe I'm using pry incorrectly but for me pry is completely useless

@hunchr hunchr requested a review from coorasse March 13, 2024 08:20
@hunchr hunchr self-assigned this Mar 13, 2024
@hunchr hunchr marked this pull request as ready for review March 13, 2024 08:40
@hunchr hunchr changed the title Replace pry with irb Replace pry/byebug with irb/debug Mar 13, 2024
Copy link
Member

@coorasse coorasse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @hunchr !
Two things:

  • terminal: I believe irb catched up with pry by now. I am in favor of removing pry.
  • debug: I cannot judge. I use rubymine. Therefore I am open to any solution wished by people using debug.

I'd like at least a couple of more approvals on this one.

@coorasse coorasse requested a review from rnestler March 13, 2024 09:30
Copy link
Member

@rnestler rnestler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tried it too much with debugging yet to compare. A few notes:

  • irb is the standard, so I prefer using it.
  • The less dependencies the better
  • pry-rails should improve the bin/rails console, but I actually like the irb provided one way more.
  • According to https://www.mintbit.com/blog/byebug-replaced-with-debug-rails7 debug is the default for Rails 7 instead of bybug. It also mentions that ruby 3.1 bundles the debug gem, so maybe we don't even need it in the gem file? We need it, otherwise it doesnt' get required and breakpoints aren't working.

@schmijos
Copy link
Member

I would drop all of them. I use binding.irb now.

@rnestler
Copy link
Member

I would drop all of them. I use binding.irb now.

But for that you'll need to require the irb gem, no?

@hunchr
Copy link
Member Author

hunchr commented Mar 13, 2024

But for that you'll need to require the irb gem, no?

the irb gem is already included by rails
image

Copy link
Member

@rnestler rnestler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove it and use binding.irb. It can still load the debug gem for a better experience at runtime: https://github.com/ruby/irb/blob/1a1fbba020f1f504b2cb4d832ee4aa7af6aee0d3/README.md#debugging-with-irb

ruby_on_rails/suggested_libraries.md Outdated Show resolved Hide resolved
@schmijos
Copy link
Member

schmijos commented Mar 13, 2024

I would drop all of them. I use binding.irb now.

But for that you'll need to require the irb gem, no?

If you mean bundling it: No. It's a default gem. You can require it directly: https://stdgems.org/irb/

@rnestler
Copy link
Member

If you mean bundling it: No. It's a default gem. You can require it directly:

I wanted to avoid needeing to do require 'irb'; binding.irb, but it's not needed since it seems in scope anyways.

Co-authored-by: Raphael Nestler <raphael.nestler@renuo.ch>
@hunchr hunchr changed the title Replace pry/byebug with irb/debug Drop pry Mar 14, 2024
@schmijos schmijos merged commit 8fd3891 into main Mar 14, 2024
1 check passed
@schmijos schmijos deleted the feature/replace-pry-with-irb branch March 14, 2024 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants