A packaging utility to treat folders as packages
Project description
Packagify
A packaging utility to access folders that aren't suitable to be used as packages, as python packages.
How to use
from packagify import Packagify
package = Packagify("/home/workspace/my_package")
object = package.import_module("module", ["object"])
object1, object2 = package.import_module("module", ["object1", "object2"])
How this works
-
This class overrides the import functionality of python while importing the module.
-
When the package tries to import certain modules from it's directory assuming the script ran from there, we change the level of import from absolute to relative.
-
If a module adds a system path (using sys.path.append) we change the path to reflect the location of the module relative to the location from where we are loading the entire pacakage.
-
-
After importing we revert back the functions to originals so that rest of the importing can work as is
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file packagify-1.2.tar.gz
.
File metadata
- Download URL: packagify-1.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f2d43ed9bc3a8a3208956b396ab73fd21dcfd962e9ab1ab9ee39d87000fa3f0 |
|
MD5 | d9a80528708a3a8fc0ce5f6043aa6d9d |
|
BLAKE2b-256 | 37e0a0aeed371b47a3fa2a77d1e7667f50d879124f60798eefa03af3ff9e87fd |
File details
Details for the file packagify-1.2-py3-none-any.whl
.
File metadata
- Download URL: packagify-1.2-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 841118ea90a82594639ed5bd0148a3670d983c7c9a5aa28a96c0614733669f89 |
|
MD5 | 3c60a2a203381c74057952201290fddf |
|
BLAKE2b-256 | ef13bb7be267b8a2b11c81d47b2006e1c1735e96169c53588418134395296d58 |