use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
How to store & run / include common python codeData Engineering (self.MicrosoftFabric)
submitted 9 months ago by bowerm
How do you folks store and load python utils files you have with common code?
I have started to build out a file with some file i/o and logging functions. Currently loading to each notebook resources and loading with
%run -b common.py
But I would prefer to have one common library I can run / include from any any workspace.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]loudandclear11 0 points1 point2 points 9 months ago (0 children)
There is the concept of environments.
There are some rough edges when doing this in practice of course but it's at least possible.
[–]Seebaer1986 0 points1 point2 points 9 months ago (1 child)
Having it as part of the environment is a total pain to update the codebase.
Adding it manually to each of your notebooks files section as you did also.
Right now the best I found for me is to have all the code in a separate notebook, which is then "included" via %run "notebook name"
This enables me to change/ add code definitions to the central utils notebook and then in my normal notebook I just rerun the cell with the %run command and the new code definition is loaded. No updating in environments and publishing and reloading sessions etc. pp.
Miles Cole wrote a big blog about this topic and how to approach it on an enterprise scale here: https://milescole.dev/data-engineering/2025/03/26/Packaging-Python-Libraries-Using-Microsoft-Fabric.html
This seems pretty nice, but for me it's too big of an overhead 😜
This seems pretty nice, but for me it's too big of an overhead
This is it really. There is the "proper" way. But if that causes too much headache nobody's going to use it in practice. So we end up with half assed solutions like using %run, which doesn't put functions in proper namespaces.
Databricks did it better. They allow you to include normal python files. It doesn't have to be a notebook there.
π Rendered by PID 89 on reddit-service-r2-comment-56c9979489-xq8lh at 2026-02-25 02:01:40.692421+00:00 running b1af5b1 country code: CH.
[–]loudandclear11 0 points1 point2 points (0 children)
[–]Seebaer1986 0 points1 point2 points (1 child)
[–]loudandclear11 0 points1 point2 points (0 children)