Metadata-Version: 2.4
Name: testcontainers
Version: 4.15.0rc3
Summary: Python library for throwaway instances of anything that can run in a Docker container
Project-URL: Homepage, https://github.com/testcontainers/testcontainers-python
Project-URL: Repository, https://github.com/testcontainers/testcontainers-python
Project-URL: Issue Tracker, https://github.com/testcontainers/testcontainers-python/issues
Author-email: Sergey Pirogov <automationremarks@gmail.com>
Maintainer-email: Balint Bartha <totallyzen@users.noreply.github.com>, David Ankin <daveankin@gmail.com>, Vemund Santi <vemund@santi.no>
License-Expression: Apache-2.0
License-File: LICENSE.txt
Keywords: docker,logging,test automation,testing
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Operating System :: Unix
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: docker
Requires-Dist: python-dotenv
Requires-Dist: typing-extensions
Requires-Dist: urllib3
Requires-Dist: wrapt
Provides-Extra: arangodb
Requires-Dist: python-arango>=8; extra == 'arangodb'
Provides-Extra: aws
Requires-Dist: boto3>=1; extra == 'aws'
Requires-Dist: httpx; extra == 'aws'
Provides-Extra: azurite
Requires-Dist: azure-storage-blob>=12; extra == 'azurite'
Provides-Extra: cassandra
Provides-Extra: chroma
Requires-Dist: chromadb-client>=1; extra == 'chroma'
Provides-Extra: clickhouse
Requires-Dist: clickhouse-driver; extra == 'clickhouse'
Provides-Extra: cockroachdb
Provides-Extra: cosmosdb
Requires-Dist: azure-cosmos>=4; extra == 'cosmosdb'
Provides-Extra: db2
Requires-Dist: ibm-db-sa; (platform_machine != 'aarch64' and platform_machine != 'arm64') and extra == 'db2'
Requires-Dist: sqlalchemy>=2; extra == 'db2'
Provides-Extra: elasticsearch
Provides-Extra: generic
Requires-Dist: httpx; extra == 'generic'
Requires-Dist: redis>=7; extra == 'generic'
Requires-Dist: sqlalchemy; extra == 'generic'
Provides-Extra: google
Requires-Dist: google-cloud-datastore>=2; extra == 'google'
Requires-Dist: google-cloud-pubsub>=2; extra == 'google'
Provides-Extra: influxdb
Requires-Dist: influxdb-client>=1; extra == 'influxdb'
Requires-Dist: influxdb>=5; extra == 'influxdb'
Provides-Extra: k3s
Requires-Dist: kubernetes; extra == 'k3s'
Requires-Dist: pyyaml>=6.0.3; extra == 'k3s'
Provides-Extra: kafka
Provides-Extra: keycloak
Requires-Dist: python-keycloak>=6; (python_version < '4.0') and extra == 'keycloak'
Provides-Extra: localstack
Requires-Dist: boto3>=1; extra == 'localstack'
Provides-Extra: mailpit
Requires-Dist: cryptography; extra == 'mailpit'
Provides-Extra: memcached
Provides-Extra: milvus
Provides-Extra: minio
Requires-Dist: minio>=7; extra == 'minio'
Provides-Extra: mongodb
Requires-Dist: pymongo>=4; extra == 'mongodb'
Provides-Extra: mqtt
Provides-Extra: mssql
Requires-Dist: pymssql>=2; extra == 'mssql'
Requires-Dist: sqlalchemy>=2; extra == 'mssql'
Provides-Extra: mysql
Requires-Dist: pymysql[rsa]>=1; extra == 'mysql'
Requires-Dist: sqlalchemy>=2; extra == 'mysql'
Provides-Extra: nats
Requires-Dist: nats-py>=2; extra == 'nats'
Provides-Extra: neo4j
Requires-Dist: neo4j>=6; extra == 'neo4j'
Provides-Extra: nginx
Provides-Extra: ollama
Provides-Extra: openfga
Requires-Dist: openfga-sdk; extra == 'openfga'
Provides-Extra: opensearch
Requires-Dist: opensearch-py>=3; (python_version < '4.0') and extra == 'opensearch'
Provides-Extra: oracle
Requires-Dist: oracledb>=3; extra == 'oracle'
Requires-Dist: sqlalchemy>=2; extra == 'oracle'
Provides-Extra: oracle-free
Requires-Dist: oracledb>=3; extra == 'oracle-free'
Requires-Dist: sqlalchemy>=2; extra == 'oracle-free'
Provides-Extra: postgres
Provides-Extra: qdrant
Requires-Dist: qdrant-client>=1; extra == 'qdrant'
Provides-Extra: rabbitmq
Requires-Dist: pika>=1; extra == 'rabbitmq'
Provides-Extra: redis
Requires-Dist: redis>=7; extra == 'redis'
Provides-Extra: registry
Requires-Dist: bcrypt>=5; extra == 'registry'
Provides-Extra: scylla
Requires-Dist: cassandra-driver>=3; (python_version < '3.14') and extra == 'scylla'
Provides-Extra: selenium
Requires-Dist: selenium>=4; extra == 'selenium'
Provides-Extra: sftp
Requires-Dist: cryptography; extra == 'sftp'
Provides-Extra: test-module-import
Requires-Dist: httpx; extra == 'test-module-import'
Provides-Extra: trino
Requires-Dist: trino; extra == 'trino'
Provides-Extra: valkey
Provides-Extra: vault
Provides-Extra: weaviate
Requires-Dist: weaviate-client>=4; extra == 'weaviate'
Description-Content-Type: text/markdown

[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
![PyPI - Version](https://img.shields.io/pypi/v/testcontainers)
[![PyPI - License](https://img.shields.io/pypi/l/testcontainers.svg)](https://github.com/testcontainers/testcontainers-python/blob/main/LICENSE)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/testcontainers.svg)](https://pypi.python.org/pypi/testcontainers)
[![codecov](https://codecov.io/gh/testcontainers/testcontainers-python/branch/master/graph/badge.svg)](https://codecov.io/gh/testcontainers/testcontainers-python)
![Core Tests](https://github.com/testcontainers/testcontainers-python/actions/workflows/ci-core.yml/badge.svg)
![Community Tests](https://github.com/testcontainers/testcontainers-python/actions/workflows/ci-community.yml/badge.svg)
[![Docs](https://readthedocs.org/projects/testcontainers-python/badge/?version=latest)](http://testcontainers-python.readthedocs.io/en/latest/?badge=latest)

[![Codespace](https://github.com/codespaces/badge.svg)](https://codespaces.new/testcontainers/testcontainers-python)

# Testcontainers Python

`testcontainers-python` facilitates the use of Docker containers for functional and integration testing.

For more information, see [the docs][readthedocs].

[readthedocs]: https://testcontainers-python.readthedocs.io/en/latest/

## Getting Started

```pycon
>>> from testcontainers.postgres import PostgresContainer
>>> import sqlalchemy

>>> with PostgresContainer("postgres:16") as postgres:
...     engine = sqlalchemy.create_engine(postgres.get_connection_url())
...     with engine.begin() as connection:
...         result = connection.execute(sqlalchemy.text("select version()"))
...         version, = result.fetchone()
>>> version
'PostgreSQL 16...'
```

The snippet above will spin up a postgres database in a container. The `get_connection_url()` convenience method returns a `sqlalchemy` compatible url we use to connect to the database and retrieve the database version.

## Contributing / Development / Release

See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for more details.

## Configuration

You can set environment variables to configure the library behaviour:

| Env Variable                            | Example                     | Description                                                                        |
| --------------------------------------- | --------------------------- | ---------------------------------------------------------------------------------- |
| `TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE` | `/var/run/docker.sock`      | Path to Docker's socket used by ryuk                                               |
| `TESTCONTAINERS_RYUK_PRIVILEGED`        | `false`                     | Run ryuk as a privileged container                                                 |
| `TESTCONTAINERS_RYUK_DISABLED`          | `false`                     | Disable ryuk                                                                       |
| `RYUK_CONTAINER_IMAGE`                  | `testcontainers/ryuk:0.8.1` | Custom image for ryuk                                                              |
| `RYUK_RECONNECTION_TIMEOUT`             | `10s`                       | Reconnection timeout for Ryuk TCP socket before Ryuk reaps all dangling containers |

Alternatively you can set the configuration during runtime:

```python
from testcontainers.core import testcontainers_config

testcontainers_config.ryuk_docker_socket = "/home/user/docker.sock"
```
