Accepting request 1240690 from devel:languages:python
- Update to 2.7.1: * Move preferred alias resolution to private method * Fix test_protected_namespace_defaults with -Wdefault * Make tests more robust to the running environment * Fix rendering of annotations in code example * Fix alias resolution for default settings source. * Use the class name in the __repr__ implementations * Fix default help text for union of submodels. * Add support for CliMutuallyExclusiveGroup. * Disable abbreviations on internal parser. * Fix Secret field parsing * Fix alias resolution to use preferred key. * Strip annotated when getting submodels during CLI parsing. * Removing return type from the function in test * Relax default protected_namespaces * Add support for CLI kebab case flag. * Change reference of default values validation in documentation * Improve field value parsing by adding NoDecode and ForceDecode annotations * Fix attribute error on Python 3.9 with typing.Sequence * Add Python 3.13 support * Adding support for populate_by_name * Refactor path_type_label * Fix nested model field with alias parsing * Fix PathType typing in case of sequence * Add cli_ignore_unknown_args config option. * Fix AzureKeyVaultSettingsSource problem in case of field with underscore * Add cli_flag_prefix_char config option. * Fix nested model AliasChoices in validation alias * Add CLI App Support OBS-URL: https://build.opensuse.org/request/show/1240690 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pydantic-settings?expand=0&rev=6
This commit is contained in:
commit
5e05958622
@ -1,32 +0,0 @@
|
||||
Index: pydantic_settings-2.3.4/tests/test_settings.py
|
||||
===================================================================
|
||||
--- pydantic_settings-2.3.4.orig/tests/test_settings.py
|
||||
+++ pydantic_settings-2.3.4/tests/test_settings.py
|
||||
@@ -10,6 +10,7 @@ from datetime import datetime, timezone
|
||||
from enum import IntEnum
|
||||
from pathlib import Path
|
||||
from typing import Any, Callable, Dict, Generic, Hashable, List, Optional, Set, Tuple, Type, TypeVar, Union
|
||||
+from unittest import mock
|
||||
|
||||
import pytest
|
||||
import typing_extensions
|
||||
@@ -1116,7 +1117,8 @@ def test_multiple_env_file(tmp_path):
|
||||
|
||||
model_config = SettingsConfigDict(env_file=[base_env, prod_env])
|
||||
|
||||
- s = Settings()
|
||||
+ with mock.patch.dict('os.environ', {}, clear=True):
|
||||
+ s = Settings()
|
||||
assert s.debug_mode is False
|
||||
assert s.host == 'https://example.com/services'
|
||||
assert s.port == 8000
|
||||
@@ -1135,7 +1137,8 @@ def test_model_env_file_override_model_c
|
||||
|
||||
model_config = SettingsConfigDict(env_file=prod_env)
|
||||
|
||||
- s = Settings(_env_file=base_env)
|
||||
+ with mock.patch.dict('os.environ', {}, clear=True):
|
||||
+ s = Settings(_env_file=base_env)
|
||||
assert s.debug_mode is True
|
||||
assert s.host == 'localhost'
|
||||
assert s.port == 8000
|
26
fix-settings-dump.patch
Normal file
26
fix-settings-dump.patch
Normal file
@ -0,0 +1,26 @@
|
||||
Index: pydantic_settings-2.7.1/docs/index.md
|
||||
===================================================================
|
||||
--- pydantic_settings-2.7.1.orig/docs/index.md
|
||||
+++ pydantic_settings-2.7.1/docs/index.md
|
||||
@@ -72,9 +72,9 @@ print(Settings().model_dump())
|
||||
{
|
||||
'auth_key': 'xxx',
|
||||
'api_key': 'xxx',
|
||||
- 'redis_dsn': Url('redis://user:pass@localhost:6379/1'),
|
||||
- 'pg_dsn': MultiHostUrl('postgres://user:pass@localhost:5432/foobar'),
|
||||
- 'amqp_dsn': Url('amqp://user:pass@localhost:5672/'),
|
||||
+ 'redis_dsn': RedisDsn('redis://user:pass@localhost:6379/1'),
|
||||
+ 'pg_dsn': PostgresDsn('postgres://user:pass@localhost:5432/foobar'),
|
||||
+ 'amqp_dsn': AmqpDsn('amqp://user:pass@localhost:5672/'),
|
||||
'special_function': math.cos,
|
||||
'domains': set(),
|
||||
'more_settings': {'foo': 'bar', 'apple': 1},
|
||||
@@ -1952,7 +1952,7 @@ class Settings(BaseSettings):
|
||||
|
||||
|
||||
print(Settings(database_dsn='postgres://postgres@localhost:5432/kwargs_db'))
|
||||
-#> database_dsn=MultiHostUrl('postgres://postgres@localhost:5432/kwargs_db')
|
||||
+#> database_dsn=PostgresDsn('postgres://postgres@localhost:5432/kwargs_db')
|
||||
```
|
||||
|
||||
By flipping `env_settings` and `init_settings`, environment variables now have precedence over `__init__` kwargs.
|
BIN
pydantic_settings-2.4.0.tar.gz
(Stored with Git LFS)
BIN
pydantic_settings-2.4.0.tar.gz
(Stored with Git LFS)
Binary file not shown.
3
pydantic_settings-2.7.1.tar.gz
Normal file
3
pydantic_settings-2.7.1.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:10c9caad35e64bfb3c2fbf70a078c0e25cc92499782e5200747f942a065dec93
|
||||
size 79920
|
@ -1,3 +1,61 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Jan 28 02:23:01 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Update to 2.7.1:
|
||||
* Move preferred alias resolution to private method
|
||||
* Fix test_protected_namespace_defaults with -Wdefault
|
||||
* Make tests more robust to the running environment
|
||||
* Fix rendering of annotations in code example
|
||||
* Fix alias resolution for default settings source.
|
||||
* Use the class name in the __repr__ implementations
|
||||
* Fix default help text for union of submodels.
|
||||
* Add support for CliMutuallyExclusiveGroup.
|
||||
* Disable abbreviations on internal parser.
|
||||
* Fix Secret field parsing
|
||||
* Fix alias resolution to use preferred key.
|
||||
* Strip annotated when getting submodels during CLI parsing.
|
||||
* Removing return type from the function in test
|
||||
* Relax default protected_namespaces
|
||||
* Add support for CLI kebab case flag.
|
||||
* Change reference of default values validation in documentation
|
||||
* Improve field value parsing by adding NoDecode and ForceDecode
|
||||
annotations
|
||||
* Fix attribute error on Python 3.9 with typing.Sequence
|
||||
* Add Python 3.13 support
|
||||
* Adding support for populate_by_name
|
||||
* Refactor path_type_label
|
||||
* Fix nested model field with alias parsing
|
||||
* Fix PathType typing in case of sequence
|
||||
* Add cli_ignore_unknown_args config option.
|
||||
* Fix AzureKeyVaultSettingsSource problem in case of field with underscore
|
||||
* Add cli_flag_prefix_char config option.
|
||||
* Fix nested model AliasChoices in validation alias
|
||||
* Add CLI App Support
|
||||
* Fix a regression in dotenv optional nested field
|
||||
* Put tests for non-default sources in separate files
|
||||
* Update nested model partial update docs example.
|
||||
* Add support for suppressing fields from CLI help.
|
||||
* Fix bug in dotenv source when there is env with and without prefix
|
||||
* Fix a bug in nested vanila dataclass
|
||||
* CLI Improve Docstring Help Text
|
||||
* Cli fix default or none object help text
|
||||
* Determine RootModel complexity from root type
|
||||
* Add CLI bool flags
|
||||
* CLI arg list whitespaces fix.
|
||||
* Add nested_model_default_partial_update flag and DefaultSettingsSource
|
||||
* Parse enum fixes.
|
||||
* Fixes CLI help text for function types
|
||||
* Add get_subcommand function.
|
||||
* Cli prefix validation alias fix
|
||||
* CLI ignore external parser list fix
|
||||
* Enable multiple secrets dirs
|
||||
* Add CLI subcommand union and alias support
|
||||
* Fix dotenv settings source problem in handling extra variables with
|
||||
same prefix in name
|
||||
- Drop patch clear-environment.patch, fixed by upstream in a different way.
|
||||
- Add patch fix-settings-dump.patch:
|
||||
* Support changes introduced by Pydantic 2.10.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Oct 28 09:52:17 UTC 2024 - Daniel Garcia <daniel.garcia@suse.com>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-pydantic-settings
|
||||
#
|
||||
# Copyright (c) 2024 SUSE LLC
|
||||
# Copyright (c) 2025 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -26,20 +26,20 @@
|
||||
%endif
|
||||
%{?sle15_python_module_pythons}
|
||||
Name: python-pydantic-settings%{psuffix}
|
||||
Version: 2.4.0
|
||||
Version: 2.7.1
|
||||
Release: 0
|
||||
Summary: Settings management using Pydantic
|
||||
License: MIT
|
||||
URL: https://github.com/pydantic/pydantic-settings
|
||||
Source: https://files.pythonhosted.org/packages/source/p/pydantic-settings/pydantic_settings-%{version}.tar.gz
|
||||
# PATCH-FIX-OPENSUSE Clear the environment before two test cases
|
||||
Patch0: clear-environment.patch
|
||||
# PATCH-FIX-OPENSUSE Support Pydantic 2.10 changes.
|
||||
Patch0: fix-settings-dump.patch
|
||||
BuildRequires: %{python_module hatchling}
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: python-rpm-macros
|
||||
# SECTION test requirements
|
||||
%if %{with test}
|
||||
BuildRequires: %{python_module pydantic-settings == %{version}}
|
||||
BuildRequires: %{python_module pydantic-settings = %{version}}
|
||||
BuildRequires: %{python_module pytest-examples}
|
||||
BuildRequires: %{python_module pytest-mock}
|
||||
BuildRequires: %{python_module pytest}
|
||||
@ -71,9 +71,7 @@ Settings management using Pydantic, this is the new official home of Pydantic's
|
||||
%check
|
||||
%if %{with test}
|
||||
# This test requires azure
|
||||
skiptest="test_docs_examples[docs/index.md:1212-1256]"
|
||||
# Failing test, not raising the same warning
|
||||
skiptest+=" or test_protected_namespace_defaults"
|
||||
skiptest="test_docs_examples[docs/index.md:1680-1724]"
|
||||
%pytest -k "not ($skiptest)"
|
||||
%endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user