(self, packages: VersionDict)
return set(to_install)
Ensures that the given packages are installed.

        Returns the list of all packages that were installed.

        The argument maps package names to the minimum version. This is morally
        equivalent to a plain `npm install --save`, except it's faster in the
        case where all the packages are already installed.
Ensures that the given packages are installed.
Ensures that the given packages are installed .
def _ensure_packages(self, packages: VersionDict) -> Set[str]:
        """Ensures that the given packages are installed.

        Returns the list of all packages that were installed.

        The argument maps package names to the minimum version. This is morally
        equivalent to a plain `npm install --save`, except it's faster in the
        case where all the packages are already installed.
        """
        to_install = {}
        for name, required_version in packages.items():
            installed = self._installed_version(name, location=self.install_location)
            if not (installed and installed >= required_version):
                to_install[name] = required_version
        if not to_install:
            return set()

        self._npm_install(to_install)
        return set(to_install)
def _ensure_packages ( self , packages : VersionDict ) -> Set [ str ] : to_install = { } for name , required_version in packages . items ( ) : installed = self . _installed_version ( name , location = self . install_location ) if not ( installed and installed >= required_version ) : to_install [ name ] = required_version if not to_install : return set ( ) self . _npm_install ( to_install ) return set ( to_install )