Skip to content

keremkoseoglu/vibhaga

Repository files navigation

Vibhaga

Vibhaga is a dynamic module / class inspector for Python. If you want to dynamically load concrete classes derived from an abstract class, this tool can help.

Installation

To install from PYPI:

pip install vibhaga

To install from GitHub:

pip install git+https://github.com/keremkoseoglu/vibhaga.git

Code samples

We'll assume that you want to inspect the following package structure:

  • vibhaga
    • test
      • demo_abstract.py (contains class DemoAbstract)
      • demo_concrete.py (contains class DemoConcrete)
Inspector.get_modules_in_cwd_container(Container(["vibhaga", "test"]))

Returns:

  • demo_abstract (string)
  • demo_concrete (string)
Inspector.get_modules_in_path(path.join(getcwd(), "vibhaga", "test"))

Returns:

  • demo_abstract (string)
  • demo_concrete (string)
Inspector.get_classes_in_cwd_container(Container(["vibhaga", "test"]))

Returns:

  • vibhaga.test.demo_abstract (class)
  • vibhaga.test.demo_concrete (class)
Inspector.get_classes_in_container(Container(["vibhaga", "test"]))

Returns:

  • vibhaga.test.demo_abstract (class)
  • vibhaga.test.demo_concrete (class)

Check vibhaga.test.tester for more details.

Releases

No releases published

Packages

No packages published