labgrid-project / labgrid-project/labgrid

Imports in imported files only work in the toplevel directory

Open
#421 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug enhancement
Dominant language
Python
Stars
528
Forks
278
Avg merge
2d 19h
Merged PRs (30d)
4

Description

Files imported in the imports statement can not import other files which are also used in import statements if they are not in the same directory as the yaml file.
This is due to how sys.path works, It only points to the directory of the yaml file.
Approaches for fixes:

  • Detect directories in the imports statement and add them to sys.path
  • figure out why the import statement does not use sys.modules for resolution and fix it

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the YAML file processes its imports statement and how imported files are resolved through sys.path and sys.modules. Compare the proposed directory-detection and module-resolution approaches, then verify that nested imports work when files are in different directories.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.