Submit your innovative use case or inspiring success story to the 2023 Dataiku Frontrunner Awards! LET'S GO

Shared libraries in recipes and notebooks

tomas
Shared libraries in recipes and notebooks
Is it possible to use a project level shared python library and global shared library with the same name in a python recipe/notebook.

How does DSS resolves different versions of the same function?
0 Kudos
1 Reply
Alex_Combessie
Dataiker Alumni

Hi,



If you create a project-level python library with the same name as a global-level python library, the global-level will be used. Hence it is best to have different names for python files and/or directory structure at project-level and global-level.



Since you can have a directory structure in these libraries, you can define your own submodule structure to customize the name resolution. For instance, you can create a directory named "global_lib" inside the global python-lib directory. You could then advise users to put all global-level library files inside the former directory. Then from a Python notebook inside a project, they would reference the global module with:




from global_lib.foo import bar


Cheers,



Alex

0 Kudos

Labels

?
Labels (3)
A banner prompting to get Dataiku