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

pdbr vs ipdb #26

Open
iloveitaly opened this issue Jan 31, 2022 · 7 comments
Open

pdbr vs ipdb #26

iloveitaly opened this issue Jan 31, 2022 · 7 comments

Comments

@iloveitaly
Copy link
Contributor

Are there any features missing from ipdb? This seems like a full replacement for ipdb (which is awesome). If that's the case, hopefully we can get the ipython documentation updated to include this package as an alternative.

@cansarigol
Copy link
Owner

Hi @iloveitaly I haven't checked it before but at least that issue is known. it would be great if pdbr was placed as an alternative.

@ssbarnea
Copy link
Contributor

I used ipdb for quite some time and I just tried to use pdbr, hoping that I would be able to get some (rich) color when printing various data structures.

Still, first thing that I observe is that my breakpoints() no longer work. I did use the same method I used to enable ipdb, via export PYTHONBREAKPOINT=pdbr.set_trace.

I also observed that installing pip install pdbr[ipython] did downgrade ipython to 7.34 from 8.4.0,... not sure if that was really the best idea. I am using py311, so I am wondering if there are some problems between python-ipython-pdbr it that were not yet fixed yet.

@cansarigol
Copy link
Owner

Hi, actually there was a problem with a version of ipython but now it is working. I removed the specific version definition now and you can see v0.7.2.

For breakpoint, I couldn't reproduce it. Do you have any sample?

@ssbarnea
Copy link
Contributor

Thanks, I updated both pdbr and ipython and gave it another try, but apparently pdbr did not want to debug. Later I created minimal python test file with just a breakpoint in it and found the culprit:

Traceback (most recent call last):
  File "/Users/ssbarnea/c/a/ansible-lint/z.py", line 3, in <module>
    breakpoint()
  File "/Users/ssbarnea/.pyenv/versions/3.11-dev/lib/python3.11/site-packages/pdbr/__main__.py", line 13, in set_trace
    pdb_cls = _pdbr_cls(context=context, show_layouts=show_layouts)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ssbarnea/.pyenv/versions/3.11-dev/lib/python3.11/site-packages/pdbr/utils.py", line 92, in _pdbr_cls
    return klass()
           ^^^^^^^
  File "/Users/ssbarnea/.pyenv/versions/3.11-dev/lib/python3.11/site-packages/pdbr/_pdbr.py", line 72, in __init__
    super().__init__(**init_kwargs)
  File "/Users/ssbarnea/.pyenv/versions/3.11-dev/lib/python3.11/site-packages/IPython/terminal/debugger.py", line 29, in __init__
    self.pt_init(pt_session_options)
  File "/Users/ssbarnea/.pyenv/versions/3.11-dev/lib/python3.11/site-packages/pdbr/_pdbr.py", line 86, in pt_init
    func_args = inspect.getargspec(super().pt_init).args
                ^^^^^^^^^^^^^^^^^^
AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?

That is not the first project that is hit by this, it is specific to py311. I think you should enable py311 pipeline as soon as possible, take a look at https://github.com/ansible/ansible-lint/blob/main/.github/workflows/tox.yml#L144 for how to make use of it in GHA.

@ssbarnea
Copy link
Contributor

It seems that pdbr could use some love because while having an attempt to contribute a py311 change I faces too many other issues. It uses nox which is uncommon, installed it but when I run nox -e test-3.10, I seen that it failed with two tests on macos:

FAILED tests/test_magic.py::TestPdbrChildProcess::test_time - pexpect.exceptions.TIMEOUT: Timeout exceeded.
FAILED tests/test_magic.py::test_expr_questionmark_pinfo - AssertionError: untagged = 'Signature: foo(arg)\nDocstring: Foo docstring\nFile:      /private/var/folders/3...

Sadly I do not have time to fix all the bugs and look at the history of merged PRs, i see that:

  • changes are merged while all windows pipelines report broken (for long time)
  • there is no macos pipeline

If some of these fixes are restored I would not mind to contribute back few for py311 but for the moment, I am sticking to ipbr, which seems reliable. Yep, keeping CI/CD green takes a lot of time, sometimes more than anything else.

@cansarigol
Copy link
Owner

Hi, @ssbarnea thanks for having a look. I fixed the win test problems (it was related pexpect package, I tried winpexpect but it didn't work. So I excluded magic tests for windows,) and added macos tests in the action. Feel free to add your MR.

@cansarigol
Copy link
Owner

one more failed test still exists. It is related to win32 and python3.10. trying to fix it right now

@KyleKing KyleKing mentioned this issue Oct 24, 2022
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

No branches or pull requests

3 participants