Add loading of Plugin Models to nbshell command
See original GitHub issueEnvironment
- Python version: N/A
- Nautobot version: 1.0.0b4
Proposed Functionality
Calling nautobot-server nbshell loads all of the builtin models for easy access to start debugging. It would be nice to add loading of the models for registered plugins.
Use Case
I am developing a new plugin, and need to debug an issue that comes up. It would be nice to have access to that model upon entering nbshell
Database Changes
N/A
External Dependencies
N/A
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:8 (6 by maintainers)
 Top Results From Across the Web
Top Results From Across the Web
nbshell plugin model support · Issue #5008 - GitHub
When entering nbshell load plugin models like core models are. Use Case. Loading plugin models would help with debugging plugin development.
Read more >ntc-netbox-plugin-metrics-ext - PyPI
RQ Queues stats; Reports stats; Models count (configurable via configuration.py). Add your own metrics. This plugin supports some options to ...
Read more >Getting Started - Nautobot Documentation
The Nautobot project follows a branching model based on Git-flow. ... Run Nautobot integration tests. loaddata Load data from file. makemigrations Perform ...
Read more >Nautobot Solution Guide: Source of Truth for Network ...
The “nbshell” Management Command. Implemented as a Django management command, this tool provides access to an interactive Python shell with the Nautobot data....
Read more >Posts by Year - NetBox.dev
#9971 - Enable ordering of nested group models by name ... #10716 - Add left/right page plugin content embeds for tag view; #10719...
Read more > Top Related Medium Post
Top Related Medium Post
No results found
 Top Related StackOverflow Question
Top Related StackOverflow Question
No results found
 Troubleshoot Live Code
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
Top Related Reddit Thread
No results found
 Top Related Hackernoon Post
Top Related Hackernoon Post
No results found
 Top Related Tweet
Top Related Tweet
No results found
 Top Related Dev.to Post
Top Related Dev.to Post
No results found
 Top Related Hashnode Post
Top Related Hashnode Post
No results found

Hmmm… I like this idea. There is a better way to do this automatically than re-inventing the wheel ourselves. There is a
shell_pluscommand that comes bundled with thedjango-extensionsplugin that already does this. This isn’t part of core, but it doesn’t matter right now. I’ll show you how to use it while we review whether to extend the core to do it.Example
First, the example. I’ve added
nautobot.extras.tests.dummy_pluginto myPLUGINSsince that comes bundled with Nautobot and provides its ownDummyModel.Observe above this line:
Neat! So how to use it?
How to use
shell_plusInstall
django-extensionsinto your Nautobot environment:Add
django_extensionsto yourEXTRA_INSTALLED_APPSin yournautobot_config.py:Run
nautobot-server shell_plus:Hint: If you also install iPython into your environment,
shell_pluswill automatically pick it up and use it instead:It will also allow you to customize your imports by adding
SHELL_PLUS_IMPORTSto yournautobot_config.py!Cheers!
The code also indicates that name conflicts will be handled automatically by Django as well (the concern from above Issue)