Skip to content

import-style prevents vendoring #281

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

Closed
jku opened this issue Oct 7, 2020 · 3 comments
Closed

import-style prevents vendoring #281

jku opened this issue Oct 7, 2020 · 3 comments

Comments

@jku
Copy link
Collaborator

jku commented Oct 7, 2020

The import style used in securesystemslib:
import securesystemslib.module
is incompatible with vendoring (because it would like to modify the import to from my.vendored.path import securesystemslib.module but that is invalid syntax)

Executable failure example:
https://gist.github.com/jku/22d5f08083c8b7b2f3e552f7ca6c301e

This is mostly a "heads-up": I'm exploring solutions in the TUF issue theupdateframework/python-tuf#1165 and will likely suggest whatever solution is found here.

@joshuagl
Copy link
Collaborator

joshuagl commented Oct 8, 2020

#254 proposed one possible solution for this, curious to see what other solutions exist.

@jku
Copy link
Collaborator Author

jku commented Oct 8, 2020

So the option that does not need a massive code change (and lets securesystemslib use the namespacing it now does) is to have a module that imports all the other modules (if this module is init.py it works nicely but I don't think that's a requirement).

Now the other modules can import the common module instead of the individual modules (and we hope python does not go into an eternal import-loop) and old code should function just like before because the namespace securesystemslib.<module> is still defined. I have no idea if this is a crime against package design or not

This can be done with absolute or relative paths btw -- but I guess the issue in #254 would not be fixed without removing the package name from everywhere in the code base... the issues are related but not necessarily solved together

@jku
Copy link
Collaborator Author

jku commented Mar 4, 2021

Fixed in #316 !

@jku jku closed this as completed Mar 4, 2021
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

No branches or pull requests

2 participants