Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress warning about Union type #221

Open
marcelveldt opened this issue May 10, 2024 · 1 comment
Open

Suppress warning about Union type #221

marcelveldt opened this issue May 10, 2024 · 1 comment

Comments

@marcelveldt
Copy link

  • mashumaro version: 3.13
  • Python version: 3.12
  • Operating System: Debian

Description

Since the 3.13 release a warning is being logged (on all user setups as well!) about coercing a value within a Union type.
This worked perfectly well for the last couple of years so now I'm confused why this change is needed.
If needed, is there a way to override or do you have tips how I could treat this differently ? A custom rule perhaps ?

UserWarning: music_assistant.common.models.config_entries.ConfigEntry.value (typing.Union[str, int, float, bool, tuple[int, int], list[str], list[int], list[tuple[int, int]], None]): In the next release, data marked with Union type containing 'str' and 'bool' will be coerced to the value of the type specified first instead of passing it as is

Reference to the model in my code:
https://github.com/music-assistant/server/blob/main/music_assistant/common/models/config_entries.py#L46

Amazing projects btw, love it and been on board since the very beginning. It has grown into my goto recommendation for serialization libs.

What I Did

Paste the code, command(s) you ran and the output.
If there was a crash, please include the traceback here.
@MichelleArk
Copy link

We're also seeing a similar warning in dbt-core, from these two lines:

UserWarning: dbt.contracts.graph.unparsed.UnparsedMetricTypeParams.expr (typing.Union[str, bool, None]): In the next release, data marked with Union type containing 'str' and 'bool' will be coerced to the value of the type specified first instead of passing it as is

Also curious what the recommended workaround here would be

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants