# testcontainers/testcontainers-python

Testcontainers is a Python library that providing a friendly API to run Docker container. It is designed to create runtime environment to use during your automatic tests.

Repository: https://github.com/testcontainers/testcontainers-python
Canonical: https://ross.abutalabs.com/products/testcontainers-python
Homepage: https://testcontainers-python.readthedocs.io/en/latest/
Language: Python
License: Apache-2.0
License Family: permissive
Topics: python, python3, testing, testcontainers, selenium, database
Last push: 2026-08-26T03:56:50+00:00

## Health v2 (maintenance only)
Score: 93/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 82, longevity 100
- inputs: {"age_days": 3451, "days_push": 7, "days_rel": 40, "gap_med": 37, "n_releases_24m": 20}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2279, forks 380 (observed 2026-08-28T04:06:33.736942+00:00)

## What it is
Testcontainers for Python is a library providing a friendly API to spin up Docker containers (databases, browsers, etc.) as runtime environments for automated functional and integration tests. It manages container lifecycle with context managers and offers convenience helpers like connection URL generation.

## Use cases
- spin up a throwaway postgres database for integration tests
- run selenium browser tests in a docker container
- test against real databases instead of mocks in pytest
- create isolated runtime environments for automated tests
- start and stop docker containers programmatically in python

## When to choose
- you need realistic integration tests against real services like databases or message brokers
- you want ephemeral, disposable test environments managed from Python code
- you're already using Docker in your CI pipeline

## When to avoid
- your tests can run against in-memory fakes or mocks without needing real services
- Docker is unavailable in your test environment
- you need to test against services on remote hosts rather than local containers

## Facets
- artifact type: library
- maturity: active
- function: testing, e2e-testing, container-runtime, database
- domain: testing, developer-tools, databases
- platform: python, cross-platform
- tags: integration-testing, docker-containers, test-fixtures, selenium, functional-testing, devops, docker

## Member repositories
- testcontainers/testcontainers-python (main) score 93

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:33.736942+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:41:24.126617+00:00, confidence not recorded.
  - readme: https://github.com/testcontainers/testcontainers-python (fetched 2026-08-28T04:06:33.736942+00:00, sha 1a5aeab778c1)
- Data as of 2026-08-30T08:39:29.467469+00:00.
