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

Improve dynamic libraries loading #17

Open
B3QL opened this issue Dec 21, 2022 · 6 comments
Open

Improve dynamic libraries loading #17

B3QL opened this issue Dec 21, 2022 · 6 comments

Comments

@B3QL
Copy link

B3QL commented Dec 21, 2022

Currently lexactivator is using __file__ variable for path resolution (see: https://github.com/cryptlex/lexactivator-python/blob/master/cryptlex/lexactivator/lexactivator_native.py#L47)
The problem with that approach is that the code assumes it will have access to the file system which is not always true.

From Python 3.8, ResourceReader and importlib.resources are recommended ways of accessing package resources that enables interoprability across the Python ecosystem with projects like https://github.com/indygreg/PyOxidizer.

A more in-depth description of various loading mechanisms is available here

@adnan-kamili
Copy link
Contributor

Thanks for the suggestion, we will look into this.

@B3QL
Copy link
Author

B3QL commented Feb 15, 2023

@adnan-kamili what is the current status? Can you share a rough ETA?

@adnan-kamili
Copy link
Contributor

The problem with that approach is that the code assumes it will have access to the file system which is not always true.

In the case of LexActivator, it has to be true as it stores data on disk and also accesses a few files on the disk for its proper functioning.

@B3QL
Copy link
Author

B3QL commented Feb 16, 2023

That's totally true, but Python tries to abstract that by using importlib.resources API.
In the current state, it's impossible to integrate your client safely with the PyOxidizer project, which allows to "binarize" Python applications.
By safely I mean storing Python wrapper around C libraries in binary itself, because if it's stored in filesystem it is possible to temper the wrapper and return fake data without ever calling C libs.

@adnan-kamili
Copy link
Contributor

Ok, that makes sense. Would it be possible for you to submit a pull request?

@B3QL
Copy link
Author

B3QL commented Feb 16, 2023

I tried to come up with some solution but without a success. I can give it a shot next time I'll be working on licensing area, but it won't be soon.

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