Skip to content

Commit

Permalink
[main < T279] Turn Docker into an optional dependency (#279)
Browse files Browse the repository at this point in the history
* Turn Docker into an optional dependency

* Fix lock file (use --no-update)

* Fix black formatting
  • Loading branch information
antepusic authored Sep 21, 2023
1 parent ee90efe commit d5c61f8
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 104 deletions.
12 changes: 8 additions & 4 deletions gqlalchemy/instance_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@
from enum import Enum
from typing import Any, Dict, Union

import docker
try:
import docker
except ModuleNotFoundError:
docker = None
import psutil

from gqlalchemy.exceptions import (
GQLAlchemyWaitForConnectionError,
GQLAlchemyWaitForDockerError,
GQLAlchemyWaitForPortError,
raise_if_not_imported,
)
from gqlalchemy.vendors.memgraph import Memgraph

Expand Down Expand Up @@ -85,9 +89,7 @@ def wait_for_port(
delay *= backoff


def wait_for_docker_container(
container: "docker.Container", delay: float = 0.01, timeout: float = 5.0, backoff: int = 2
) -> None:
def wait_for_docker_container(container, delay: float = 0.01, timeout: float = 5.0, backoff: int = 2) -> None:
"""Wait for a Docker container to enter the status `running`.
Args:
Expand Down Expand Up @@ -239,6 +241,8 @@ class MemgraphInstanceDocker(MemgraphInstance):
def __init__(
self, docker_image: DockerImage = DockerImage.MEMGRAPH, docker_image_tag: str = DOCKER_IMAGE_TAG_LATEST, **data
) -> None:
raise_if_not_imported(dependency=docker, dependency_name="docker")

super().__init__(**data)
self.docker_image = docker_image
self.docker_image_tag = docker_image_tag
Expand Down
Loading

0 comments on commit d5c61f8

Please sign in to comment.