Package: threedi-cmd
The 3Di command line clientThe 3Di command line client allows forDefining and running 3Di scenarios from the command line.Assembling different scenarios as a "suite" that will be run in batch.Management commands, for instance to list currently running simulations.Entry pointsThere are different entry points for the 3Di command line client. The main one being$3Di_cmd--help

Usage:3Di_cmd[OPTIONS]COMMAND[ARGS]...

Options:--install-completion[bash|zsh|fish|powershell|pwsh]Installcompletionforthespecifiedshell.--show-completion[bash|zsh|fish|powershell|pwsh]Showcompletionforthespecifiedshell,tocopyitorcustomizetheinstallation.--helpShowthismessageandexit.

Commands:apiInteractwithwiththe3DiAPIliveGetrealtimeupdatesofrunningsimulationsscenariosManageyourlocalscenariosThe output above shows the three sub-commandsapi,liveandscenarios. Those are all commands from
the main client. Whenever you install plugins this list can be appended. You can even append this list yourself
by writing your own plugin! How to go about doing that, explains the plugins section.You can invoke the sub-commands also directly, e.g.$api--help
Usage:api[OPTIONS]COMMAND[ARGS]...

Options:--endpoint[localhost|staging|production][default:production]--install-completion[bash|zsh|fish|powershell|pwsh]Installcompletionforthespecifiedshell.--show-completion[bash|zsh|fish|powershell|pwsh]Showcompletionforthespecifiedshell,tocopyitorcustomizetheinstallation.--helpShowthismessageandexit.

Commands:modelsListavailablethreedimodelsorganisationsListavailableorganisationsresultsDownloadresultsofasimulationrun-scenarioRunascenariosettingsSetdefaultsettingssimulationsListsimulationsDependenciespython >= 3.8Installationpip install --user threedi-cmdPluginsThe 3Di command client has it's own plugin ecosystem. The commands described above are the client core that can
be extended by installing 3Di command client packages into the same environment.An example: You have a virtual environment/home/you/.virtualenvs/3di/bin/pythonand you install the 3Di command client
using pippipinstallthreedi-cmdIf you want to add the statistics commands, you'll install the threedi-cmd-statistics packagepipinstallthreedi-cmd-statisticsNow run3Di_cmd apiagain. Notice thestatisticsandcustomerscommands that has been added to the commands
overview; they have added through the plugin you just installed.Usage:3Di_cmdapi[OPTIONS]COMMAND[ARGS]...Interactwithwiththe3DiAPI

Options:--endpoint[localhost|staging|production][default:production]--helpShowthismessageandexit.

Commands:customersList3DicustomersmodelsListavailablethreedimodelsorganisationsListavailableorganisationsresultsDownloadresultsofasimulationrun-scenarioRunascenariosettingsSetdefaultsettingssimulationsListsimulationsstatistics3DiAPIstatistics,likesessioncountsetcAvailable pluginshttps://github.com/nens/threedi-cmd-statistics/Writing your own pluginThe first thing to know is that the plugin discovering mechanism isbased on a naming convention.
All plugin packages must start withthreedi_cmd_, otherwise the main programme will not be able to discover the
package and add the commands to the client.The commands of the plugin package itself must betyperapps.The threedi-cmd packages ships with two objects that are used to define and register the plugin apps.@dataclassclassAppMeta:app:typer.Typername:strhelp:stradd_to:Optional[str]=""@dataclassclassAppRegistry:apps:Dict[str,AppMeta]So let's say you have an plugin package that is calledthreedi-cmd-queuethat implements a single app calledqueue_app.
You would need to the following for the threedi-cmd client to pick the command up.AppMeta"""threedi_cmd_queue/app_definitions.py"""# these classes are shiped with the threedi-cmd packagefromthreedi_cmd.plugins.modelsimportAppMeta,AppRegistry# import your won appfromthreedi_cmd_queue.commands.appsimportqueue_appqueues_meta=AppMeta(app=queue_app,name="queues",help="3Di API queues",add_to="api")# fill the registry; we use the name "queues" for the registry as wellregistry=AppRegistry(apps={queues_meta.name:queues_meta})Lastly, make sure the registry is available through yourtop level__init__.py. Following our example the
method would reside inthreedi-cmd-queue/threedi_cmd_queue/__init__.py"""Top-level package for threedi_cmd_queue."""fromthreedi_cmd_queue.app_definitionsimportregistryThat's it. Publish your package topypiso that is pip installable.History0.0.20 (2022-10-10)Use threedimodel_id instead of threedimodel on Simulation resource.0.0.19 (2022-10-10)Pop threedimodel from simulation template create request.0.0.18 (2022-10-10)Upgraded scenario runner to use simulation templates.0.0.17 (2022-08-10)Made bumping arrow (dependency) possible.Increase timeout for leakge/rain/sources_sinks file upload 'processed' event.0.0.16 (2022-02-08)Replaced PyPi token0.0.15 (2022-02-08)Bugfix: Don't set `None`` values on threedi-api-client OpenAPI models.0.0.14 (2021-08-11)Bugfix in groundwater initial waterlevel scenario handling.File structure  control scenario support0.0.13 (2021-08-03)Upgraded fromopenapi_clienttothreed_api_client0.0.12 (2021-08-02)Added support for schematisations scenarios0.0.11 (2021-06-15)Changed import paths0.0.10 (2021-06-15)Removed unused imports0.0.9 (2021-05-05)Renamed general settings to physical settings0.0.8 (2021-04-28)Use auth refresh method from upstream package.0.0.7 (2021-04-14)Added settings to scenario-test-framework0.0.6 (2021-03-24)Added leakage and bumped threedi-openapi-client0.0.5 (2021-02-05)Specify arrow version, as newer versions don't work well with 'days' directive in
YAML (arrow is used in jinja2-time).Caches the config per endpoint. This includes a scenario folder option to supply
a custom scenario folder location (per endpoint).0.0.4 (2021-02-04)Fixed saving 'organisation_uuid' and 'result_folder' with theapi settingscommand.First official release candidate as a typer app that introduces a plugin system.0.0.3 (2020-12-21)Fixed settings context if config file is not yet available.0.0.1b (2020-12-18)First (beta) pypi release.