Forum Discussion
Intellisense for custom Python packages not working in Fabric notebooks
I have built a very simple Python package to use in my Fabric notebooks. The package is basically just a set of some utility/helper classes. I have searched extensively, and attempted countless different configurations to get intellisense to work within the Fabric notebooks - but everything I have tried has failed.
Goal: Get my custom package's classes and methods to show their docstrings as expected.
I have tried all various types of "official" commenting methods/syntaxes:
```
That didn't work - so I went and looked at Microsoft's own packages (azure-ai-projects for example) - and they follow a different format, so I tried that:
Then I realized that even the azure packages themselves do not render good intellisense inside Fabric notebooks.
I've tried all the normal tricks for how wheel packages are built - no dice.
- If I add my custom wheel package to my custom Spark environment, it doesn't work.
- If I add the wheel package into the notebook's resources files, and then do a %pip install - it doesn't work
- If I just put the code itself directly into the notebook, it does work - but that's useless and defeats the purpose
To be clear, I *am* able to see the definition of the method and the names of the parameters - but I do not see any of the detailed description of the method or the parameters or the classes (i.e. the stuff that is actually helpful to people).
I did make one interesting discovery - and that is the bs4 package (BeautifulSoup) actually renders the rich intellisense content amazingly well.
Has anyone managed to do this successfully?
Hi HoneHealthMB,
We apologize for the inconvenience caused. Please consider raising a Microsoft support ticket for further investigation. You can explain all the troubleshooting steps you have taken to help them better understand the issue.
You can create a Microsoft support ticket with the help of the link below:
https://learn.microsoft.com/en-us/power-bi/support/create-support-ticketIf this helps, please "Accept as solution" and drop a "Kudos" so other members can find it more easily.
Thank you.
13 Replies
- v-ssriganesh
Community Support
Hi HoneHealthMB,
Thank you for reaching out to the Microsoft fabric community forum.
After thoroughly reviewing the details you provided, it seems the core issue is that Pylance (the IntelliSense engine in Fabric notebooks) isnāt rendering the detailed docstrings for your custom package when installed as a wheel, either via a custom Spark environment or notebook resources. The fact that IntelliSense works when the code is directly in the notebook, and that bs4 displays rich IntelliSense, suggests this may be related to how Pylance processes packaged libraries in Fabricās Spark environment.Here are a few suggestions to try:
- Ensure your package includes type hints and possibly type stub files. Pylance relies heavily on these for rich IntelliSense. The success of bs4 likely stems from its well-structured metadata, which you could try to emulate in your package structure.
- As a workaround, you could upload your packageās source files to the notebookās resources folder and add the folder to the Python path. This mimic placing code directly in the notebook and may allow Pylance to display docstrings, though I understand this isnāt ideal for your use case.
- When installing your wheel package (via %pip install or a custom environment), verify that itās correctly installed in the sessionās library path. Restarting the Spark session after installation might help ensure the package is properly loaded.
- Since bs4 works well, analyzing its package structure could provide insights. This might involve looking at its installed files to identify what makes its IntelliSense rendering effective.
For additional guidance on managing Python packages in Fabric notebooks, you may find this official documentation helpful: Using Python Experience on Notebook. It covers package installation and environment setup, which might provide further context.
The fact that even Microsoftās azure-ai-projects package doesnāt render rich IntelliSense suggests this could be a limitation in Fabricās Pylance integration, possibly due to its preview status.
If this information is helpful, please āAccept as solutionā and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.- HoneHealthMB
Advocate I
Thank you for the reply.
I am adding my wheel package to a custom Spark environment in Fabric to avoid our engineers from having to install it on every notebook, etc. If I do this in my notebook:
print(myclass.__doc__)
I see the documentation content just fine.
- HoneHealthMB
Advocate I
Sorry, hit reply too soon...
I have dug deeply into the bs4 code and azure-ai-projects code and I cannot find any differences in how the docstrings are formatted. Since its a wheel package, I do not know any way to force it to include additional help files. I did apply the "zip_safe=False" flag as I thought that might be the issue.
I have discovered that the Fabric notebook UI is at least attempting to load the help/docstring content - because when you hover over a class name or method name, you will see a "Loading.." message appear very briefly right under the popover method name. The trick now is to try and figure out where it is attempting to load it from.
- HoneHealthMB
Advocate I
Can we get one of the fabric devs to chime in on this?
The reality is that many libraries out there have intellisense working just fine. So it isn't a limitation of the tool. Those libraries are all also installed via packages. pandas is an example. bs4 is another example.
The question is very simple: what is the Fabric UI code trying to do when it loads intellisense/docstrings? You can clearly see it doing a little "loading..." thing for a split second - so where is it trying to get that info from?
- v-ssriganesh
Community Support
Hi HoneHealthMB,
Thank you for your follow-up and for pointing out that libraries like pandas and bs4 render IntelliSense well, which shows this isnāt a limitation of Fabricās tools. Your observation of the āLoadingā¦ā message in the UI is a great clue it suggests Pylance is trying to fetch docstring data but not succeeding for your custom wheel package.
The āLoadingā¦ā likely indicates Pylance is querying your packageās metadata or files in the Spark environmentās library path, possibly missing type information (e.g: type stubs or a py.typed file) that pandas and bs4 include. Here are some next steps to try:
- Check if pandas or bs4 include type-related files your package might need to enable rich IntelliSense.
- Ensure your custom Spark environment is configured correctly, as outlined in the Using Python Experience on Notebook page. Restarting the session might help Pylance.
- Temporarily using source files in the notebookās resources folder could confirm if Pylance reads docstrings differently from your wheel package.
If this response helps, consider marking it as āAccept as solutionā and giving a ākudosā to assist other community members.
Thank you.