rail.core.introspection module
- class rail.core.introspection.RailEnv
Bases:
objectSingleton class that manages introspection into the RAIL installation
This will idenfity all of the installed RAIL packages, namespaces and files, and navigate the connections between them.
This will also generate restructed text (.rst) files for the Sphinx autodoc documentation
- classmethod attach_stages(to_module, silent=False)
Attach all the available stages to this module
- Parameters:
to_module (ModuleType) – python module we are attaching stages to
silent (bool)
- Return type:
None
Notes
This allow you to do:
from rail.stages import *
- classmethod build_rail_namespace_tree()
Build a tree of the namespaces and packages in rail
- Returns:
Tree of the namespaces and packages in rail
- Return type:
dict[str, list[dict]]
- classmethod do_api_rst(basedir='.')
Build the top-level API documentation
- Parameters:
basedir (str) – Directory to write file to
- Return type:
None
- classmethod do_module_api_str(basedir, key, options)
Build the api rst file for a rail module
- Parameters:
basedir (str) – Directory to write file to
key (str) – Name of the rail module
options (str) – Pre-formatted autodoc options
- Return type:
None
- classmethod do_namespace_api_rst(basedir, key, val)
Build the api rst file for a rail namespace
- Parameters:
basedir (str) – Directory to write file to
key (str) – Name of the rail namespace
val (dict) – Namespace tree for the namespace
- Return type:
None
- classmethod do_pkg_api_rst(basedir, key, val, options, module_options)
Build the api rst file for a rail package
- Parameters:
basedir (str) – Directory to write file to
key (str) – Name of the rail package
val (dict) – Namespace tree for the package
options (str) – Pre-formatted autodoc options for the package
module_options (str) – Pre-formatted autodoc options for modules
- Return type:
None
- classmethod do_stage_type_api_rst(basedir='.')
Genarate the rst files for the stage tpye documentation
- Parameters:
basedir (str)
- Return type:
None
- classmethod import_all_packages(silent=False)
Import all the packages that are available in the RAIL ecosystem
- Parameters:
silent (bool)
- Return type:
None
- classmethod list_rail_modules()
List all modules within rail
- Returns:
Dict mapping module names to their import paths
- Return type:
dict[str, str]
- classmethod list_rail_namespaces()
List all the namespaces within rail
- Returns:
Dict mapping the namespaces to the paths contributing to each namespace
- Return type:
dict[str, list[str]]
- classmethod list_rail_packages()
List all the packages that are available in the RAIL ecosystem
- Returns:
Dict mapping the package names to the path to the package
- Return type:
dict[str,str]
- classmethod pretty_print_tree(the_dict=None, indent='')
Utility function to help print the namespace tree
This can be called recurisvely to walk the tree structure, which has nested dicts
- Parameters:
the_dict (dict | None) – Current dictionary to print, if None it will print cls._tree
indent (str) – Indentation string prepended to each line
- Return type:
None
- classmethod print_rail_modules()
Print all the moduels that are available in the RAIL ecosystem
- Return type:
None
- classmethod print_rail_namespace_tree()
Print the namespace tree in a nice way
- Return type:
None
- classmethod print_rail_namespaces()
Print all the namespaces that are available in the RAIL ecosystem
- Return type:
None
- classmethod print_rail_packages()
Print all the packages that are available in the RAIL ecosystem
- Return type:
None
- classmethod print_rail_stage_dict()
Print an dict of all the RailSages organized by their base class
- Return type:
None