Package: dynacli
DynaCLIDynaCLI (Dynamic CLI) is a cloud-friendly Python library for converting pure Python functions into Linux Shell commands on the fly.It's ideal for automating routine development and administrative tasks in a modern cloud software environment because it supports converting a virtually unlimited set of functions into Shell commands with minimal run-time and maintenance overhead.Unlike other existing solutions such asClickandTyper, there is no need for any function decorators. Further, unlike with all existing solutions, including those built on top of standardargparse, DynaCLI does not build all command parsers upfront, but rather builds dynamically a single command parser based on the command line inputs. When combined with thePython Cloud Importersolution, DynaCLI becomes trulyopenwith regard to a practically unlimited set of commands, all coming directly from cloud storage. This, in turn, eliminates any need for periodic updates on client workstations.At its core, DynaCLI is a Python package structure interpreter which makes any public function executable from the command line.DynaCLI was developed by BST LABS as an open source generic infrastructure foundation for the cloud version of Python run-time within the scope of theCloud AI Operating System (CAIOS)project.For details about the DynaCLI rationale and design considerations, refer toDynaCLI Github Pages.InstallationUse the package managerpipto install DynaCLI from the PyPi site:pip3installdynacliUsageDefine command line interpreter entry pointYou can usedynacli init <CLI name> path=<actual path>command for bootstrapping the entry point file:$cdtutorials/greetings

$dynacliinitsaypath=.
SuccessfullycreatedCLIentrypointsayat/home/ssm-user/OSS/py-dynacli/tutorials/greetingsThe createdsayfile has some comments to change accordingly:#!/usr/bin/env python3"""DynaCLI bootstrap script # Change me"""importosimportsysfromtypingimportFinalfromdynacliimportmaincwd=os.path.dirname(os.path.realpath(__file__))__version__:Final[str]="0.0.0"# Change me to define your own versionsearch_path=[cwd]# Change me if you have different path; you can add multiple search pathessys.path.extend(search_path)# root_packages = ['cli.dev', 'cli.admin'] # Change me if you have predefined root package name# main(search_path, root_packages) # Uncomment if you have root_packages definedmain(search_path)Let's change it:#!/usr/bin/env python3"""Greetings CLI"""importsysimportosfromtypingimportFinalfromdynacliimportmaincwd=os.path.dirname(os.path.realpath(__file__))__version__:Final[str]="1.0"search_path=[cwd]sys.path.extend(search_path)main(search_path)That is it, now we have ready to go CLI.Define commandsEvery public function in your search path will be treated as a command. For example,defhello(*names:str)->None:"""Print Hello <first-name> <last-name> messageArgs:names (str): variable list of names to be included in greetingReturn: None"""print(f"Hello,{' '.join(names)}")Start using CLILet's get the help message:$./say-h
usage:say[-h][-v]{hello}...

GreetingsCLI

positionalarguments:{hello}helloPrintHello<first-name><last-name>message

optionalarguments:-h,--helpshowthishelpmessageandexit-v,--versionshowprogram'sversionnumberandexitWe can get the version as easy as:$./say--version
say-v1.0Now the help about actual command:$./sayhello-h
usage:sayhello[-h][names...]positionalarguments:namesvariablelistofnamestobeincludedingreeting

optionalarguments:-h,--helpshowthishelpmessageandexitFinally we can run the actual command(the hello function in fact) as:$./sayhelloShakoRzayevAsherSterkin
Hello,ShakoRzayevAsherSterkinGo totutorials/greetingsfolder and try it yourself.Read the full documentationDynaCLI Github PagesLicenseMIT License, Copyright (c) 2021-2022 BST LABS. SeeLICENSEfile.