-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(build): use poetry and organise modules (#408)
# Changes Fixes #204 - We do not publish `testcontainers-*` packages any more as it's a maintenance nightmare on PyPI - example: in case of loss of access to the PyPI package, it's a messy and long procedure to reclaim it - Instead the project root is now a collection of modules, see `pyproject.toml` - All published under `testcontainers` which will allow the previous `testcontainers[extra1, extra2]` format to be used (replacing the `/meta` package mechanism) - Removes old config files like `.coveragerc` and `setup.cfg` and integrates them into `pyproject.toml` - more grooming incoming in future PRs (like the move to `ruff` which is a more performant formatter/linter) --------- Co-authored-by: Balint Bartha <totallyzen@users.noreply.github.com> Co-authored-by: Dave Ankin <daveankin@gmail.com>
- Loading branch information
1 parent
348f83d
commit 6c69583
Showing
110 changed files
with
3,354 additions
and
687 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Contrinuous Integration for community modules | ||
|
||
name: modules | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths: | ||
- "modules/**" | ||
pull_request: | ||
branches: [main] | ||
paths: | ||
- "modules/**" | ||
|
||
permissions: | ||
actions: write # needed for self-cancellation | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.11"] | ||
module: | ||
- arangodb | ||
- azurite | ||
- clickhouse | ||
- elasticsearch | ||
- kafka | ||
- keycloak | ||
- localstack | ||
- minio | ||
- mongodb | ||
- mssql | ||
- mysql | ||
- neo4j | ||
- nginx | ||
- opensearch | ||
- oracle | ||
- postgres | ||
- rabbitmq | ||
- redis | ||
- selenium | ||
- k3s | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get changed files | ||
id: changes-for-module | ||
uses: tj-actions/changed-files@v42 | ||
with: | ||
files: | | ||
modules/${{ matrix.module }}/** | ||
- name: Exit early, nothing to do | ||
if: ${{ steps.changes-for-module.outputs.any_changed == 'false' }} | ||
run: | | ||
# cancel and wait for run to end | ||
gh run cancel ${{ github.run_id }} | ||
gh run watch ${{ github.run_id }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Checkout contents | ||
uses: actions/checkout@v4 | ||
- name: Setup Poetry | ||
run: pipx install poetry | ||
- name: Setup python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: poetry | ||
- name: Install Python dependencies | ||
run: poetry install -E ${{ matrix.module }} | ||
- name: Run linter | ||
run: make modules/${{ matrix.module }}/lint | ||
- name: Run tests | ||
run: make modules/${{ matrix.module }}/tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Contrinuous Integration for the core package | ||
|
||
name: core | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
os: [ ubuntu ] | ||
python-version: ["3.9", "3.10", "3.11"] | ||
runs-on: ${{ matrix.os }}-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Poetry | ||
run: pipx install poetry | ||
- name: Setup python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: poetry | ||
- name: Install Python dependencies | ||
run: poetry install | ||
- name: Run linter | ||
run: make core/lint | ||
- name: Run twine check | ||
run: poetry build && poetry run twine check dist/*.tar.gz | ||
- name: Run tests | ||
run: make core/tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
name: Automatically add triage labels to new issues and pull requests | ||
on: | ||
issues: | ||
types: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# 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:9.5") 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 9.5...' | ||
``` | ||
|
||
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. |
Oops, something went wrong.