Mentions légales du service

Skip to content

Allow to Import from Server Folder

Lucas Meyer requested to merge allow_import_in_server into develop

This MR addresses the following situation:

The server implemented by the use is complex enough it has to be split in different files. This is expected to improve readability and separation of the code. As an example this occurs with the MP-PDE example (https://gitlab.inria.fr/melissa/melissa-combined/-/merge_requests/66), where some functions are taken directly from the original source code with their inherent complexity. To avoid having the server.py file containing too many lines, one can import the necessary functions from the local folder.

Having the file structure:

  • experiment
    • server.py
    • utils.py
    • config.json

With the content of server.py being: from utils import foo

The current implementation doesn't allow such situation. Because the importlib will not find utils. This is, by the way, also occurring because we import the server code within the melissa launcher, and not the other way: importing the launcher in the user script. The present MR allows to import user files from the server with minimal changes to the current way of doing the imports.

Edited by Lucas Meyer

Merge request reports