Skip to content

Remove non-working Jupyter magic.py#1854

Open
rolandwalker wants to merge 1 commit intomainfrom
RW/remove-jupyter-magic-py
Open

Remove non-working Jupyter magic.py#1854
rolandwalker wants to merge 1 commit intomainfrom
RW/remove-jupyter-magic-py

Conversation

@rolandwalker
Copy link
Copy Markdown
Contributor

Description

This file has not been touched substantively in a few years, is not documented, and no longer works.

If these missing dependencies are added to pyproject.toml:

  • ipython-sql
  • sql

Then the user can do the following in a notebook/console started from the mycli repo root:

In [1]: %load_ext sql
In [2]: %load_ext mycli.magic
In [3]: %sql mysql+pymysql://mycli:password@localhost:3306/mysql

However, upon executing a query with the magic

In [4]: %mycli show tables

we find that magic.py has

mycli: MyCli = conn._mycli

but mycli has long since been refactored, such that

AttributeError: 'Connection' object has no attribute '_mycli'

and it throws similarly for

 u = conn.session.engine.url

Given that this is not working, not maintained, and not documented, we should be comfortable deleting it without a deprecation cycle.

In the future, if this functionality is desired, it should probably be implemented in a separate library which takes mycli as a dependency. That way it could be more discoverable on PyPi, and could declare additional dependencies needed only in the notebook context.

Side note: this file was not covered by tests, and removing it brings the repo to 100% coverage.

Checklist

  • I added this contribution to the changelog.md file.
  • I added my name to the AUTHORS file (or it's already there).
  • To lint and format the code, I ran
    uv run ruff check && uv run ruff format && uv run mypy --install-types .

@rolandwalker rolandwalker self-assigned this Apr 18, 2026
This file has not been touched substantively in a few years, is not
documented, and no longer works.

If these missing dependencies are added to pyproject.toml:

 * ipython-sql
 * sql

Then the user can do the following in a notebook/console started from
the mycli repo root:

    In [1]: %load_ext sql
    In [2]: %load_ext mycli.magic
    In [3]: %sql mysql+pymysql://mycli:password@localhost:3306/mysql

However, upon executing a query with the magic

    In [4]: %mycli show tables

we find that magic.py has

    mycli: MyCli = conn._mycli

but mycli has long since been refactored, such that

    AttributeError: 'Connection' object has no attribute '_mycli'

and it throws similarly for

     u = conn.session.engine.url

Given that this is not working, not maintained, and not documented, we
should be comfortable deleting it without a deprecation cycle.

In the future, if this functionality is desired, it should probably be
implemented in a separate library which takes mycli as a dependency.
That way it could be more discoverable on PyPi, and could declare
additional dependencies needed only in the notebook context.
@rolandwalker rolandwalker force-pushed the RW/remove-jupyter-magic-py branch from d0b3ee1 to 2af0ecf Compare April 18, 2026 18:36
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.

2 participants