Skip to content

Commit

Permalink
feat(build): organise use poetry and organise modules
Browse files Browse the repository at this point in the history
  • Loading branch information
totallyzen committed Jan 3, 2024
1 parent 6ee98a3 commit 3e1f138
Show file tree
Hide file tree
Showing 103 changed files with 3,246 additions and 565 deletions.
12 changes: 0 additions & 12 deletions .coveragerc

This file was deleted.

41 changes: 20 additions & 21 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
/arangodb @nshine
/azurite @pffijt
/clickhouse @yakimka
/modules/arangodb @nshine
/modules/azurite @pffijt
/modules/clickhouse @yakimka
# /compose
# /core
/elasticsearch @nivm @daTokenizer
/google @tillahoffmann
/kafka @ash1425
/keycloak @timbmg
/localstack @ImFlog
# /meta
/minio @maltehedderich
/mongodb @dabrign
# /mssql
# /mysql
/neo4j @eastlondoner
# /nginx
/opensearch @maltehedderich
# /oracle
# /postgres
/rabbitmq @KerstenBreuer
/redis @daTokenizer
# /selenium
/modules/elasticsearch @nivm @daTokenizer
/modules/google @tillahoffmann
/modules/kafka @ash1425
/modules/keycloak @timbmg
/modules/localstack @ImFlog
/modules/minio @maltehedderich
/modules/mongodb @dabrign
# /modules/mssql
# /modules/mysql
/modules/neo4j @eastlondoner
# /modules/nginx
/modules/opensearch @maltehedderich
# /modules/oracle
# /modules/postgres
/modules/rabbitmq @KerstenBreuer
/modules/redis @daTokenizer
# /modules/selenium
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
PYTHON_VERSIONS = 3.7 3.8 3.9 3.10 3.11
PYTHON_VERSIONS = 3.9 3.10 3.11
PYTHON_VERSION ?= 3.10
IMAGE = testcontainers-python:${PYTHON_VERSION}
RUN = docker run --rm -it
# Get all directories that contain a setup.py and get the directory name.
PACKAGES = $(subst /,,$(dir $(wildcard */setup.py)))
PACKAGES = core $(dir $(wildcard modules/*/README.rst))

# All */dist folders for each of the packages.
DISTRIBUTIONS = $(addsuffix /dist,${PACKAGES})
Expand All @@ -25,12 +25,12 @@ ${DISTRIBUTIONS} : %/dist : %/setup.py
# Targets to run the test suite for each package.
tests : ${TESTS}
${TESTS} : %/tests :
pytest -svx --cov-report=term-missing --cov=testcontainers.$* --tb=short --strict-markers $*/tests
poetry run pytest -v --cov=testcontainers.$* $*/tests

# Targets to lint the code.
lint : ${LINT}
${LINT} : %/lint :
flake8 $*
poetry run flake8 $*

# Targets to publish packages.
upload : ${UPLOAD}
Expand All @@ -54,13 +54,13 @@ ${TESTS_DIND} : %/tests-dind : image

# Target to build the documentation
docs :
sphinx-build -nW . docs/_build
poetry run sphinx-build -nW . docs/_build

doctest : ${DOCTESTS}
sphinx-build -b doctest . docs/_build
poetry run sphinx-build -b doctest . docs/_build

${DOCTESTS} : %/doctest :
sphinx-build -b doctest -c doctests $* docs/_build
poetry run sphinx-build -b doctest -c doctests $* docs/_build

# Remove any generated files.
clean :
Expand Down
18 changes: 0 additions & 18 deletions arangodb/setup.py

This file was deleted.

18 changes: 0 additions & 18 deletions azurite/setup.py

This file was deleted.

18 changes: 0 additions & 18 deletions clickhouse/setup.py

This file was deleted.

298 changes: 298 additions & 0 deletions core/poetry.lock

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions core/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[tool.poetry]
name = "testcontainers-core"
version = "4.0.0" # x-release-please-version
description = "Essential components of testcontainers-python."
authors = ["Sergey Pirogov <[email protected]>"]
maintainers = [
"Balint Bartha <[email protected]>",
"David Ankin <[email protected]>"
]
readme = "README.rst"
keywords = ["testing", "logging", "docker", "test automation"]
classifiers = [
"License :: OSI Approved :: Apache Software License",
"Intended Audience :: Information Technology",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Software Development :: Libraries :: Python Modules",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: Unix",
"Operating System :: MacOS",
]
packages = [{ include = "testcontainers" }]

[tool.poetry.dependencies]
python = ">=3.9,<3.12"
docker = ">=4.0"
urllib3 = "<2.0"
wrapt = "^1.16.0"
19 changes: 0 additions & 19 deletions core/setup.py

This file was deleted.

11 changes: 6 additions & 5 deletions core/testcontainers/core/container.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from docker.models.containers import Container
import os
from typing import Iterable, Optional, Tuple

from .waiting_utils import wait_container_is_ready
from .docker_client import DockerClient
from .exceptions import ContainerStartException
from .utils import setup_logger, inside_container, is_arm
from docker.models.containers import Container

from testcontainers.core.docker_client import DockerClient
from testcontainers.core.exceptions import ContainerStartException
from testcontainers.core.utils import setup_logger, inside_container, is_arm
from testcontainers.core.waiting_utils import wait_container_is_ready

logger = setup_logger(__name__)

Expand Down
10 changes: 5 additions & 5 deletions core/testcontainers/core/docker_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
# License for the specific language governing permissions and limitations
# under the License.
import atexit
import docker
from docker.errors import NotFound
from docker.models.containers import Container, ContainerCollection
import functools as ft
import os
from typing import List, Optional, Union
import urllib
from typing import List, Optional, Union

from .utils import default_gateway_ip, inside_container, setup_logger
import docker
from docker.errors import NotFound
from docker.models.containers import Container, ContainerCollection

from .utils import default_gateway_ip, inside_container, setup_logger

LOGGER = setup_logger(__name__)

Expand Down
8 changes: 4 additions & 4 deletions core/testcontainers/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
# under the License.
from typing import Optional

from .container import DockerContainer
from .exceptions import ContainerStartException
from .utils import raise_for_deprecated_parameter
from .waiting_utils import wait_container_is_ready
from testcontainers.core.container import DockerContainer
from testcontainers.core.exceptions import ContainerStartException
from testcontainers.core.utils import raise_for_deprecated_parameter
from testcontainers.core.waiting_utils import wait_container_is_ready

ADDITIONAL_TRANSIENT_ERRORS = []
try:
Expand Down
4 changes: 2 additions & 2 deletions core/testcontainers/core/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import logging
import os
import platform
import sys
import subprocess
import logging
import sys

LINUX = "linux"
MAC = "mac"
Expand Down
10 changes: 5 additions & 5 deletions core/testcontainers/core/waiting_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
import time
import traceback
from typing import Any, Callable, Iterable, Mapping, Optional, TYPE_CHECKING, Union

import wrapt

from . import config
from .utils import setup_logger
from testcontainers.core import config
from testcontainers.core.utils import setup_logger

if TYPE_CHECKING:
from .container import DockerContainer
from testcontainers.core.container import DockerContainer

logger = setup_logger(__name__)


# Get a tuple of transient exceptions for which we'll retry. Other exceptions will be raised.
TRANSIENT_EXCEPTIONS = (TimeoutError, ConnectionError)

Expand All @@ -46,7 +46,7 @@ def wait_container_is_ready(*transient_exceptions) -> Callable:

@wrapt.decorator
def wrapper(wrapped: Callable, instance: Any, args: Iterable, kwargs: Mapping) -> Any:
from .container import DockerContainer
from testcontainers.core.container import DockerContainer

if isinstance(instance, DockerContainer):
logger.info("Waiting for container %s with image %s to be ready ...",
Expand Down
1 change: 1 addition & 0 deletions core/tests/test_docker_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from unittest.mock import MagicMock, patch
import docker

from testcontainers.core.docker_client import DockerClient
from testcontainers.core.container import DockerContainer

Expand Down
17 changes: 0 additions & 17 deletions elasticsearch/setup.py

This file was deleted.

18 changes: 0 additions & 18 deletions google/setup.py

This file was deleted.

19 changes: 0 additions & 19 deletions k3s/setup.py

This file was deleted.

18 changes: 0 additions & 18 deletions kafka/setup.py

This file was deleted.

Loading

0 comments on commit 3e1f138

Please sign in to comment.