Skip to content

fix(core): make config editable to avoid monkeypatching.1 - #532

Merged
alexanderankin merged 7 commits into
mainfrom
editable_config
Apr 8, 2024
Merged

fix(core): make config editable to avoid monkeypatching.1#532
alexanderankin merged 7 commits into
mainfrom
editable_config

Conversation

@alexanderankin

Copy link
Copy Markdown
Member

see #531

@alexanderankin

Copy link
Copy Markdown
MemberAuthor

ok, i checked against #519 and shouldnt be too hard to rebase (if even necessary), unfortunately re #525 and #527 - 527 is a draft and 525 is a feat, which deprioritizes over things which can be considered fixes - unless the changes are inspired by tc-go or tc-java or other sources of truth on how to deal with things like mssql, may even be "breaking" even though they are "fixing" - i unfortunately have a lot of pent up sympathy for people doing unusual software things. nothing against the PR, we will figure it out and hopefully release it as a fix rather than a feat)

so with that said, not sure why i shouldnt merge this

@alexanderankinalexanderankin changed the title fix(core): make config editable so users don't have to monkey patch the libraryfix(core): make config editable to avoid monkeypatching.1Apr 8, 2024
@alexanderankin
alexanderankin merged commit 3be6da3 into mainApr 8, 2024
@alexanderankin
alexanderankin deleted the editable_config branch April 8, 2024 09:24
alexanderankin pushed a commit that referenced this pull request Apr 8, 2024
🤖 I have created a release *beep* *boop*
---
##
[4.3.2](testcontainers-v4.3.1...testcontainers-v4.3.2)
(2024-04-08)
### Bug Fixes
* **core:** Improve typing for common container usage scenarios
([#523](#523))
([d5b8553](d5b8553))
* **core:** make config editable to avoid monkeypatching.1
([#532](#532))
([3be6da3](3be6da3))
* **vault:** add support for HashiCorp Vault container
([#366](#366))
([1326278](1326278))
---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
mloesch pushed a commit to mloesch/testcontainers-python that referenced this pull request Apr 8, 2024
…ners#532)
see testcontainers#531:
I am using testcontainers within a library that provides some
pytest-fixtures.
In order for this to work I have change some settings.
As I can not guarantee that that my lib is imported before
testcontainers I need to monkeypatch the settings.
This is much easier if I only need to monkeypatch the config file and
not all modules that use configurations.
I would argue that for a potential library as this, this is a better
design.
Also one can easier see that the given UPERCASE variable is not a
constant but rather a setting.
Co-authored-by: Carli* Freudenberg <carli.freudenberg@energymeteo.de>
mloesch pushed a commit to mloesch/testcontainers-python that referenced this pull request Apr 8, 2024
🤖 I have created a release *beep* *boop*
---
##
[4.3.2](testcontainers/testcontainers-python@testcontainers-v4.3.1...testcontainers-v4.3.2)
(2024-04-08)
### Bug Fixes
* **core:** Improve typing for common container usage scenarios
([testcontainers#523](testcontainers#523))
([d5b8553](testcontainers@d5b8553))
* **core:** make config editable to avoid monkeypatching.1
([testcontainers#532](testcontainers#532))
([3be6da3](testcontainers@3be6da3))
* **vault:** add support for HashiCorp Vault container
([testcontainers#366](testcontainers#366))
([1326278](testcontainers@1326278))
---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@CarliJoy

Copy link
Copy Markdown
Contributor

Dear, @alexanderankin

Imports like

fromtestcontainers.core.configimporttestcontainers_configasconfig

will have the same problems as

fromtestcontainers.core.configimportSETTING

Only difference is that one can monkeypatch values of the testcontainers_config dataclass object.

But if you goal was to allow to make testcontainers_config replaceable with a new TestcontainersConfiguration instance, it won't work.

But thank you for adopting my idea so fast.
It's good enough for me.

@alexanderankin

alexanderankin commented Apr 8, 2024 via email

Copy link
Copy Markdown
MemberAuthor

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@alexanderankin@CarliJoy