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.7.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyrulo-0.2.7.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for pyrulo-0.2.7.tar.gz
Algorithm Hash digest
SHA256 f7f623d705f9c384b4bcfd7a8f2c185ad981d74f657dccd03c05a76fcfd2b6ca
MD5 f014f5acaf5d205320603f396bc5c0ef
BLAKE2b-256 20eb43f586d380525b7aa44bcdc17f1bade3353d7d7203a0c83e491e641a39dd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyrulo-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for pyrulo-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 b44f3d7ef174c84373772b22788414af623c8311b76eab1b76d514a57b596d64
MD5 6fbca847b3c920310718fd6ba151787e
BLAKE2b-256 1a9129848e5f2fae88d0410bdbefe6b6b559d4b592dcc884a3bfe475c7a1ab06

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