Search code examples
ipythonjupyter-lab

Dynamic auto-completion in JupyterLab


Can objects implement any magic function that Jupyter uses for field and getitem auto completion on that object? Or can I register a hook with the Jupyter Python kernel to do it? Would be very useful for ORMs, dynamically generated namespaces, dataframes, etc.


Solution

  • Yes, depends on whether you need attributes (then use the standard __dir__) or keys (then implement _ipython_key_completions_).