You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just like packages in the delphin.codecs namespace become available for the delphin convert command, we could allow namespace packages to register subcommands for the delphin command-line interface. One way of doing this is to crawl all top-level packages and look for some metadata, similar to how the codecs work. But this would slow down command invocation because all modules would need to be imported. If backward compatibility weren't an issue, we could make delphin.commands into a namespace package and just look for modules in that directory, but then existing imports (like from delphin.commands import mkprof; mkprof(...)) would not work as mkprof would need to be a module and modules are not callable. Instead we could make a new namespace like delphin.cli.
It would work like this:
delphin.main crawls modules in delphin.cli
if one of these modules contains the appropriate code, a subcommand is created for it
The "appropriate code" could be some metadata that delphin.main uses to construct the subcommand, or some function like register() that takes the top-level argument parser and adds the subcommand itself.
The text was updated successfully, but these errors were encountered:
Just like packages in the
delphin.codecs
namespace become available for thedelphin convert
command, we could allow namespace packages to register subcommands for thedelphin
command-line interface. One way of doing this is to crawl all top-level packages and look for some metadata, similar to how the codecs work. But this would slow down command invocation because all modules would need to be imported. If backward compatibility weren't an issue, we could makedelphin.commands
into a namespace package and just look for modules in that directory, but then existing imports (likefrom delphin.commands import mkprof; mkprof(...)
) would not work asmkprof
would need to be a module and modules are not callable. Instead we could make a new namespace likedelphin.cli
.It would work like this:
delphin.main
crawls modules indelphin.cli
The "appropriate code" could be some metadata that
delphin.main
uses to construct the subcommand, or some function likeregister()
that takes the top-level argument parser and adds the subcommand itself.The text was updated successfully, but these errors were encountered: