def install_transformers(self):
        """Deprecated: Installs the latest version of the Gretel Transformers package

        Prefer ``install_packages`` instead.
        """
        logger.warning(
            "The method, install_transformers is deprecated. Please use install_packages instead."
        )
        pkg.install_packages(self.api_key, self.host)
    def install_packages(self, verbose: bool = False, version: str = "latest"):
        """Installs the latest version of the Gretel Transformers package

        Args:
            verbose: Will print all package installation messages.
            version: Eg: ``1.1.0``. Determines package version to install. Specifying
            "latest" will ensure the latest version of the package is installed.
        """
        pkg.install_packages(
            api_key=self.api_key,
            host=self.host,
            verbose=verbose,
            version=version,
        )
示例#3
0
def test_does_install_packages(popen, get_package):
    popen.return_value = ProcessResponse()
    get_package.return_value = OptResponse(status_code=200)
    pkg_installers.install_packages("test123", "api-dev.gretel.cloud")

    assert popen.call_args[0][0][-4:] == [
        "pip",
        "--disable-pip-version-check",
        "install",
        "https://path/to/package.whl",
    ]

    get_package.assert_called_with(
        "https://api-dev.gretel.cloud/opt/pkg/gretel-helpers",
        headers={"Authorization": "test123"},
        params={'version': 'latest'}
    )
示例#4
0
def test_handles_api_down(get_package):
    get_package.return_value = OptResponse(status_code=500)

    with pytest.raises(pkg_installers.GretelInstallError):
        pkg_installers.install_packages("test123", "api-dev")
示例#5
0
def test_requires_api_key():
    with pytest.raises(TypeError):
        pkg_installers.install_packages()  # type: ignore