Commit Graph

632 Commits

Author SHA1 Message Date
Sebastián Ramírez ea709cc66f Add FastAPI tests to Pydantic's CI tests (#1075)
fix #1041

* Add test-fastapi.sh script, after failing to create reusable variables in Make

* Add test-fastapi Make target

* Add fastapi dir for tests to gitignore

* Add fastapi tests to Travis

* Update test-fastapi to run the minimum (pytest)

* Move make test-fastapi to normal run, no "Without Deps"

* Install Pydantic without Cython for FastAPI tests

* Put FastAPI tests in its own Travis job

* Add PR changes description

* Remove coverage for FastAPI, it's not relevant for Pydantic

* Implement code review changes, refactor Makefile use and fastapi tests

* Add a bug intentionally, to test that FastAPI tests are using the current source

and make sure it actually breaks CI.

* Fix intentional bug. Confirmed it breaks Travis for FastAPI.
2019-12-05 11:35:56 +00:00
Samuel Colvin 890589a610 oops, revert issue templates until version_info() is released 2019-12-04 15:35:51 +00:00
Samuel Colvin 13f4b8989e more strict mypy checks (#1077)
* more strict mypy checks

* add change
2019-12-04 15:15:13 +00:00
Samuel Colvin 9255012c08 add version_info to make creating issues easier (#1071)
* add version_info to make creating issues easier

* improve version_info()

* improve contributing docs
2019-12-04 15:14:53 +00:00
Samuel Colvin 15b981d05f change cython nthreads default to zero (#1074)
* change cython nthreads default to zero

* add change
2019-12-04 13:30:30 +00:00
Kieran Darcy 9982eb43dd Change BaseModel.parse_file to use Config.json_loads (#1069)
fix #1067

* Making json_loads available to parse_file

* Change BaseModel.parse_file to use Config.json_loads

* Update changes/1067-kierandarcy.md

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* Fixed some style issues and added missing test for parse_file_as
2019-12-03 15:05:27 +00:00
dependabot-preview[bot] d059fded52 Bump pygments from 2.5.1 to 2.5.2 (#1046)
Bumps [pygments](https://github.com/pygments/pygments) from 2.5.1 to 2.5.2.
- [Release notes](https://github.com/pygments/pygments/releases)
- [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES)
- [Commits](https://github.com/pygments/pygments/compare/2.5.1...2.5.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-02 13:59:44 +00:00
Samuel Colvin 92c9b10a75 clarify meaning of camel case, fix #1056 (#1063) 2019-12-02 13:10:39 +00:00
dmontagu d538df5fbb Update for compatibility with mypy 0.750 (#1058)
* Update for compatibility with mypy 0.750

* Remove coverage checks for 0.740 compatibility
2019-12-02 13:09:37 +00:00
Samuel Colvin c37ac1c5e6 Warnings for optional required, fix #1047 (#1048) 2019-12-02 12:47:56 +00:00
Aviram Hassan 1b9f08bead Dataclass is now compatible with schema methods (#1045) 2019-12-02 12:44:21 +00:00
Samuel Colvin 151143deb4 coverage for UndefinedType 2019-11-28 18:28:51 +00:00
Samuel Colvin b521f6b24a prepare v1.2 (#1042)
* making field-reuse idempotent (#1016)

* making field-reuse idempotent

* fix for 3.6

* correct change details

* uprev

* generate HISTORY.md
2019-11-28 17:46:43 +00:00
Sebastián Ramírez d9bbb05a16 Implement Optional required (#1031)
* Implement Optional required, when creating a ModelField(required=True), make it persist

* Add test for nullable required

* Improve formatting of Undefined custom object

* Refactor field infer/creation with Undefined to make it idempotent

Needed for when _type_analysis is re-run in Generics

* Add PR changes

* Increment/update tests with code review

* Update/refactor Undefined implementation with code review

* Fix BoolUndefined as string type for mypy, not runtime

* Add docs about required Optional

* Add explicit tests for Any

* Apply code review requested changes

* move tests out of test_validators.py
2019-11-28 16:48:33 +00:00
dependabot-preview[bot] cb82d3c74b Bump pytest from 5.3.0 to 5.3.1 (#1036)
* Bump pytest from 5.3.0 to 5.3.1

Bumps [pytest](https://github.com/pytest-dev/pytest) from 5.3.0 to 5.3.1.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/5.3.0...5.3.1)

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

* combine uprevs
2019-11-28 11:49:07 +00:00
dmontagu c71326d4a6 Add better support for validator reuse (#941)
* Add better support for validator reuse

* Clean up classmethod unpacking

* Add changes

* Fix coverage check

* Make 3.8 compatible

* Update changes/940-dmontagu.md

Co-Authored-By: Samuel Colvin <s@muelcolvin.com>

* Make allow_reuse discoverable by adding to error message

* switch _check_validator_name to _prepare_validator
2019-11-25 15:15:05 +00:00
dmontagu 6564bbb4ce Add parse_as_type function (#934)
* Add parse_as_type function

* Add changes

* Incorporate feedback

* Add naming tests

* Fix double quotes

* Fix docs example

* Reorder parameters; add dataclass and mapping tests

* Rename parse_as_type to parse_obj, and add parse_file

* Incorporate feedback

* Incorporate feedback

* use custom root types
2019-11-25 12:55:15 +00:00
dmontagu 62bc930f57 Add support for mapping types as custom root (#958)
* Add support for mapping types as custom root

* Incorporate feedback

* Add changes

* Incorporate feedback

* Add docs and tests

* Fix linting issue

* Incorporate more feedback

* Add more specific match
2019-11-25 12:19:41 +00:00
dmontagu 643266944c Support typing.Literal in python 3.8 (#1027)
* Support typing.Literal in python 3.8

* Improve import pattern for Literal

* Update references to  in docs

* Try to get build to pass
2019-11-25 11:32:01 +00:00
dependabot-preview[bot] 796b9588c6 Bump twine from 3.0.0 to 3.1.0 (#1029)
Bumps [twine](https://github.com/pypa/twine) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/pypa/twine/releases)
- [Changelog](https://github.com/pypa/twine/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pypa/twine/compare/3.0.0...3.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-25 09:13:34 +00:00
Colin Sullivan 043186cfcd add testimonials section to docs with reference to python bytes podcast episode (#1025)
* add testimonials section with reference to python bytes podcast episode

* added description to changes directory
2019-11-22 16:21:02 +00:00
Samuel Colvin 4e23d4a61f __str__ and __repr__ inheritance for models, fix #1022 (#1023) 2019-11-22 15:29:56 +00:00
dependabot-preview[bot] 95a7aa6021 Bump pytest-mock from 1.12.0 to 1.12.1 (#1018)
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 1.12.0 to 1.12.1.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases)
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v1.12.0...v1.12.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-21 11:49:28 +00:00
dependabot-preview[bot] 56ba84a195 Bump pytest from 5.2.4 to 5.3.0 (#1013)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 5.2.4 to 5.3.0.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/5.2.4...5.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-20 14:20:19 +00:00
dependabot-preview[bot] ed1c0f2e9d Bump pytest-mock from 1.11.2 to 1.12.0 (#1014)
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock) from 1.11.2 to 1.12.0.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases)
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v1.11.2...v1.12.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-20 14:19:55 +00:00
Weston Hunter 8c0f805d15 Update index.md (#1012)
Small typo change.
2019-11-19 23:04:58 +00:00
dependabot-preview[bot] 022885b86d Bump twine from 2.0.0 to 3.0.0 (#1009)
Bumps [twine](https://github.com/pypa/twine) from 2.0.0 to 3.0.0.
- [Release notes](https://github.com/pypa/twine/releases)
- [Changelog](https://github.com/pypa/twine/blob/master/docs/changelog.rst)
- [Commits](https://github.com/pypa/twine/compare/2.0.0...3.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-19 18:28:24 +00:00
Niko Strijbol fd32516e0f Add exclude_none option (#1003)
* add `exclude_none` option (#587)

* run formatter

* Apply @samuelcolvin's suggestions
2019-11-18 13:18:51 +00:00
dependabot-preview[bot] 3b313b2ae7 Bump pytest from 5.2.3 to 5.2.4 (#1007)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 5.2.3 to 5.2.4.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/5.2.3...5.2.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-18 10:14:10 +00:00
dependabot-preview[bot] 95246ef888 Bump mkdocs-material from 4.4.3 to 4.5.0 (#1006)
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 4.4.3 to 4.5.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/4.4.3...4.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-18 10:12:56 +00:00
nwalsh1995 c6e192db04 fix typo: 'frozonset' -> 'frozenset' (#998) 2019-11-15 20:26:38 +00:00
dependabot-preview[bot] 7938cb0edf Bump pytest from 5.2.2 to 5.2.3 (#999)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 5.2.2 to 5.2.3.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/5.2.2...5.2.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-15 20:25:51 +00:00
Daniel Smith c2e0082800 ByteSize conversion (#996)
* Bytesize implement to conversion

* Changelog

* Lint: changes to single quotes

* Update tests/test_types.py

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* Update tests/test_types.py

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* Update tests/test_types.py

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
2019-11-14 16:22:51 +00:00
Koudai Aono 33b3dc1825 mypy plugin support for dataclasses (#966)
* mypy plugin support for dataclassesv

* fix styles and types

* - change type-hint for `Config`
- change name of an expected file
- update documents

* fix broken a reference of a document.

* - update unittest
- update documents

* fix a document link

* Update docs/mypy_plugin.md

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* Update docs/mypy_plugin.md

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* Update docs/mypy_plugin.md

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* remove extra whitespaces on mypy test results

* fix output file name of mypy test

* Update docs/usage/dataclasses.md

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* use TypeVar for DataclassType
2019-11-14 11:26:46 +00:00
Samuel Colvin 0e8f88611f build binaries for python 3.8 (#994)
* build binaries for python 3.8

* change and test with cibuildwheel

* skip codecov on pypi build

* speed up PR ci builds

* better conditional builds

* fix conditional builds

* finish conditional stages
2019-11-14 10:50:34 +00:00
Samuel Colvin e46491d951 move change 2019-11-13 19:20:33 +00:00
Samuel Colvin 677537d1f5 Improve benchmarks (#987)
* add benchmarks for cerberus

* remove toasted-marshmallow, upgrade marshmallow
2019-11-13 15:34:31 +00:00
Samuel Colvin 60a2e92082 correct ad ID 2019-11-11 10:49:30 +00:00
Samuel Colvin caa270a143 correct coverage for overload methods 2019-11-09 18:57:16 +00:00
Samuel Colvin f4cc204138 fix mypy complaint on @root_validator(pre=True) (#985)
* fix mypy complaint on @root_validator(pre=True)

* fix internal mypy

* use overload on root_validator
2019-11-09 14:45:29 +00:00
Daniel Smith b92e74d0a6 Bytesize (#977)
* ByteSize object

* Human readable format

* Lint, tests, and docs

* Update pydantic/errors.py

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* Update pydantic/types.py

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* Update pydantic/types.py

Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>

* Allows human readable decimal descriptor

* Review comments

* Less verbose testing

* ByteSize docs

* Reworks valid units

* Missing type

* tweak tests
2019-11-09 12:39:02 +00:00
Alexander Hirner c188b3fba8 Feature/dataclass schema defaults (#980)
* default dataclass field from default_factory

* silence mypy regarding issue 708

* test dataclass factory function default

* test default factory ending up in schema

* add changes md

* add docs for dataclass default factory and basemodel access

* fully print default factory schema
2019-11-09 12:29:15 +00:00
Samuel Colvin 4218ff7f36 rename cattr > cattrs, update benchmarks 2019-11-08 17:41:12 +00:00
George Sakkis 69737c3aa3 Add benchmark for valideer (#670)
* Add benchmark for valideer

* valideer version and update benchmarks

* add change

* correct benchmarks
2019-11-08 17:34:39 +00:00
Samuel Colvin f10680dd75 add buy-sell-ads advert to docs (#978)
* add buy-sell-ads advert to docs

* hide ad box on mobile
2019-11-08 17:16:46 +00:00
Sebastian Mika b87ca4ee05 benchmark for cattrs (#513)
* benchmark for attr

* update HISTORY.rst

* * added benchmark using cattr
* add env "ATTRS=1" to benchmark runner to only compare again the two
  and save results in separate csv
* added section to docs/index

* nits

* re-run benchmark with cython pydantic; merge results back to main benchmarks results table

* pin pydantic to top of benchmark report

* remove attrs, fix cattrs

* update benchmarks output

* add change
2019-11-08 17:04:41 +00:00
Samuel Colvin f9576e7a45 python 3.8 tests on azure (#973)
* python 3.8 tests on azure

* bump

* use windows-latest and azure image
2019-11-08 16:39:14 +00:00
Daniel Smith a34118f392 Adds MolSSI to companies (#983) 2019-11-08 15:20:20 +00:00
Samuel Colvin 093474ae27 fix coverage on generics.py (#976) 2019-11-07 16:24:12 +00:00
Samuel Colvin 8a261c1dfa uprev and generate history 2019-11-07 15:20:27 +00:00