New custom magic commands do not work
See original GitHub issueHi all,
I was starting to create some magic commands for jupyterlab-requirements extenstion for dependency management following: https://ipython.readthedocs.io/en/stable/config/custommagics.html
I added the new class in https://github.com/thoth-station/jupyterlab-requirements/blob/master/jupyterlab_requirements/__init__.py in local environment for testing:
from IPython.core.magic import magics_class, Magics
from IPython.core.magic import line_magic # Called with %
from IPython.core.magic import cell_magic # Called with %%
from IPython.core.magic import line_cell_magic # Called with % or %%
@magics_class
class HorusMagics(Magics):
"""Horus jupyterlab-requirements CLI as magic commands."""
@line_magic
def abra(self, line):
return line
@cell_magic
def show(self, line, cell):
return line, cell
After starting jupyter lab
and testing the command in a notebook, I get:
Issue Analytics
- State:
- Created 2 years ago
- Comments:16 (6 by maintainers)
Top Results From Across the Web
Custom magic in ipython notebooks - Code does not execute
I am relatively new to ipython magics and want to run some code and at the same time add it to a list...
Read more >Defining custom magics — IPython 8.7.0 documentation
Defining custom magics¶. There are two main ways to define your own magic functions: from standalone functions and by inheriting from a base...
Read more >Enhance kernels with magic commands - Amazon EMR
EMR Studio and EMR Notebooks support magic commands, which are enhancements provided by the IPython kernel to help run and analyze data.
Read more >1.4. Creating an IPython extension with custom magic ...
Defining a new line magic is particularly simple. First, we create a function that accepts the contents of the line (except the initial...
Read more >Defining custom magics — IPython 3.2.1 documentation
There are two main ways to define your own magic functions: from standalone functions and by ... it does not require IPython #...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you a lot @MrMino for all help and support!! 🚀 🥇
@pacospace Cool!
If you don’t mind, I’m going to close this issue then.