Skip to main content

Python package to import modules at runtime.

Project description

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]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrulo-0.2.6.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

pyrulo-0.2.6-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file pyrulo-0.2.6.tar.gz.

File metadata

  • Download URL: pyrulo-0.2.6.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pyrulo-0.2.6.tar.gz
Algorithm Hash digest
SHA256 9e03261c646f72d35e1d5cf7572f4b1ec30d301a39858e0196e57aa4cc35092f
MD5 b98393fd294eeecadb036d9e80402610
BLAKE2b-256 ef9e331d064b8584230f77336839b1fb4a2a15c0f7c3a726ea637293f12d49b8

See more details on using hashes here.

File details

Details for the file pyrulo-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: pyrulo-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pyrulo-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d3186608cd9e13bbb82df5e726ed96ca0f17643f440820ffbd46796ced0d3ba5
MD5 8d04a35f408c1ab3246f4405d9b25390
BLAKE2b-256 91f4a92181dff4a371184de0f2c56494d966dc7f1172507a44785be0c417d636

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page