Skip to content

Add new_magic.rst: guide for creating custom magics#351

Merged
blink1073 merged 1 commit intoCalysto:mainfrom
blink1073:new-magic-doc
Mar 9, 2026
Merged

Add new_magic.rst: guide for creating custom magics#351
blink1073 merged 1 commit intoCalysto:mainfrom
blink1073:new-magic-doc

Conversation

@blink1073
Copy link
Copy Markdown
Contributor

@blink1073 blink1073 commented Mar 9, 2026

Summary

Fixes #282

  • Adds docs/source/new_magic.rst addressing possible / how to define a new magic ? #282 — documents how to write, install, and distribute custom magics for any MetaKernel-based kernel
  • Covers line/cell magic authoring, the @option decorator, user-local install (~/.ipython/metakernel/magics/), %install_magic, bundling with a kernel package, output helpers, docstring conventions, and IPython compatibility
  • Links the new page from docs/index.rst
  • Adds test_local_magics_dir_loaded to verify that magics placed in ~/.ipython/metakernel/magics/ are discovered at kernel startup

Test plan

  • just test tests/test_metakernel.py::test_local_magics_dir_loaded passes
  • just docs builds without warnings

Addresses Calysto#282 by documenting how to write, install, and distribute
custom magics for MetaKernel kernels (line/cell magics, @option,
user-local install, %install_magic, IPython compatibility). Adds a
test verifying that magics in ~/.ipython/metakernel/magics/ are
discovered at kernel startup.
@blink1073 blink1073 enabled auto-merge (squash) March 9, 2026 14:25
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.88%. Comparing base (3e230e3) to head (ab7edff).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #351   +/-   ##
=======================================
  Coverage   90.88%   90.88%           
=======================================
  Files          51       51           
  Lines        2854     2854           
  Branches      396      396           
=======================================
  Hits         2594     2594           
  Misses        181      181           
  Partials       79       79           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@blink1073 blink1073 merged commit cfb8f28 into Calysto:main Mar 9, 2026
28 checks passed
@blink1073 blink1073 deleted the new-magic-doc branch March 9, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

possible / how to define a new magic ?

2 participants