Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom module paths #236

Open
WillTrojak opened this issue Nov 14, 2024 · 2 comments · May be fixed by #251
Open

Custom module paths #236

WillTrojak opened this issue Nov 14, 2024 · 2 comments · May be fixed by #251
Assignees

Comments

@WillTrojak
Copy link
Member

Currently, it seems that the location of custom module is both hard coded and implied by the launch location.

For example, a custom module has to be in a directory called custom_modules within the current working directory.

For example, here:

CUSTOM_MODULES_DIR_NAME = "custom_modules"

# import any custom modules
current_working_dir = os.getcwd()
custom_modules_path = os.path.join(current_working_dir, CUSTOM_MODULES_DIR_NAME)
if os.path.exists(custom_modules_path) and os.path.isdir(custom_modules_path):
# Add 'custom_modules' folder to sys.path
sys.path.append(os.getcwd())
logging.info(f"Found {CUSTOM_MODULES_DIR_NAME}")
importlib.import_module(CUSTOM_MODULES_DIR_NAME)

CUSTOM_MODULES_DIR_NAME = "custom_modules"

I would suggest replacing the hard-cored paths, checking for the path in the following order of precedence:

  • Command-line flag --module-path
  • Environment variable CUSTOM_MODULE_PATH
  • Default to the currently hard-coded path if neither is provided.
@WillTrojak
Copy link
Member Author

@Joao-L-S-Almeida Joao-L-S-Almeida self-assigned this Nov 14, 2024
@romeokienzler
Copy link
Collaborator

thanks @WillTrojak will put it to the sprint list

@Joao-L-S-Almeida Joao-L-S-Almeida linked a pull request Nov 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants