553 Commits

Author SHA1 Message Date
⬢ Samuel Colvin ef8f9fe51b Uprev all dependencies (#4955)
* Uprev all dependencies

* use ruff instead of flake8 for docs examples linting
2023-01-15 09:57:09 -08:00
⬢ Samuel Colvin 8b9756d6cc simplify analytics more (#4930) 2023-01-13 16:21:41 +00:00
⬢ Samuel Colvin 426799f6eb remove remains of ads, add custom analytics (#4927) 2023-01-13 16:21:34 +00:00
florianfischer91 f55515820a Rename model methods (#4889)
* renaming .json -> .model_dump_json

* renaming .dict -> .model_dump

* renaming .__fields__ -> .model_fields

* renaming .schema -> .model_json_schema

* renaming .construct -> .model_construct

* renaming .parse_obj -> .model_validate

* make linters happy

* add changes md-file

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2023-01-05 11:30:44 +00:00
Jim Kring 08f7cf63c9 config variable to raise UserWarning if model not fully defined (#4882)
* added config var warn_on_undefined_types
raises a UserWarning if model not fully defined and will need rebuild

* black formatting

* use | instead of Optional[]

* suppress undefined types warning in existing tests

* ran pre-commit to fix linting

* changed to use Optional since | failing in CI

* changes following initial code review

* added some preliminary documentation

* fix linting

* fixed linting

* fixed linting

* assert model partially built when suppressing warn

* moved check for ForwardRef into existing for loop

* change assertion to dict instead of json

* cleanup of undefined_types_warning tests and docs

* Update docs/examples/types_undefined_warning.py

* Update docs/examples/types_undefined_warning.py

* fix EOL (trim trailing whitespace) lint error

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2023-01-04 19:23:39 +00:00
gr8jam 7c6e7e3bac Fixed datetime format specifier in docs (#4876) 2022-12-27 09:17:16 +01:00
Muhammad Abdur Rakib f2b129a8bc fixed documentation typo (#4855) 2022-12-20 13:53:01 +01:00
Hasan Ramezani 9588c9e22d Fix typo in types usage documentation. (#4825) 2022-12-15 11:58:24 +00:00
Hasan Ramezani 73aa0a8f7d Add newline before Outputs: when printing json output in docs (#4802) 2022-12-15 11:23:38 +00:00
Samuel Colvin f985335527 Moving docs to docs.pydantic.dev (#4818)
* moving docs to docs.pydantic.dev

* use the wrangler gh action

* :face-palm:

* 🤦 disable tag check

* uncomment ci checks

* set branch for cf pages publish
2022-12-06 14:12:38 +00:00
Marcelo Trylesinski caa318c908 Remove trailing "```" (#4799) 2022-11-29 15:43:30 +01:00
Samuel Colvin 182e182f4a Add Jina AI to sponsors (#4767)
* add Jina AI to sponsors

* add change description
2022-11-22 22:28:51 +00:00
kgolawski f9e8c64f12 Fix code typo in docs (#4776) 2022-11-22 13:33:48 +01:00
Pierre Bonneau 21b8e22214 Renaming BaseModel (#4758)
Hello

BaseModel is an import from pydantic.
Using that same name for the Base from sqlachemy can be misleading, and not aligned to the other examples.

I therefore suggest to use the same naming that the other example.

Pierre
2022-11-17 10:01:56 +00:00
Irfanuddin Shafi Ahmed 9949786caf fix typo in docs (#4764) 2022-11-17 10:01:00 +00:00
Volker Hilsenstein 2f090a5cca Fix broken cross-references (#4743)
Co-authored-by: Volker Hilsenstein <volker.hilsenstein@embl.de>
2022-11-10 16:32:49 +00:00
Evorage 5cbfcba510 Trivial Markdown Fix (#4711) 2022-11-03 11:42:13 +00:00
Samuel Colvin 594effa279 Switching to pydantic_core (#4516)
* working on core schema generation

* adapting main.py

* getting tests to run

* fix tests

* disable pyright, fix mypy

* moving to class-based model generation

* working on validators

* change how models are created

* start fixing test_main.py

* fixing mypy

* SelfType

* recursive models working, more tests fixed

* fix tests on <3.10

* get docs build to pass

* starting to cleanup types.py

* starting works on custom types

* working on using annotated-types

* using annoated types for constraints

* lots of cleanup, fixing network tests

* network tests passing 🎉

* working on types

* working on types and cleanup

* fixing UUID type, restructing again

* more types and newer pydantic-core

* working on Iterable

* more test_types tests

* support newer pydantic-core, fixing more test_types.py

* working through more test_types.py

* test_types.py at last passing locally 🎉

* fixing more tests in test_types.py

* fix datetime_parse tests and linting

* get tests running again, rename to test_datetime.py

* renaming internal modules

* working through mypy errors

* fixing mypy

* refactoring _generate_schema.py

* test_main.py passing

* uprev deps

* fix conftest and linting?

* importing Annotated

* ltining

* import Annotated from typing_extensions

* fixing 3.7 compatibility

* fixing tests on 3.9

* fix linting

* fixing SecretField and 3.9 tests

* customising get_type_hints

* ignore warnings on 3.11

* spliting repr out of utils

* removing unused bits of _repr, fix tests for 3.7

* more cleanup, removing many type aliases

* clean up repr

* support namedtuples and typeddicts

* test is_union

* removing errors, uprev pydantic-core

* fix tests on 3.8

* fixing private attributes and model_post_init

* renaming and cleanup

* remove unnecessary PydanticMetadata inheritance

* fixing forward refs and mypy tests

* fix signatures, change how xfail works

* revert mypy tests to 3.7 syntax

* correct model title

* try to fix tests

* fixing ClassVar forward refs

* uprev pydantic-core, new error format

* add "force" argument to model_rebuild

* Apply suggestions from code review

Suggestions from @tiangolo and @hramezani 🙏

Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>

* more suggestions from @tiangolo

* extra -> json_schema_extra on Field

Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
2022-11-02 12:01:17 +00:00
Mòrian 5dd9b4f5ca Add postgresql+psycopg as allowed scheme for PostgreDsn (#4689) (#4690) 2022-10-31 10:37:57 +00:00
chaojie 02d4e18839 Docs add awesome-pydantic (#4616) 2022-10-17 16:02:17 +01:00
Rémy HUBSCHER 0a6e413866 Add missing typing to example (#4596)
* Add missing typing to example

* Update example typing.
2022-10-10 13:36:03 +02:00
Zach Kirsch a44d373f1f Fix "trough" typo in Model Config docs (#4593) 2022-10-07 09:15:47 +02:00
Miloš Mandić c22fe9a8f3 v2 docs broken link fix (#4533)
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2022-09-21 21:40:07 +02:00
Samuel Colvin e071a3e368 remove repeat newline in docs (again) (#4545) 2022-09-20 14:19:33 +00:00
Samuel Colvin c3e3fafae0 remove repeat newline in docs (#4544) 2022-09-20 14:01:22 +00:00
Samuel Colvin e0b8e0530b tiny tweak to docs (#4543) 2022-09-20 14:48:59 +01:00
Dmitry Lavrentev 996101b8ba fix: missing file extension in model_config.md link (#4512) 2022-09-13 09:39:31 +02:00
Samuel Colvin 85e4596958 Move settings to pydantic-settings (#4492)
* Move settings to pydantic-settings

* fix docs, remove dotenv

* fix coverage

* removing unused test fixture
2022-09-07 13:05:51 +01:00
Samuel Colvin f341049b9e Remove Cython & Move to pyproject.toml (#4473)
* Remove Cython

* fix CI

* fix coverage

* fix tests

* switching to pypyroject.toml

* pre-commit all and use pre-commit for linting

* no mypy tests on macos and windows on ci, use flake8-pyproject

* fix docs and tests CI

* check build is working

* drop pytest-cov

* window and macos ci with 3.11, reduce filtering

* use pip-tools to pin all dependencies

* fix docs and fastapi tests

* fix test deps for 3.7

* no cache on tests job

* revert fastapi changes, fix coverage

* fix mypy coverage

* test with older mypy

* dotenv not required for mypy tests

* split testing requirements std and extra

* typo

* @PrettyWood comments

* correct branch name

* mypy python_version and pr template
2022-09-06 17:15:51 +01:00
Samuel Colvin a4367c1c58 Revert percent encoding in URLs. (#4470)
* Revert "Fix `AnyUrl.build` doesn't do percent encoding (#3061) (#4224)"

This reverts commit e34ff9255f.

* change and warning
2022-09-05 11:02:43 +01:00
dependabot[bot] 2add8a9482 build(deps): bump hypothesis from 6.54.3 to 6.54.4 (#4464)
Bumps [hypothesis](https://github.com/HypothesisWorks/hypothesis) from 6.54.3 to 6.54.4.
- [Release notes](https://github.com/HypothesisWorks/hypothesis/releases)
- [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-python-6.54.3...hypothesis-python-6.54.4)

---
updated-dependencies:
- dependency-name: hypothesis
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-01 23:49:06 +02:00
dependabot[bot] f1fb4f20b4 build(deps): bump mkdocs-material from 8.4.0 to 8.4.2 (#4463)
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 8.4.0 to 8.4.2.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/8.4.0...8.4.2)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-01 23:48:47 +02:00
dependabot[bot] 85cd9ff5d1 build(deps): bump autoflake from 1.4 to 1.5.3 (#4462)
Bumps [autoflake](https://github.com/PyCQA/autoflake) from 1.4 to 1.5.3.
- [Release notes](https://github.com/PyCQA/autoflake/releases)
- [Commits](https://github.com/PyCQA/autoflake/compare/v1.4...v1.5.3)

---
updated-dependencies:
- dependency-name: autoflake
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-01 23:48:25 +02:00
Samuel Colvin b065908490 fix type hints in BaseSettings.Config (#4450)
* fix type hints in BaseSettings.Config

* add tests and change notice
2022-08-30 13:08:23 +01:00
Samuel Colvin 4832ae9acd add Explosion AI and AWS to sponsors (#4413)
* add Explosion AI and AWS to sponsors

* rename "Explosion AI" to "Explosion"

Co-authored-by: Ines Montani <ines@ines.io>

Co-authored-by: Ines Montani <ines@ines.io>
2022-08-23 10:29:36 +00:00
Grant Murray 9d2e1c40cb patch/typo-in-pydantic-v2-docs (#4422)
Change a single word in the Pydantic v2 documentation (should be `unchanged`, no?)
2022-08-23 09:41:58 +02:00
Samuel Colvin dd5f2a55aa fix links 2022-08-22 22:32:56 +01:00
Samuel Colvin 5b2bcfd73c correct copy_on_model_validation docs (#4420)
* correct "copy_on_model_validation" docs, fix #4369

* Update docs/usage/model_config.md

* correct docs
2022-08-22 22:00:18 +01:00
Anthony Miyaguchi fe7c9da6c1 Fix #1458 - Allow for custom parsing of environment variables via parse_env_var in Config object (#4406)
* Fix #1458 - Allow for custom parsing of environment variables via env_parse

* Add docs for env_parse usage

* Add changes file for #3977

* fixup: remove stray print statement

* Revert env_parse property on field

* Add parse_env_var classmethod in nested Config

* Update documentation for parse_env_var

* Update changes file.

* fixup: linting in example

* Rebase and remove quotes around imported example

* fix example

* my suggestions

* remove unnecessary Field(env_parse=_parse_custom_dict)

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2022-08-22 16:06:14 +00:00
Sebastián Ramírez 8dade7e9ac Add JSON-compatible float constraints for NaN and Inf (#3994)
*  Add JSON-compatible float constraints for NaN and Inf

* switching to a single "allow_inf_nan"

* fix tests

* add change and docs

* add allow_inf_nan to Config

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2022-08-22 15:21:56 +01:00
Hasan Ramezani abcf81ec10 Rename master to main (#4405) 2022-08-19 18:49:13 +01:00
dependabot[bot] 4c37e662e3 build(deps): bump hypothesis from 6.54.1 to 6.54.3 (#4403)
Bumps [hypothesis](https://github.com/HypothesisWorks/hypothesis) from 6.54.1 to 6.54.3.
- [Release notes](https://github.com/HypothesisWorks/hypothesis/releases)
- [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-python-6.54.1...hypothesis-python-6.54.3)

---
updated-dependencies:
- dependency-name: hypothesis
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-19 10:27:30 +00:00
dependabot[bot] 98a35fdb18 build(deps): bump mkdocs-material from 8.3.9 to 8.4.0 (#4401)
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 8.3.9 to 8.4.0.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/8.3.9...8.4.0)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-19 10:11:08 +00:00
Fares Ahmed e34ff9255f Fix AnyUrl.build doesn't do percent encoding (#3061) (#4224)
* Fix `AnyUrl.build` doesn't do percent encoding (#3061)

please review

* Use `urllib.parse` instead of custom implementation for percent encoding

* Make `quote_plus` a `stricturl` option

* Add docs for `stricturl(quote_plus=True)`

* Better changes message for #3061

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>

* Fix precent encoding version note to V1.10

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>

* Fix `Building URLs` snippit markdown

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>

* Fix formatting for `docs/examples/types_url_building.py`

* fix docs

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2022-08-19 09:20:20 +00:00
commonism 78e84b92c0 update links to https://github.com/pydantic/… (#4398)
Co-authored-by: Markus Koetter <koetter@cispa.de>
2022-08-19 07:46:58 +01:00
Samuel Colvin 2f883b9509 fix pattern matching version, ref #3921 (#4384) 2022-08-16 22:29:59 +01:00
rafael 7344374dd0 BaseModel: Document and test structural pattern matching (#3921)
* BaseModel: Add __match_args__ attribute to namespace

* changelog

* amend docs

* add tests

* Update changes/3920-irgolic.md

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>

* Update .github/workflows/ci.yml

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>

* rename test_match => test_structural_pattern_matching

* pytest.skip => pytest.mark.skipif

* Revert "BaseModel: Add __match_args__ attribute to namespace"

This reverts commit 79367356fddac90b047b10620dc895425ec25b40.

* adjust tests for kwarg only structural pattern matching

* adjust docs for kwarg only pattern matching

* changes: Support => Document

* fix docs?

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
2022-08-16 08:47:17 +02:00
Hasan Ramezani 4e7878932c Update Python version in contributing doc (#4376) 2022-08-14 20:57:03 +00:00
Hasan Ramezani c5d57b7cf5 Fix the behavior change in .json() documentation (#4371)
* Fix the behavior change in `.json()` documentation

* Add breaking change to original change in HISTORY.md
2022-08-14 17:46:24 +00:00
Samuel Colvin cc68900274 Build binaries for Python 3.11 (#4374)
* build binaries for python 3.11

* add change

* [skip ci] revert CI if comment

* add 3.11 to pypi classifiers
2022-08-14 18:32:33 +01:00