Skip to content

Commit 8c560ca

Browse files
authored
Merge branch 'main' into feat/with-env-kwargs
2 parents e4ab159 + ff6a32d commit 8c560ca

File tree

192 files changed

+12524
-253
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+12524
-253
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "4.10.0"
2+
".": "4.11.0"
33
}

.github/workflows/ci-core.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contrinuous Integration for the core package
1+
# Continuous Integration for the core package
22

33
name: core
44

@@ -25,6 +25,8 @@ jobs:
2525
run: poetry install --all-extras
2626
- name: Run twine check
2727
run: poetry build && poetry run twine check dist/*.tar.gz
28+
- name: Set up Docker
29+
uses: docker/setup-docker-action@v4
2830
- name: Run tests
2931
run: make core/tests
3032
- name: Rename coverage file

.github/workflows/ci-lint.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,9 @@ jobs:
2020
- name: Install Python dependencies
2121
run: poetry install --no-interaction
2222
- name: Execute pre-commit handler
23-
run: poetry run pre-commit run -a
23+
run: |
24+
poetry run pre-commit run check-toml
25+
poetry run pre-commit run trailing-whitespace
26+
poetry run pre-commit run end-of-file-fixer
27+
poetry run pre-commit run ruff
28+
poetry run pre-commit run ruff-format

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,6 @@ venv
7272
.python-version
7373
.env
7474
.github-token
75+
76+
# docs build
77+
site/

.pre-commit-config.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ repos:
1010
- id: end-of-file-fixer
1111

1212
- repo: https://github.com/astral-sh/ruff-pre-commit
13-
rev: 'v0.3.5'
13+
rev: 'v0.11.5'
1414
hooks:
1515
- id: ruff
1616
# Explicitly setting config to prevent Ruff from using `pyproject.toml` in sub packages.
1717
args: [ '--fix', '--exit-non-zero-on-fix', '--config', 'pyproject.toml' ]
1818
- id: ruff-format
1919
args: [ '--config', 'pyproject.toml' ]
2020

21-
# - repo: local
22-
# hooks:
23-
# - id: mypy
24-
# name: mypy
25-
# entry: poetry run mypy
26-
# args: ["--config-file", "pyproject.toml"]
27-
# files: "core" # start with the core being type checked
28-
# language: system
29-
# types: [ python ]
30-
# require_serial: true
21+
- repo: local
22+
hooks:
23+
- id: mypy
24+
name: mypy
25+
entry: poetry run mypy
26+
args: ["--config-file", "pyproject.toml"]
27+
files: "core" # start with the core being type checked
28+
language: system
29+
types: [ python ]
30+
require_serial: true

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
# Changelog
22

3+
## [4.11.0](https://github.com/testcontainers/testcontainers-python/compare/testcontainers-v4.10.0...testcontainers-v4.11.0) (2025-06-15)
4+
5+
6+
### Features
7+
8+
* **core:** Protocol support for container port bind and expose ([#690](https://github.com/testcontainers/testcontainers-python/issues/690)) ([a0d4317](https://github.com/testcontainers/testcontainers-python/commit/a0d4317643005dde4f344eccbfc56c062e83bf05))
9+
* DockerContainer initializer to accept its private members as kwargs ([#809](https://github.com/testcontainers/testcontainers-python/issues/809)) ([e7feb53](https://github.com/testcontainers/testcontainers-python/commit/e7feb53fe532b6d32d5d0c5a5d517249f8e7de50))
10+
11+
12+
### Bug Fixes
13+
14+
* **compose:** use provided docker command instead of default ([#785](https://github.com/testcontainers/testcontainers-python/issues/785)) ([0ae704a](https://github.com/testcontainers/testcontainers-python/commit/0ae704a24de440b715d5f3c11eaa4f18ccd437b5))
15+
* **core:** Add kwargs to image build ([#708](https://github.com/testcontainers/testcontainers-python/issues/708)) ([cc02f94](https://github.com/testcontainers/testcontainers-python/commit/cc02f9444b41efa62836b21210b07aee1da94d0b))
16+
* **core:** change with_command type to include list of strings ([#789](https://github.com/testcontainers/testcontainers-python/issues/789)) ([f7c29cb](https://github.com/testcontainers/testcontainers-python/commit/f7c29cb913e4d42d535783c3aa0f3566d4e543bf))
17+
* **core:** Determine docker socket for rootless docker ([#779](https://github.com/testcontainers/testcontainers-python/issues/779)) ([6817582](https://github.com/testcontainers/testcontainers-python/commit/6817582bf67ed36448b69019ab897c50ae80e7e1))
18+
* **core:** Typing in docker_client ([#702](https://github.com/testcontainers/testcontainers-python/issues/702)) ([e8bf224](https://github.com/testcontainers/testcontainers-python/commit/e8bf2244c7210e31b34e5fecf2602fdd1b8c0834))
19+
* **core:** Typing in generic + network ([#700](https://github.com/testcontainers/testcontainers-python/issues/700)) ([2061912](https://github.com/testcontainers/testcontainers-python/commit/2061912e67705be801136f349f372f542a1f262f))
20+
* **core:** Typing in version ([#701](https://github.com/testcontainers/testcontainers-python/issues/701)) ([9dc2a02](https://github.com/testcontainers/testcontainers-python/commit/9dc2a02ca9b9ffbaacfd7de79ec9f78175758ec0))
21+
* **core:** wait in test core registry ([#812](https://github.com/testcontainers/testcontainers-python/issues/812)) ([b574c0e](https://github.com/testcontainers/testcontainers-python/commit/b574c0e0a11d57c8c56aef448292f8c2fc233078))
22+
* **modules:** fix cosmosdb failure ([#827](https://github.com/testcontainers/testcontainers-python/issues/827)) ([dafcbed](https://github.com/testcontainers/testcontainers-python/commit/dafcbed7608e857bebcdd0b4638bec27abadc693))
23+
* **modules:** update chroma version ([#826](https://github.com/testcontainers/testcontainers-python/issues/826)) ([b7d41dd](https://github.com/testcontainers/testcontainers-python/commit/b7d41ddc5742dd380b6e01c712a02b044a64cbb3))
24+
* **rabbitmq:** correct pika pypi reference ([#817](https://github.com/testcontainers/testcontainers-python/issues/817)) ([e90d308](https://github.com/testcontainers/testcontainers-python/commit/e90d30826fb7d7cf3cc7db39a86465d448aaa6e0))
25+
* **registry:** module typed ([#811](https://github.com/testcontainers/testcontainers-python/issues/811)) ([6b11268](https://github.com/testcontainers/testcontainers-python/commit/6b1126884c82529a93bd55030374d322dd0870bc))
26+
* use connection mode override function in config ([#775](https://github.com/testcontainers/testcontainers-python/issues/775)) ([ab2a1ab](https://github.com/testcontainers/testcontainers-python/commit/ab2a1abd957ffb35719f673a7674df83287f1545)), closes [#774](https://github.com/testcontainers/testcontainers-python/issues/774)
27+
328
## [4.10.0](https://github.com/testcontainers/testcontainers-python/compare/testcontainers-v4.9.2...testcontainers-v4.10.0) (2025-04-02)
429

530

Dockerfile.docs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM python:3.11-slim
2+
3+
RUN pip install poetry
4+
5+
WORKDIR /docs

Makefile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ coverage: ## Target to combine and report coverage.
3131
lint: ## Lint all files in the project, which we also run in pre-commit
3232
poetry run pre-commit run -a
3333

34+
mypy-core-report:
35+
poetry run mypy --config-file pyproject.toml core | poetry run python scripts/mypy_report.py
36+
3437
docs: ## Build the docs for the project
3538
poetry run sphinx-build -nW . docs/_build
3639

@@ -65,3 +68,39 @@ clean-all: clean ## Remove all generated files and reset the local virtual envir
6568
.PHONY: help
6669
help: ## Display command usage
6770
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
71+
72+
## --------------------------------------
73+
74+
DOCS_CONTAINER=mkdocs-container
75+
DOCS_IMAGE=mkdocs-poetry
76+
DOCS_DOCKERFILE := Dockerfile.docs
77+
78+
.PHONY: clean-docs
79+
clean-docs:
80+
@echo "Destroying docs"
81+
@if docker ps -a --format '{{.Names}}' | grep -q '^$(DOCS_CONTAINER)$$'; then \
82+
docker rm -f $(DOCS_CONTAINER); \
83+
fi
84+
@if docker images -q $(DOCS_IMAGE) | grep -q .; then \
85+
docker rmi $(DOCS_IMAGE); \
86+
fi
87+
88+
.PHONY: docs-ensure-image
89+
docs-ensure-image:
90+
@if [ -z "$$(docker images -q $(DOCS_IMAGE))" ]; then \
91+
docker build -f $(DOCS_DOCKERFILE) -t $(DOCS_IMAGE) . ; \
92+
fi
93+
94+
.PHONY: serve-docs
95+
serve-docs: docs-ensure-image
96+
docker run --rm --name $(DOCS_CONTAINER) -it -p 8000:8000 \
97+
-v $(PWD):/testcontainers-go \
98+
-w /testcontainers-go \
99+
$(DOCS_IMAGE) bash -c "\
100+
cd docs && poetry install --no-root && \
101+
poetry run mkdocs serve -f ../mkdocs.yml -a 0.0.0.0:8000"
102+
103+
# Needed if dependencies are added to the docs site
104+
.PHONY: export-docs-deps
105+
export-docs-deps:
106+
cd docs && poetry export --without-hashes --output requirements.txt

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,20 @@ See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for more details.
4141

4242
## Configuration
4343

44+
You can set environment variables to configure the library behaviour:
45+
4446
| Env Variable | Example | Description |
4547
| --------------------------------------- | --------------------------- | ---------------------------------------------------------------------------------- |
4648
| `TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE` | `/var/run/docker.sock` | Path to Docker's socket used by ryuk |
4749
| `TESTCONTAINERS_RYUK_PRIVILEGED` | `false` | Run ryuk as a privileged container |
4850
| `TESTCONTAINERS_RYUK_DISABLED` | `false` | Disable ryuk |
4951
| `RYUK_CONTAINER_IMAGE` | `testcontainers/ryuk:0.8.1` | Custom image for ryuk |
5052
| `RYUK_RECONNECTION_TIMEOUT` | `10s` | Reconnection timeout for Ryuk TCP socket before Ryuk reaps all dangling containers |
53+
54+
Alternatively you can set the configuration during runtime:
55+
56+
```python
57+
from testcontainers.core import testcontainers_config
58+
59+
testcontainers_config.ryuk_docker_socket = "/home/user/docker.sock"
60+
```

conf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,9 @@
161161
intersphinx_mapping = {
162162
"python": ("https://docs.python.org/3", None),
163163
"selenium": ("https://seleniumhq.github.io/selenium/docs/api/py/", None),
164+
"typing_extensions": ("https://typing-extensions.readthedocs.io/en/latest/", None),
164165
}
166+
167+
nitpick_ignore = [
168+
("py:class", "typing_extensions.Self"),
169+
]

0 commit comments

Comments
 (0)