Commit Graph

1472 Commits

Author SHA1 Message Date
Lie Ryan 55fd51fbdf ByteSize.human_readable() should not have decimal point with B suffix (#4777)
ByteSize can only represent whole number of bytes, so displaying a
decimal would be misleading and doesn't really make sense in most cases
where ByteSize is used.

Outside pure mathematics, it is very rare to use non-whole number bytes.

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2022-12-15 11:28:29 +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
Samuel Colvin 585ec35bd7 continue from #4809 (#4814) 2022-12-05 10:07:22 +00:00
dependabot[bot] 90f42508a9 build(deps): bump carloscastrojumo/github-cherry-pick-action (#4809)
Bumps [carloscastrojumo/github-cherry-pick-action](https://github.com/carloscastrojumo/github-cherry-pick-action) from 1.0.3 to 1.0.4.
- [Release notes](https://github.com/carloscastrojumo/github-cherry-pick-action/releases)
- [Commits](https://github.com/carloscastrojumo/github-cherry-pick-action/compare/v1.0.3...v1.0.4)

---
updated-dependencies:
- dependency-name: carloscastrojumo/github-cherry-pick-action
  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-12-05 10:48:56 +01:00
Marcelo Trylesinski b6264ae8a1 Add dependencies to fake setup.py (#4804) 2022-11-30 17:39:59 +00:00
Marcelo Trylesinski caa318c908 Remove trailing "```" (#4799) 2022-11-29 15:43:30 +01:00
Arseny Boykov 8b7c568794 [1.10.x] Properly encode model and dataclass default for schema (#4781)
* Properly encode model and dataclass default for schema

* Wrap type annotation in quotes

* Fix compatibility

* Add changes file

* Remove unnecessary import

Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>

* Add a blank line back

* Reorder conditions

As per suggestion in https://github.com/pydantic/pydantic/pull/4781#discussion_r1034709528.

Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2022-11-29 13:14:29 +00:00
Samuel Colvin 1ac1199f08 docs build, bust cache? (#4778) 2022-11-23 09:40:27 +00: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
Adrian Garcia Badaracco 13ad034e44 Add strict option to BaseConfig (#4753) 2022-11-11 20:59:22 +00:00
Samuel Colvin 35c7aff1c4 Use 3.10 for all reqs resolution and add a Makefile target for re-locking (#4748) 2022-11-10 11:16:07 -06: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
Samuel Colvin be72998a1e Revert "test docs with all.txt"
This reverts commit b2e70742c3.
2022-11-10 10:41:44 +00:00
Samuel Colvin b2e70742c3 test docs with all.txt 2022-11-10 10:39:04 +00:00
Samuel Colvin 581d287d3b more friendly PR template 2022-11-10 10:26:16 +00:00
Samuel Colvin 4d773bb96b skip mypy tests on py3.11, switch pytest-sugar -> pytest-pretty (#4738)
* skip mypy tests on py3.11

* improve comment

* switch pytest-sugar -> pytest-pretty, other uprevs
2022-11-08 11:57:13 +00:00
Johnny Hsieh a73d62b8f4 Fix improper parsing of Enum document (#4734)
* Clean schema document for Enum

* Import inspect

* Make inspect import locally

* Add test
2022-11-08 11:25:51 +00:00
Samuel Colvin a7656fcd09 Support extracting attributes from the parent namespace (#4663)
* support extracting attributes from the parent namespace

* fix more tested test

* move parent_frame_namespace
2022-11-08 10:26:24 +00:00
Samuel Colvin 8d98c499df url parsing in pydantic-core (#4732)
* url parsing in pydantic-core

* fix tests

* fix mypy tests
2022-11-08 09:42:38 +00:00
Adrian Garcia Badaracco 9e1f2a6f7c feat: add strict to Field (#4713)
* feat: add strict to Field

* skip if not set

* Update pydantic/fields.py

* Move model into fixture
2022-11-07 16:40:19 +00:00
Samuel Colvin a57346ac49 Move to ruff for linting (#4709)
* WIP to move to ruff for linting

* add extend-select, fix string
2022-11-03 13:45:34 +00:00
Evorage 5cbfcba510 Trivial Markdown Fix (#4711) 2022-11-03 11:42:13 +00:00
Adrian Garcia Badaracco c381e5b73e replace U+2019 with U+0027 in docstrings (#4714) 2022-11-03 07:46:18 +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
Samuel Colvin f7ff485fd7 use released version of 3.11 (#4661) 2022-10-27 12:48:55 +00:00
Sviatoslav Sydorenko da7e6f89a7 Introduce a gate/check GHA job (#4615)
* Introduce a gate/check GHA job

This adds a GHA job that reliably determines if all the required
dependencies have succeeded or not.

It also allows to reduce the list of required branch protection CI
statuses to just one — `check`. This reduces the maintenance burden
by a lot and have been battle-tested across a small bunch of projects
in its action form and in-house implementations of other people.

It is now in use in aiohttp (and other aio-libs projects), CherryPy,
attrs, coveragepy, some of the Ansible repositories, pip-tools,
spaceship-prompt, all of the jaraco's projects (like `setuptools`,
`importlib_metadata`), some PyCQA, PyCA, PyPA and pytest projects, a
few AWS Labs projects.

The story behind this is explained in more detail at
https://github.com/marketplace/actions/alls-green#why.

* Stop allowing `test-old-mypy` to fail

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

* Fix a typo in "commend"

Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
2022-10-20 07:55:05 +01: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
dependabot[bot] 12158b8943 build(deps): bump actions/checkout from 2 to 3 (#4579)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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-10-07 09:10:24 +02:00
dependabot[bot] bb9b9a4c4b build(deps): bump carloscastrojumo/github-cherry-pick-action (#4580)
Bumps [carloscastrojumo/github-cherry-pick-action](https://github.com/carloscastrojumo/github-cherry-pick-action) from 1.0.1 to 1.0.3.
- [Release notes](https://github.com/carloscastrojumo/github-cherry-pick-action/releases)
- [Commits](https://github.com/carloscastrojumo/github-cherry-pick-action/compare/v1.0.1...v1.0.3)

---
updated-dependencies:
- dependency-name: carloscastrojumo/github-cherry-pick-action
  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-10-07 09:09:23 +02:00
Samuel Colvin 1a5b56e1b2 lower coverage threshold during V2 development 2022-09-24 21:18:19 +01:00
Samuel Colvin 60cad30b2c Remove superfluous (???) files from sdist (#4542)
* remove superfluous files from sdist

* split TOML tables

* remove unnecessary stars

Co-authored-by: Ofek Lev <ofekmeister@gmail.com>

* switch to "include" in preference to "exclude"

Co-authored-by: Ofek Lev <ofekmeister@gmail.com>
2022-09-22 09:15:23 +00: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 80f016ecd6 add label when cherry-picking 2022-09-20 18:38:33 +01:00
Samuel Colvin 7d5ba748a4 tweak cherry-pick.yml action 2022-09-20 18:32:56 +01: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 e4a0561dbc add github token to cherry-pick 2022-09-20 14:50:46 +01:00
Samuel Colvin e0b8e0530b tiny tweak to docs (#4543) 2022-09-20 14:48:59 +01:00
Samuel Colvin 2e834fecfb add cherry-pick action 2022-09-20 14:21:16 +01:00
Ofek Lev 523c62252a Restore PyPI landing page (#4520)
* Restore PyPI landing page

* address

* add license expression

* tweak fancy-pypi-readme setup

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2022-09-20 10:58:51 +00:00
Marcelo Trylesinski abd687700a Update mkdocs.yml (#4524) 2022-09-16 10:47:37 +02:00
Samuel Colvin eaa5eaafa1 fix license in pyproject.toml before it bites us 2022-09-15 16:34:23 +01:00
Dmitry Lavrentev 996101b8ba fix: missing file extension in model_config.md link (#4512) 2022-09-13 09:39:31 +02:00