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

Please make the dependency on debugpy optional #712

Closed
mgorny opened this issue Jul 8, 2021 · 13 comments · Fixed by #767
Closed

Please make the dependency on debugpy optional #712

mgorny opened this issue Jul 8, 2021 · 13 comments · Fixed by #767

Comments

@mgorny
Copy link

mgorny commented Jul 8, 2021

DebugPy is a packaging nightmare, and doesn't seem to support non-x86 platforms. Could you please make the dependency optional?

@JohanMabille
Copy link
Contributor

That would break the debugging feature of ipykernel. I'm not sure we want to require users to do extra manipulations to have the debugger in ipykernel because of technical difficulty to package debugpy. Besides, I'm not sure to understand what you mean by "DebugPy doesn't seem to support non-x86 platforms": DebugPy has been packaged for ppc and aarch64 on conda-forge and seems to work.

@mgorny
Copy link
Author

mgorny commented Jul 11, 2021

Well, right now forcing debugpy means we can't package new ipykernel at all due to bug #715. Though I suppose that's a problem of its own, and needs to be fixed independently of debugpy.

@frenzymadness
Copy link
Contributor

It seems that the latest stable debugpy is not compatible with Python 3.10, although some commits exist in the main branch.

@frenzymadness
Copy link
Contributor

I've tried to update ipykernel in Fedora to the latest stable release but I've failed because of debugpy. Debugpy itself is not yet compatible with Python 3.10 even when you use the content of the main branch. According to upstream, the reason is that the bundled pydevd does not support 3.10 fully yet: microsoft/debugpy#714
But this is not the biggest issue I have. The problem is that in Fedora, we do not provide JupyterLab as an RPM package - we only have Jupyter Notebook. And Jupyter Notebook does not support debuggers yet so trying to package and maintain debugpy just to be able to update ipykernel when our users have no benefit from the debugger implementation does not seem to be the best way how to spend my time.
Right now, I can either keep the latest version where debugpy is not required or try to disable the debugger implementation in ipykernel.

Should I try to prepare a PR making the dependency on debugpy optional?

@martinRenou
Copy link
Contributor

It might be simpler and safer to use pip, or even better miniconda, to install your Python packages, instead of dnf.

That way you don't mess with your system. You could even start using JupyterLab :)

@hroncok
Copy link
Contributor

hroncok commented Sep 3, 2021

Some of our Fedora packages (integrated into the distro) depend on ipykernel. Using pip or miniconda is not an option. Lumír has provided some feedback about why is this new dependency on DebugPy undesired and problematic for us and saying "just use pip/miniconda" does not bring any value to this discussion.

@martinRenou
Copy link
Contributor

Is the issue with Python 3.10 the only blocker? It might be worth just waiting for debugpy to be released with Python 3.10 support?

@martinRenou
Copy link
Contributor

saying "just use pip/miniconda" does not bring any value to this discussion.

I was just trying to help by suggesting another approach to install it. I didn't understand you were actually making a Fedora package depending on ipykernel. But now I get why conda/pip will not be helpful to you.

@hroncok
Copy link
Contributor

hroncok commented Sep 3, 2021

I was just trying to help ...

Apologies if my response was a bit too unfriendly. I guess I assumed it was obvious that we actually talk about the distro package of ipykernel, but I see now that it was not. Glad that we are now on the same page, thank you!

The problem is that in Fedora, we do not provide JupyterLab as an RPM package - we only have Jupyter Notebook. And Jupyter Notebook does not support debuggers yet so trying to package and maintain debugpy just to be able to update ipykernel when our users have no benefit from the debugger implementation does not seem to be the best way how to spend my time.

I think this is the main issue here. Not all use cases of ipykernel require debugging and always bringing the new dependency is kinda undesired in most cases. What if Jupyter Lab requires ipykernel[debugger] and we make the dependency optional -- using the [debugger] extra. That way, all use cases should be satisfactory.

@JohanMabille
Copy link
Contributor

JohanMabille commented Sep 3, 2021

I think having an option to disable the dependency on debugpy (and the debugging features) is fine. Indeed, now that the Debug Adapter Protocol is part of the Jupyter Kernel Protocol, the default should be to depend on debugpy. Not sure what the best implementation would be, though (an argument for setup.py? Patching setup.py?). If I remember correctly, the dependency on the debugger lies in ipkernel.py only.

Clients detect the support for debugger in the kernelspec. Therefore when the debugger is not supported, the debugger field of the kernelspec should be set to False.

I would be happy to review and test your PR.

@minrk
Copy link
Member

minrk commented Sep 3, 2021

from a setuptools/conda/most packaging environment stand point, ipykernel should depend on debugpy in its metadata. However, for cases like fedora/debian packaging, which have different priorities about dependencies than most, they can change the default dependencies to offer more stripped-down functionality. pip doesn't have a 'default extras', so our only reasonable choice is to put it in install_requires.

I think the appropriate level of support from our side is to try to handle debugpy being unavailable at runtime (catch ImportErrors). Since external-packaging tools ignore dependencies in the package metadata, I don't think we need to touch that, they can just exclude debugpy from the dependencies on their side, and as long as the code handles debugpy being unavailable, it should be okay. We've had similar workarounds for e.g. stdlib sqlite3 being unavailable - that shouldn't ever happen, but it does in weird packaging environments.

@hroncok
Copy link
Contributor

hroncok commented Sep 3, 2021

Since external-packaging tools ignore dependencies in the package metadata...

Ours don't. We would need to patch it out. But otherwise, your assessment is correct, the code handling debugpy being unavailable would be helpful, as we would only need to patch out the metadata.

@frenzymadness
Copy link
Contributor

I think the appropriate level of support from our side is to try to handle debugpy being unavailable at runtime (catch ImportErrors).

My plan is to prepare a patch for this next week. Ideally including a test run with debugpy unavailable which makes us sure that the support for that installation won't break in the future.

frenzymadness added a commit to frenzymadness/ipykernel that referenced this issue Sep 7, 2021
debugpy is an optional dependency because only frontends with
debugging support (Jupyter lab) can really use its features.

Fixes: ipython#712
frenzymadness added a commit to frenzymadness/ipykernel that referenced this issue Sep 7, 2021
debugpy is an optional dependency because only frontends with
debugging support (Jupyter lab) can really use its features.

Fixes: ipython#712
@minrk minrk closed this as completed in #767 Sep 9, 2021
gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Aug 20, 2023
Reference: ipython/ipykernel#712
Reference: ipython/ipykernel#1136

dev-python/ipykernel: keyword 6.25.1-r1 for ~arm64-macos, ~x64-macos
dev-python/comm: keyword 0.1.4 for ~arm64-macos, ~x64-macos
dev-python/ipython: keyword 8.14.0 for ~arm64-macos, ~x64-macos
dev-python/jupyter-client: keyword 8.3.0 for ~arm64-macos, ~x64-macos
dev-python/jupyter-core: keyword 5.3.1 for ~arm64-macos, ~x64-macos
dev-python/matplotlib-inline: keyword 0.1.6 for ~arm64-macos, ~x64-macos
dev-python/nest-asyncio: keyword 1.5.7 for ~arm64-macos, ~x64-macos
dev-python/pyzmq: keyword 25.1.1 for ~arm64-macos, ~x64-macos
dev-python/traitlets: keyword 5.9.0 for ~arm64-macos, ~x64-macos
dev-python/twisted: keyword 22.10.0-r3 for ~arm64-macos, ~x64-macos
dev-libs/libsodium: keyword 1.0.18_p20220618
dev-python/backcall: keyword 0.2.0-r1 for ~arm64-macos, ~x64-macos
dev-python/jedi: keyword 0.19.0 for ~arm64-macos, ~x64-macos
dev-python/pickleshare: keyword 0.7.5 for ~arm64-macos, ~x64-macos
dev-python/prompt-toolkit: keyword 3.0.39 for ~arm64-macos, ~x64-macos
dev-python/stack_data: keyword 0.6.2 for ~arm64-macos, ~x64-macos
dev-python/asttokens: keyword 2.2.1 for ~arm64-macos, ~x64-macos
dev-python/executing: keyword 1.2.0 for ~arm64-macos, ~x64-macos
dev-python/pure_eval: keyword 0.2.2 for ~arm64-macos, ~x64-macos
dev-python/wcwidth: keyword 0.2.6 for ~arm64-macos, ~x64-macos
dev-python/parso: keyword 0.8.3-r1 for ~arm64-macos, ~x64-macos

Signed-off-by: Benda Xu <heroxbd@gentoo.org>
MocioF pushed a commit to MocioF/gentoo that referenced this issue Aug 23, 2023
Reference: ipython/ipykernel#712
Reference: ipython/ipykernel#1136

dev-python/ipykernel: keyword 6.25.1-r1 for ~arm64-macos, ~x64-macos
dev-python/comm: keyword 0.1.4 for ~arm64-macos, ~x64-macos
dev-python/ipython: keyword 8.14.0 for ~arm64-macos, ~x64-macos
dev-python/jupyter-client: keyword 8.3.0 for ~arm64-macos, ~x64-macos
dev-python/jupyter-core: keyword 5.3.1 for ~arm64-macos, ~x64-macos
dev-python/matplotlib-inline: keyword 0.1.6 for ~arm64-macos, ~x64-macos
dev-python/nest-asyncio: keyword 1.5.7 for ~arm64-macos, ~x64-macos
dev-python/pyzmq: keyword 25.1.1 for ~arm64-macos, ~x64-macos
dev-python/traitlets: keyword 5.9.0 for ~arm64-macos, ~x64-macos
dev-python/twisted: keyword 22.10.0-r3 for ~arm64-macos, ~x64-macos
dev-libs/libsodium: keyword 1.0.18_p20220618
dev-python/backcall: keyword 0.2.0-r1 for ~arm64-macos, ~x64-macos
dev-python/jedi: keyword 0.19.0 for ~arm64-macos, ~x64-macos
dev-python/pickleshare: keyword 0.7.5 for ~arm64-macos, ~x64-macos
dev-python/prompt-toolkit: keyword 3.0.39 for ~arm64-macos, ~x64-macos
dev-python/stack_data: keyword 0.6.2 for ~arm64-macos, ~x64-macos
dev-python/asttokens: keyword 2.2.1 for ~arm64-macos, ~x64-macos
dev-python/executing: keyword 1.2.0 for ~arm64-macos, ~x64-macos
dev-python/pure_eval: keyword 0.2.2 for ~arm64-macos, ~x64-macos
dev-python/wcwidth: keyword 0.2.6 for ~arm64-macos, ~x64-macos
dev-python/parso: keyword 0.8.3-r1 for ~arm64-macos, ~x64-macos

Signed-off-by: Benda Xu <heroxbd@gentoo.org>
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 a pull request may close this issue.

6 participants