labgrid-project / labgrid

Embedded systems control library for development, testing and installation
https://labgrid.readthedocs.io/
Other
327 stars 164 forks source link

Absolute paths #1381

Closed sjg20 closed 4 months ago

sjg20 commented 4 months ago

Why does labgrid use relative paths for imports? When using code inside and outside labgrid, it requires transformation.

Would it not be easier to use absolute imports everywhere?

Emantor commented 4 months ago

Relative paths are used since the imports key is usually used to import files for the local test definition which should live in the same repository. Our usecase for this is usually a customer and board specific strategy for the target hardware. For global additions to labgrid I would recommend not using the imports key and rather use your own python module installed into the same virtualenv.

sjg20 commented 4 months ago

@Emantor What is the 'import key'? I had thought that Python encourages absolute imports. I have tended to uses absolute imports in my own Python programs and have not hit any problems with that

Emantor commented 4 months ago

The device configuration YAML contains an imports key which can be a list of python files that are imported before target creation.