returnn.import_.common

Some global configurations

exception returnn.import_.common.InvalidVersion[source]

The version string is invalid.

exception returnn.import_.common.MissingExplicitImport[source]

Corresponding import_ call missing.

returnn.import_.common.package_path()[source]
Returns:

directory where packages are stored (default: ~/returnn/pkg)

Return type:

str

returnn.import_.common.setup_py_pkg(mod_globals)[source]

This will get called to prepare any custom setup for the package.

Parameters:

mod_globals (dict[str]) – globals() in the package

returnn.import_.common.module_name(repo, repo_path, path, version, make_ready=True)[source]
Parameters:
  • repo (str) – e.g. “github.com/rwth-i6/returnn-experiments”

  • repo_path (str) – what get_repo_path returns, e.g. “/home/az/returnn/pkg/…@v…”

  • path (str) – path to file in repo. can be arbitrary (empty) with make_ready=False

  • version (str|None) – e.g. “20211231-0123abcd0123”. None for development working copy. ignored with make_ready=False. just used for reporting.

  • make_ready (bool) – if True, we make sure that importing this module works

Returns:

module name

Return type:

str

Note on the internals:

We could have dynamically loaded the module directly from the package path, in some way. The reason we choose this different approach to create a real directory with symlinks is such that we can potentially make use of auto-completion features in editors. It might also make debugging easier. So, in this function, we make sure that all symlinks are correctly setup.