Skip to content

Commit 66d5460

Browse files
committed
Merge remote-tracking branch 'github/main'
2 parents 89aeb69 + e1e3d13 commit 66d5460

File tree

79 files changed

+2769
-280
lines changed

Some content is hidden

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

79 files changed

+2769
-280
lines changed

.github/.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "4.6.0"
2+
".": "4.7.2"
33
}

.github/CONTRIBUTING.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Contributing to `testcontainers-python`
2+
3+
Welcome to the `testcontainers-python` community!
4+
This should give you an idea about how we build, test and release `testcontainers-python`!
5+
6+
Highly recommended to read this document thoroughly to understand what we're working on right now
7+
and what our priorities are before you are trying to contribute something.
8+
9+
This will greatly increase your chances of getting prompt replies as the maintainers are volunteers themselves.
10+
11+
## Before you Begin
12+
13+
We recommend following these steps:
14+
15+
1. Finish reading this document.
16+
2. Read the [recently updated issues][1]
17+
3. Look for existing issues on the subject you are interested in - we do our best to label everything correctly
18+
19+
20+
## Local Development
21+
22+
### Pre-Requisites
23+
24+
You need to have the following tools available to you:
25+
- `make` - You'll need a GNU Make for common developer activities
26+
- `poetry` - This is the primary package manager for the project
27+
- `pyenv` **Recommended**: For installing python versions for your system.
28+
Poetry infers the current latest version from what it can find on the `PATH` so you are still fine if you don't use `pyenv`.
29+
30+
### Build and test
31+
32+
33+
- Run `make install` to get `poetry` to install all dependencies and set up `pre-commit`
34+
- **Recommended**: Run `make` or `make help` to see other commands available to you.
35+
- After this, you should have a working virtual environment and proceed with writing code with your favourite IDE
36+
- **TIP**: You can run `make core/tests` or `make module/<my-module>/tests` to run the tests specifically for that to speed up feedback cycles
37+
- You can also run `make lint` to run the `pre-commit` for the entire codebase.
38+
39+
40+
## Adding new containers
41+
42+
We have an [issue template](.github/ISSUE_TEMPLATE/new-container.md) for adding new containers, please refer to that for more information.
43+
Once you've talked to the maintainers (we do our best to reply!) then you can proceed with contributing the new container.
44+
45+
> [!WARNING]
46+
> PLease raise an issue before you try to contribute a new container! It helps maintainers understand your use-case and motivation.
47+
> This way we can keep pull requests foruced on the "how", not the "why"! :pray:
48+
> It also gives maintainers a chance to give you last-minute guidance on caveats or expectations, particularly with
49+
> new extra dependencies and how to manage them.
50+
51+
52+
## Raising Issues
53+
54+
We have [Issue Templates][2] to cover most cases, please try to adhere to them, they will guide you through the process.
55+
Try to look through the existing issues before you raise a new one.
56+
57+
58+
## Releasing Versions
59+
60+
We have automated Semantic Versioning and release via [release-please](workflows/release-please.yml).
61+
This takes care of:
62+
- Detecting the next version, based on the commits that landed on `main`
63+
- When a Release PR has been merged
64+
- Create a GitHub Release with the CHANGELOG included
65+
- Update the [CHANGELOG](../CHANGELOG.md), similar to the GitHub Release
66+
- Release to PyPI via a [trusted publisher](https://docs.pypi.org/trusted-publishers/using-a-publisher/)
67+
- Automatically script updates in files where it's needed instead of hand-crafting it (i.e. in `pyproject.toml`)
68+
69+
> [!CRITICAL]
70+
> Community modules are supported on a best-effort basis and for maintenance reasons, any change to them
71+
> is only covered under minor and patch changes.
72+
>
73+
> Community modules changes DO NOT contribute to major version changes!
74+
>
75+
> If your community module container was broken by a minor or patch version change, check out the change logs!
76+
77+
# Thank you!
78+
79+
Thanks for reading, feedback on documentation is always welcome!
80+
81+
[1]: https://github.com/testcontainers/testcontainers-python/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc "Recently Updated Issues showing you what we're focusing on"
82+
[2]: https://github.com/testcontainers/testcontainers-python/issues/new/choose "List of current issue templates, please use them"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: New Container
3+
about: Tell the Testcontainers-Python team about a container you'd like to have support for.
4+
title: 'New Container: '
5+
labels: '🚀 enhancement'
6+
assignees: ''
7+
8+
---
9+
10+
<!-- feel free to remove any irrelevant section(s) below -->
11+
12+
**What is the new container you'd like to have?**
13+
14+
Please link some docker containers as well as documentation/arguments to the benefits of having this container.
15+
16+
**Why not just use a generic container for this?**
17+
18+
Please describe why the `DockerContainer("my-image:latest")` approach is not useful enough.
19+
20+
Having a dedicated `TestContainer` usually means the need for some or all of these:
21+
- complicated setup/configuration
22+
- the wait strategy is complex for the container, usually more than just an http wait
23+
24+
**Other references:**
25+
26+
Include any other relevant reading material about the enhancement.

.github/ISSUE_TEMPLATE/question.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,33 @@ assignees: ''
99

1010
<!-- feel free to remove any irrelevant section(s) below -->
1111

12-
**What are you trying to do?**
12+
## What are you trying to do?
1313

1414
Ask your question here
1515

16-
**Where are you trying to do it?**
16+
## Where are you trying to do it?
1717

1818
Provide a self-contained code snippet that illustrates the bug or unexpected behavior.
1919
Ideally, include a link to a public repository with a minimal project where someone from the
2020
testcontainers-python can submit a PR with a solution to the problem you are facing with the library.
2121

22-
**Runtime environment**
22+
## Runtime environment
2323

24-
Provide a summary of your runtime environment. Which operating system, python version, and docker version are you using? What is the version of `testcontainers-python` you are using? You can run the following commands to get the relevant information.
24+
Provide a summary of your runtime environment. Which operating system, python version, and docker version are you using?
25+
What is the version of `testcontainers-python` you are using? You can run the following commands to get the relevant information.
26+
27+
Paste the results of the bash below
28+
29+
```bash
30+
uname -a
31+
echo "------"
32+
docker info
33+
echo "------"
34+
poetry run python --version
35+
echo "------"
36+
poetry show --tree
37+
```
2538

2639
```bash
27-
# Get the operating system information (on a unix os).
28-
$ uname -a
29-
# Get the python version.
30-
$ python --version
31-
# Get the docker version and other docker information.
32-
$ docker info
33-
# Get all python packages.
34-
$ pip freeze
40+
paste-me-here
3541
```
Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,44 @@
1-
You have implemented a new container and would like to contribute it? Great! Here are the necessary steps.
2-
3-
- [ ] Create a new feature directory and populate it with the package structure [described in the documentation](https://testcontainers-python.readthedocs.io/en/latest/#package-structure). Copying one of the existing features is likely the best way to get started.
4-
- [ ] Implement the new feature (typically in `__init__.py`) and corresponding tests.
5-
- [ ] Update the feature `README.rst` and add it to the table of contents (`toctree` directive) in the top-level `README.rst`.
6-
- [ ] Add a line `[feature name]` to the list of components in the GitHub Action workflow in `.github/workflows/main.yml` to run tests, build, and publish your package when pushed to the `main` branch.
7-
- [ ] Rebase your development branch on `main` (or merge `main` into your development branch).
8-
- [ ] Add a line `-e file:[feature name]` to `requirements.in` and open a pull request. Opening a pull request will automatically generate lock files to ensure reproducible builds (see the [pip-tools documentation](https://pip-tools.readthedocs.io/en/latest/) for details). Finally, run `python get_requirements.py --pr=[your PR number]` to fetch the updated requirement files (the build needs to have succeeded).
1+
# New Container
2+
3+
<!-- You have implemented a new container and would like to contribute it? Great! Here are the necessary checklist steps. -->
4+
5+
Fixes ...
6+
7+
<!--
8+
Please do not raise a PR for new container without having raised an issue first.
9+
It helps reduce unnecessary work for you and the maintainers!
10+
-->
11+
12+
13+
# PR Checklist
14+
15+
- [ ] Your PR title follows the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) syntax
16+
as we make use of this for detecting Semantic Versioning changes.
17+
- Additions to the community modules do not contribute to SemVer scheme:
18+
all community features will be tagged [community-feat](https://github.com/testcontainers/testcontainers-python/issues?q=label%3Acommunity-feat+),
19+
but we do not want to release minor or major versions due to features or breaking changes outside of core.
20+
So please use `fix(postgres):` or `fix(my_new_vector_db):` if you want to add or modify community modules.
21+
This may change in the future if we have a separate package released with community modules.
22+
- [ ] Your PR allows maintainers to edit your branch, this will speed up resolving minor issues!
23+
- [ ] The new container is implemented under `modules/*`
24+
- Your module follows [PEP 420](https://peps.python.org/pep-0420/) with implicit namespace packages
25+
(if unsure, look at other existing community modules)
26+
- Your package namespacing follows `testcontainers.<modulename>.*`
27+
and you DO NOT have an `__init__.py` above your module's level.
28+
- Your module has its own tests under `modules/*/tests`
29+
- Your module has a `README.rst` and hooks in the `.. auto-class` and `.. title` of your container
30+
- Implement the new feature (typically in `__init__.py`) and corresponding tests.
31+
- [ ] Your module is added in `pyproject.toml`
32+
- it is declared under `tool.poetry.packages` - see other community modules
33+
- it is declared under `tool.poetry.extras` with the same name as your module name,
34+
we still prefer adding _NO EXTRA DEPENDENCIES_, meaning `mymodule = []` is the preferred addition
35+
(see the notes at the bottom)
36+
- [ ] Your branch is up-to-date (or your branch will be rebased with `git rebase`)
37+
38+
# Preferred implementation
39+
40+
- The current consensus among maintainers is to try to avoid enforcing the client library
41+
for the given tools you are triyng to implement.
42+
- This means we want you to avoid adding specific libraries as dependencies to `testcontainers`.
43+
- Therefore, you should implement the configuration and the waiting with as little extra as possible
44+
- You may still find it useful to add your preferred client library as a dev dependency

.github/settings.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,15 @@ labels:
7171
- { name: '📦 package: google', color: '#0052CC', description: '' }
7272
- { name: '📦 package: kafka', color: '#0052CC', description: '' }
7373
- { name: '📦 package: keycloak', color: '#0052CC', description: '' }
74+
- { name: '📦 package: mailpit', color: '#0052CC', description: '' }
7475
- { name: '📦 package: mongodb', color: '#0052CC', description: '' }
7576
- { name: '📦 package: mssql', color: '#0052CC', description: '' }
7677
- { name: '📦 package: neo4j', color: '#0052CC', description: '' }
7778
- { name: '📦 package: oracle', color: '#0052CC', description: '' }
7879
- { name: '📦 package: postgres', color: '#0052CC', description: '' }
7980
- { name: '📦 package: rabbitmq', color: '#0052CC', description: '' }
8081
- { name: '📦 package: selenium', color: '#0052CC', description: '' }
82+
- { name: '📦 package: sftp', color: '#0052CC', description: '' }
8183
- { name: '🔀 requires triage', color: '#bfdadc', description: '' }
8284
- { name: '🔧 maintenance', color: '#c2f759', description: '' }
8385
- { name: '🚀 enhancement', color: '#84b6eb', description: '' }

CHANGELOG.md

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

3+
## [4.7.2](https://github.com/testcontainers/testcontainers-python/compare/testcontainers-v4.7.1...testcontainers-v4.7.2) (2024-07-15)
4+
5+
6+
### Bug Fixes
7+
8+
* Add container Trino ([#642](https://github.com/testcontainers/testcontainers-python/issues/642)) ([49ce5a5](https://github.com/testcontainers/testcontainers-python/commit/49ce5a5ff2ac46cf51920e16c5e39684886b699a)), closes [#641](https://github.com/testcontainers/testcontainers-python/issues/641)
9+
* **core:** Improve private registry support (tolerate not implemented fields in DOCKER_AUTH_CONFIG) ([#647](https://github.com/testcontainers/testcontainers-python/issues/647)) ([766c382](https://github.com/testcontainers/testcontainers-python/commit/766c382a3aee4eb512ee0f482d6595d3412097c3))
10+
* **kafka:** add a flag to limit to first hostname for use with networks ([#638](https://github.com/testcontainers/testcontainers-python/issues/638)) ([0ce4fec](https://github.com/testcontainers/testcontainers-python/commit/0ce4fecb2872620fd4cb96313abcba4353442cfd)), closes [#637](https://github.com/testcontainers/testcontainers-python/issues/637)
11+
* **modules:** Mailpit container base API URL helper method ([#643](https://github.com/testcontainers/testcontainers-python/issues/643)) ([df07586](https://github.com/testcontainers/testcontainers-python/commit/df07586d8844c757db62ac0f8b7914c67fd96e05))
12+
13+
## [4.7.1](https://github.com/testcontainers/testcontainers-python/compare/testcontainers-v4.7.0...testcontainers-v4.7.1) (2024-07-02)
14+
15+
16+
### Bug Fixes
17+
18+
* **core:** bad rebase from [#579](https://github.com/testcontainers/testcontainers-python/issues/579) ([#635](https://github.com/testcontainers/testcontainers-python/issues/635)) ([4766e48](https://github.com/testcontainers/testcontainers-python/commit/4766e4829407c19de039effc7ea8fcc8b6dcc214))
19+
* **modules:** Mailpit Container ([#625](https://github.com/testcontainers/testcontainers-python/issues/625)) ([0b866ff](https://github.com/testcontainers/testcontainers-python/commit/0b866ff3c2d462fa5032945dfa2efd4bd59079da))
20+
* **modules:** SFTP Server Container ([#629](https://github.com/testcontainers/testcontainers-python/issues/629)) ([2e7dbf1](https://github.com/testcontainers/testcontainers-python/commit/2e7dbf1185c68c7cbfb6bdac7457d1d5f86aba19))
21+
* **network:** Now able to use Network without context, and has labels to be automatically cleaned up ([#627](https://github.com/testcontainers/testcontainers-python/issues/627)) ([#630](https://github.com/testcontainers/testcontainers-python/issues/630)) ([e93bc29](https://github.com/testcontainers/testcontainers-python/commit/e93bc29c1781c4e73840c4c587160f8e5805feea))
22+
* **postgres:** get_connection_url(driver=None) should return postgres://... ([#588](https://github.com/testcontainers/testcontainers-python/issues/588)) ([01d6c18](https://github.com/testcontainers/testcontainers-python/commit/01d6c182485555ee83f560739c34f089b0e54e0b)), closes [#587](https://github.com/testcontainers/testcontainers-python/issues/587)
23+
* update test module import ([#623](https://github.com/testcontainers/testcontainers-python/issues/623)) ([16f6ca4](https://github.com/testcontainers/testcontainers-python/commit/16f6ca42621866d8ff87ca539a84da27dbe9a4c4))
24+
25+
## [4.7.0](https://github.com/testcontainers/testcontainers-python/compare/testcontainers-v4.6.0...testcontainers-v4.7.0) (2024-06-28)
26+
27+
28+
### Features
29+
30+
* **core:** Add support for ollama module ([#618](https://github.com/testcontainers/testcontainers-python/issues/618)) ([5442d05](https://github.com/testcontainers/testcontainers-python/commit/5442d054cb8bc11887e09d24e29d9f91dd943307))
31+
* **core:** Added Generic module ([#612](https://github.com/testcontainers/testcontainers-python/issues/612)) ([e575b28](https://github.com/testcontainers/testcontainers-python/commit/e575b28da912147c5b806abab40a0c92329e2eb7))
32+
* **core:** allow custom dockerfile path for image build and bypassing build cache ([#615](https://github.com/testcontainers/testcontainers-python/issues/615)) ([ead0f79](https://github.com/testcontainers/testcontainers-python/commit/ead0f797902a94d3b2558e489fe2a0a55c3bb7ad)), closes [#610](https://github.com/testcontainers/testcontainers-python/issues/610)
33+
* **core:** DockerCompose.stop now stops only services that it starts (does not stop the other services) ([#620](https://github.com/testcontainers/testcontainers-python/issues/620)) ([e711800](https://github.com/testcontainers/testcontainers-python/commit/e71180039441e3c7d49467298ef0f498fe786149))
34+
35+
36+
### Bug Fixes
37+
38+
* **cosmosdb:** Add support for the CosmosDB Emulator ([#579](https://github.com/testcontainers/testcontainers-python/issues/579)) ([8045a80](https://github.com/testcontainers/testcontainers-python/commit/8045a806fcb6908567339a14f2f0d7a169461675))
39+
* improve ollama docs, s/ollama_dir/ollama_home/g ([#619](https://github.com/testcontainers/testcontainers-python/issues/619)) ([27f2a6b](https://github.com/testcontainers/testcontainers-python/commit/27f2a6bdca8b9c860a96920eebc96f53682ea750))
40+
* **kafka:** Add Kraft to Kafka containers ([#611](https://github.com/testcontainers/testcontainers-python/issues/611)) ([762d2a2](https://github.com/testcontainers/testcontainers-python/commit/762d2a2130f7ce17dacaed5a96a6898a08cf2bc5))
41+
42+
43+
### Documentation
44+
45+
* **contributing:** add contribution and new-container guide ([#460](https://github.com/testcontainers/testcontainers-python/issues/460)) ([3519f4b](https://github.com/testcontainers/testcontainers-python/commit/3519f4bdad6eac6c172977303b51cf52b4fa4c04))
46+
347
## [4.6.0](https://github.com/testcontainers/testcontainers-python/compare/testcontainers-v4.5.1...testcontainers-v4.6.0) (2024-06-18)
448

549

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
ARG version=3.8
2-
FROM python:${version}
1+
ARG PYTHON_VERSION
2+
FROM python:${version}-slim-bookworm
33

44
WORKDIR /workspace
55
RUN pip install --upgrade pip \
66
&& apt-get update \
77
&& apt-get install -y \
88
freetds-dev \
99
&& rm -rf /var/lib/apt/lists/*
10+
11+
# install requirements we exported from poetry
1012
COPY build/requirements.txt requirements.txt
11-
COPY setup.py README.rst ./
1213
RUN pip install -r requirements.txt
14+
15+
# copy project source
1316
COPY . .

0 commit comments

Comments
 (0)