Skip to content

Commit 142b9cf

Browse files
authored
Uprev pydantic to v2.0a4 (#55)
1 parent d435ffe commit 142b9cf

File tree

7 files changed

+54
-58
lines changed

7 files changed

+54
-58
lines changed

pydantic_settings/sources.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ def __init__(self, settings_cls: type[BaseSettings], init_kwargs: dict[str, Any]
9393
super().__init__(settings_cls)
9494

9595
def get_field_value(self, field: FieldInfo, field_name: str) -> tuple[Any, str, bool]:
96-
pass
96+
# Nothing to do here. Only implement the return statement to make mypy happy
97+
return None, '', False
9798

9899
def __call__(self) -> dict[str, Any]:
99100
return self.init_kwargs

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ classifiers = [
4040
]
4141
requires-python = '>=3.7'
4242
dependencies = [
43-
'pydantic==v2.0a3',
43+
'pydantic==v2.0a4',
4444
'python-dotenv>=0.21.0',
4545
]
4646
dynamic = ['version']

requirements/linting.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ black
22
flake8
33
flake8-quotes
44
flake8-pyproject
5-
hypothesis
65
isort
76
pyupgrade
87
mypy

requirements/linting.txt

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,75 +4,67 @@
44
#
55
# pip-compile --output-file=requirements/linting.txt requirements/linting.in
66
#
7-
attrs==22.1.0
8-
# via hypothesis
9-
black==22.8.0
7+
black==23.3.0
108
# via -r requirements/linting.in
119
cfgv==3.3.1
1210
# via pre-commit
1311
click==8.1.3
1412
# via black
1513
distlib==0.3.6
1614
# via virtualenv
17-
exceptiongroup==1.0.0rc9
18-
# via hypothesis
19-
filelock==3.8.0
15+
filelock==3.12.0
2016
# via virtualenv
21-
flake8==5.0.4
17+
flake8==6.0.0
2218
# via
2319
# -r requirements/linting.in
2420
# flake8-pyproject
2521
# flake8-quotes
26-
flake8-pyproject==1.1.0.post0
22+
flake8-pyproject==1.2.3
2723
# via -r requirements/linting.in
28-
flake8-quotes==3.3.1
24+
flake8-quotes==3.3.2
2925
# via -r requirements/linting.in
30-
hypothesis==6.54.4
31-
# via -r requirements/linting.in
32-
identify==2.5.3
26+
identify==2.5.24
3327
# via pre-commit
34-
isort==5.10.1
28+
isort==5.12.0
3529
# via -r requirements/linting.in
3630
mccabe==0.7.0
3731
# via flake8
38-
mypy==0.971
32+
mypy==1.3.0
3933
# via -r requirements/linting.in
40-
mypy-extensions==0.4.3
34+
mypy-extensions==1.0.0
4135
# via
4236
# black
4337
# mypy
44-
nodeenv==1.7.0
38+
nodeenv==1.8.0
4539
# via pre-commit
46-
pathspec==0.10.1
40+
packaging==23.1
41+
# via black
42+
pathspec==0.11.1
4743
# via black
48-
platformdirs==2.5.2
44+
platformdirs==3.5.1
4945
# via
5046
# black
5147
# virtualenv
52-
pre-commit==2.20.0
48+
pre-commit==3.3.1
5349
# via -r requirements/linting.in
54-
pycodestyle==2.9.1
50+
pycodestyle==2.10.0
5551
# via flake8
56-
pyflakes==2.5.0
52+
pyflakes==3.0.1
5753
# via flake8
58-
pyupgrade==2.37.3
54+
pyupgrade==3.4.0
5955
# via -r requirements/linting.in
6056
pyyaml==6.0
6157
# via pre-commit
62-
sortedcontainers==2.4.0
63-
# via hypothesis
64-
tokenize-rt==4.2.1
58+
tokenize-rt==5.0.0
6559
# via pyupgrade
66-
toml==0.10.2
67-
# via pre-commit
6860
tomli==2.0.1
6961
# via
7062
# black
7163
# flake8-pyproject
7264
# mypy
7365
typing-extensions==4.5.0
7466
# via mypy
75-
virtualenv==20.16.4
67+
virtualenv==20.23.0
7668
# via pre-commit
7769

7870
# The following packages are considered to be unsafe in a requirements file:

requirements/pyproject.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#
77
annotated-types==0.4.0
88
# via pydantic
9-
pydantic==v2.0a3
9+
pydantic==v2.0a4
1010
# via pydantic-settings (pyproject.toml)
11-
pydantic-core==0.25.0
11+
pydantic-core==0.30.0
1212
# via pydantic
1313
python-dotenv==0.21.0
1414
# via pydantic-settings (pyproject.toml)

requirements/testing.txt

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,38 @@
44
#
55
# pip-compile --output-file=requirements/testing.txt requirements/testing.in
66
#
7-
attrs==22.1.0
8-
# via pytest
9-
coverage[toml]==6.4.4
7+
coverage[toml]==7.2.5
108
# via -r requirements/testing.in
11-
importlib-metadata==4.12.0
9+
exceptiongroup==1.1.1
10+
# via pytest
11+
importlib-metadata==6.6.0
1212
# via
1313
# pluggy
1414
# pytest
15-
iniconfig==1.1.1
15+
iniconfig==2.0.0
1616
# via pytest
17-
packaging==21.3
17+
packaging==23.1
1818
# via
1919
# pytest
2020
# pytest-sugar
2121
pluggy==1.0.0
2222
# via pytest
23-
py==1.11.0
24-
# via pytest
25-
pyparsing==3.0.9
26-
# via packaging
27-
pytest==7.1.3
23+
pytest==7.3.1
2824
# via
2925
# -r requirements/testing.in
3026
# pytest-mock
3127
# pytest-sugar
32-
pytest-mock==3.8.2
28+
pytest-mock==3.10.0
3329
# via -r requirements/testing.in
34-
pytest-sugar==0.9.5
30+
pytest-sugar==0.9.7
3531
# via -r requirements/testing.in
36-
termcolor==1.1.0
32+
termcolor==2.3.0
3733
# via pytest-sugar
3834
tomli==2.0.1
3935
# via
4036
# coverage
4137
# pytest
4238
typing-extensions==4.5.0
4339
# via importlib-metadata
44-
zipp==3.8.1
40+
zipp==3.15.0
4541
# via importlib-metadata

tests/test_settings.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ def test_sub_env_override(env):
5757
def test_sub_env_missing():
5858
with pytest.raises(ValidationError) as exc_info:
5959
SimpleSettings()
60-
assert exc_info.value.errors() == [{'type': 'missing', 'loc': ('apple',), 'msg': 'Field required', 'input': {}}]
60+
assert exc_info.value.errors(include_url=False) == [
61+
{'type': 'missing', 'loc': ('apple',), 'msg': 'Field required', 'input': {}}
62+
]
6163

6264

6365
def test_other_setting():
@@ -227,7 +229,7 @@ class AnnotatedComplexSettings(BaseSettings):
227229
env.set('apples', '["russet"]')
228230
with pytest.raises(ValidationError) as exc_info:
229231
AnnotatedComplexSettings()
230-
assert exc_info.value.errors() == [
232+
assert exc_info.value.errors(include_url=False) == [
231233
{
232234
'ctx': {'actual_length': 1, 'field_type': 'List', 'min_length': 2},
233235
'input': ['russet'],
@@ -292,7 +294,7 @@ class ComplexSettings(BaseSettings):
292294
env.set('field', '{"x": "a"}')
293295
with pytest.raises(ValidationError) as exc_info:
294296
ComplexSettings()
295-
assert exc_info.value.errors() == [
297+
assert exc_info.value.errors(include_url=False) == [
296298
{
297299
'input': 'a',
298300
'loc': ('field', 'x'),
@@ -318,7 +320,7 @@ class ComplexSettings(BaseSettings):
318320
env.set('field', '{"x": "a"}')
319321
with pytest.raises(ValidationError) as exc_info:
320322
ComplexSettings()
321-
assert exc_info.value.errors() == [
323+
assert exc_info.value.errors(include_url=False) == [
322324
{
323325
'input': 'a',
324326
'loc': ('field', 'x'),
@@ -344,7 +346,7 @@ class ComplexSettings(BaseSettings):
344346
env.set('field', '{"x": "a"}')
345347
with pytest.raises(ValidationError) as exc_info:
346348
ComplexSettings()
347-
assert exc_info.value.errors() == [
349+
assert exc_info.value.errors(include_url=False) == [
348350
{
349351
'input': 'a',
350352
'loc': ('field', 'x'),
@@ -507,7 +509,9 @@ class Settings(BaseSettings):
507509
env.set('p_foo', 'bar')
508510
with pytest.raises(ValidationError) as exc_info:
509511
Settings()
510-
assert exc_info.value.errors() == [{'type': 'missing', 'loc': ('foo',), 'msg': 'Field required', 'input': {}}]
512+
assert exc_info.value.errors(include_url=False) == [
513+
{'type': 'missing', 'loc': ('foo',), 'msg': 'Field required', 'input': {}}
514+
]
511515

512516
env.set('foo', 'bar')
513517
assert Settings().foobar == 'bar'
@@ -523,7 +527,9 @@ class Settings(BaseSettings):
523527
monkeypatch.setattr(os, 'environ', value={'Foo': 'foo'})
524528
with pytest.raises(ValidationError) as exc_info:
525529
Settings()
526-
assert exc_info.value.errors() == [{'type': 'missing', 'loc': ('foo',), 'msg': 'Field required', 'input': {}}]
530+
assert exc_info.value.errors(include_url=False) == [
531+
{'type': 'missing', 'loc': ('foo',), 'msg': 'Field required', 'input': {}}
532+
]
527533

528534

529535
def test_nested_dataclass(env):
@@ -684,7 +690,7 @@ class Settings(BaseSettings):
684690

685691
with pytest.raises(ValidationError) as exc_info:
686692
Settings()
687-
assert exc_info.value.errors() == [
693+
assert exc_info.value.errors(include_url=False) == [
688694
{
689695
'type': 'missing',
690696
'loc': ('a',),
@@ -1127,7 +1133,9 @@ class Settings(BaseSettings):
11271133
with pytest.raises(ValidationError) as exc_info:
11281134
Settings()
11291135

1130-
assert exc_info.value.errors() == [{'type': 'missing', 'loc': ('foo',), 'msg': 'Field required', 'input': {}}]
1136+
assert exc_info.value.errors(include_url=False) == [
1137+
{'type': 'missing', 'loc': ('foo',), 'msg': 'Field required', 'input': {}}
1138+
]
11311139

11321140

11331141
def test_secrets_invalid_secrets_dir(tmp_path):
@@ -1546,7 +1554,7 @@ class Settings(BaseSettings):
15461554

15471555
with pytest.raises(ValidationError) as exc_info:
15481556
Settings()
1549-
assert exc_info.value.errors() == [
1557+
assert exc_info.value.errors(include_url=False) == [
15501558
{'type': 'extra_forbidden', 'loc': ('x',), 'msg': 'Extra inputs are not permitted', 'input': 'y'}
15511559
]
15521560

0 commit comments

Comments
 (0)