optional_module

TODO: Maybe the approach should be: Use single module proto_kernel (when in runtime_proto) generated out of multiple modules which primer_kernel imports (when in runtime_meta).

Intro

Some functionality from proto_code proto_code may be optional.

Optional functionality is provided via optional modules which are maintained the same way as the main protoprimer.primer_kernel module:

  • during runtime_proto, import goes from a copy

  • during runtime_meta, import goes from the deployed package

For example, eval sub command (see effective_config) is implemented via:

  • proto_config.py module during runtime_proto

  • protoprimer.primer_config module during runtime_meta

CLI support

The argparse configuration can dynamically attempt to import optional modules and either expose or not certain options to user.

Minimal layout

In the case of min layout (see env_layout), it should be optional to deploy a copy of optional modules together with the copy of primer_kernel.

Approach to import

Such optional modules are imported relative to proto_code dir:

  • without running python with a module (still standalone script)

  • without turning proto_code dir into module directory with __init__.py files

  • without modifying sys.path