Shared libraries in recipes and notebooks

Registered, Neuron 2022 Posts: 121 ✭✭✭✭✭✭
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?

Answers

  • Alpha Tester, Dataiker Alumni Posts: 539 ✭✭✭✭✭✭✭✭✭
    edited July 2024

    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

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.