Sync from SUSE:SLFO:Main python-pydantic-settings revision a95c2741ba8ab294817408b2066c9ad3

This commit is contained in:
Adrian Schröter 2024-09-13 16:23:47 +02:00
commit c52a9284a9
5 changed files with 170 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

32
clear-environment.patch Normal file
View File

@ -0,0 +1,32 @@
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

BIN
pydantic_settings-2.3.4.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,43 @@
-------------------------------------------------------------------
Mon Jul 1 17:55:58 UTC 2024 - Dirk Müller <dmueller@suse.com>
- update to 2.3.4:
* add in-place reloading in docs
* Nested pydantic dataclasses and doc fixes.
* Remove leftover docstring causing warning on `pydantic` docs
build
- update to 2.3.3:
* Fix an intriduced bug in parsing json field with
discriminated union
* Add CliSettingsSource alias handling for AliasChoices and
AliasPath.
- update to 2.3.2:
* Initialize CLI source on demand.
* Fix command line help from `argparse` formatting problem
* Fix issue with nested model uppercase field name in case
insensitive mode
- update to 2.3.1:
* Fix a regression in parsing env value for nested dict
- update to 2.3.0:
* Add environment parsing support for enums.
* Improve `explode_env_vars` for better dict handling
* add `PyprojectTomlConfigSettingsSource`
* Fix broken link in AliasChoices class
* Update Pydantic
* fix: superfluous deep env conflicts with non-dict model leaf
* fix: a second level of environment nesting expected a dict
* Fix an issue when inner types of a discriminated union with a
callable discriminator were not correctly identified as
complex.
* Fix a bug when we have case insentive field in nested model
* Add CLI Settings Source
-------------------------------------------------------------------
Wed Mar 27 15:37:56 UTC 2024 - ecsos <ecsos@opensuse.org>
- Add %{?sle15_python_module_pythons}
-------------------------------------------------------------------
Mon Mar 11 03:19:14 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Initial release of 2.2.1

View File

@ -0,0 +1,69 @@
#
# spec file for package python-pydantic-settings
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?sle15_python_module_pythons}
Name: python-pydantic-settings
Version: 2.3.4
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
BuildRequires: %{python_module hatchling}
BuildRequires: %{python_module pip}
BuildRequires: python-rpm-macros
# SECTION test requirements
BuildRequires: %{python_module pydantic >= 2.3.0}
BuildRequires: %{python_module pytest-examples}
BuildRequires: %{python_module pytest-mock}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module python-dotenv >= 0.21.0}
# /SECTION
BuildRequires: fdupes
Requires: python-pydantic >= 2.3.0
Requires: python-python-dotenv >= 0.21.0
Suggests: python-pyyaml >= 6.0.1
Suggests: python-tomli >= 2.0.1
BuildArch: noarch
%python_subpackages
%description
Settings management using Pydantic, this is the new official home of Pydantic's `BaseSettings`.
%prep
%autosetup -p1 -n pydantic_settings-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pytest
%files %{python_files}
%license LICENSE
%doc README.md
%{python_sitelib}/pydantic_settings
%{python_sitelib}/pydantic_settings-%{version}.dist-info
%changelog