Skip to content

PR: ipython magic command to rename tab from the console (status: dirty)#25936

Open
hprodh wants to merge 1 commit intospyder-ide:masterfrom
hprodh:rename_tab_magics
Open

PR: ipython magic command to rename tab from the console (status: dirty)#25936
hprodh wants to merge 1 commit intospyder-ide:masterfrom
hprodh:rename_tab_magics

Conversation

@hprodh
Copy link
Copy Markdown
Contributor

@hprodh hprodh commented Apr 10, 2026

Description of Changes

A small code modification adding a magic command %rename_tab.
Demo_rename_tabs.webm

There were 2 choices to be done :

  • (First) There are magics commands registered in several places in spyder, I chose to register the new rename_tab in spyder/external-deps/spyder-kernels/spyder_kernels/customize/code_runner.py (alongside runfile, debugfile, profilefile, runcell, ...), simply because it did not need to create a signal and it felt simpler.
    I think it is possible to homogeneize it with the other methods especially regarding the local scope (and the @needs_local_scope decorator maybe ?). (Actually, I have a feeling I did not put it in the right place, possibly it should belong alongside %clear, %edit, etc... but I struggled figuring out the whole Ipython console <-> spyder widget pipeline...)
  • (Second) (much easier) : ipython magics sends the line before it is evaluated, I chose to emulate prior evaluation with the local scope to avoid surprising results regarding the effective tab names generated.

There are some glitches regarding the tab name suffixes '/A' auto-generated, I do not consider it a major concern, yet it might need to be confirmed it is not an issue.

To be clarified

Were the added declarations in the right place ?
Can we make the automatic tab name suffixes more stable ?

Issue(s) Resolved

Provides alternative solutions to #22132 and #17415

Affirmation

By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.

I certify the above statement is true and correct:
hprodh

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.

1 participant