Python runtime loader (pyrulo)
Python library to import classes from script files at runtime.
Installation
pip install pyrulo
Usage
Lets say we have the following scripts
# base.py script
class Base:
pass
# a.py script
from base import Base
class A(Base):
pass
# b.py script
from base import Base
class B(Base):
pass
# c.py script
from base import Base
class C(Base):
pass
We can use pyrulo to retrieve all classes that inherits from Base in a given script path or folder
from base import Base
from pyrulo import class_imports
script_path = "a.py"
folder_path = "."
script_classes = class_imports.import_classes_in_file(script_path, Base) # returns [A]
folder_classes = class_imports.import_classes_in_dir(folder_path, Base) # returns [A, B, C]
Metadata
Release files for pyrulo 0.2.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyrulo-0.2.7.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyrulo-0.2.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.8 kB
Release files / pyrulo-0.2.7.tar.gz
| Download URL | pyrulo-0.2.7.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f7f623d705f9c384b4bcfd7a8f2c185ad981d74f657dccd03c05a76fcfd2b6ca
|
|
BLAKE2b-256 checksum How to use checksums |
20eb43f586d380525b7aa44bcdc17f1bade3353d7d7203a0c83e491e641a39dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|
Release files / pyrulo-0.2.7-py3-none-any.whl
| Download URL | pyrulo-0.2.7-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b44f3d7ef174c84373772b22788414af623c8311b76eab1b76d514a57b596d64
|
|
BLAKE2b-256 checksum How to use checksums |
1a9129848e5f2fae88d0410bdbefe6b6b559d4b592dcc884a3bfe475c7a1ab06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|