MCPcopy Create free account
hub / github.com/dwavesystems/dwave-cloud-client / install

Function install

dwave/cloud/cli.py:807–848  ·  view source on GitHub ↗

Install optional non-open-source Ocean packages.

(list_all, install_all, update_all, accept_license, verbose, packages)

Source from the content-addressed store, hash-verified

805 help='Increase output verbosity (additive, up to 4 times)')
806@click.argument('packages', nargs=-1)
807def install(list_all, install_all, update_all, accept_license, verbose, packages):
808 """Install optional non-open-source Ocean packages."""
809
810 contrib = get_contrib_packages()
811
812 if list_all:
813 if verbose:
814 # ~YAML output
815 for pkg, specs in contrib.items():
816 click.echo("Package: {}".format(pkg))
817 click.echo(" Title: {}".format(specs['title']))
818 click.echo(" Description: {}".format(specs['description']))
819 click.echo(" License: {}".format(specs['license']['name']))
820 click.echo(" License-URL: {}".format(specs['license']['url']))
821 click.echo(" Requires: {}".format(', '.join(specs['requirements'])))
822 click.echo()
823 else:
824 # concise list of available packages
825 if contrib:
826 click.echo("Available packages: {}.".format(', '.join(contrib.keys())))
827 else:
828 click.echo("No available packages.")
829 return
830
831 if install_all:
832 packages = list(contrib)
833
834 if update_all:
835 packages = list(filter(_contrib_package_maybe_installed, contrib))
836
837 if not packages:
838 click.echo('Nothing to do. Try "dwave install --help".')
839 return
840
841 # check all packages requested are registered/available
842 for pkg in packages:
843 if pkg not in contrib:
844 click.echo("Package {!r} not found.".format(pkg))
845 return 1
846
847 for pkg in packages:
848 _install_contrib_package(pkg, verbose=verbose, prompt=not accept_license)
849
850
851def _contrib_package_maybe_installed(name: str) -> bool:

Callers

nothing calls this directly

Calls 3

get_contrib_packagesFunction · 0.90
_install_contrib_packageFunction · 0.85
formatMethod · 0.45

Tested by

no test coverage detected