Skip to content

Commit

Permalink
Merge branch 'master' into fix/each-item-once
Browse files Browse the repository at this point in the history
  • Loading branch information
PrettyWood committed Nov 29, 2020
2 parents ce879ea + 7c3919c commit c0a4377
Show file tree
Hide file tree
Showing 96 changed files with 3,160 additions and 587 deletions.
109 changes: 60 additions & 49 deletions .github/workflows/ci.yml
Expand Up @@ -9,13 +9,41 @@ on:
pull_request: {}

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: set up python
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: install
run: |
make install-linting
pip freeze
- name: lint
run: make lint

- name: mypy
run: make mypy

- name: make history
run: python3 ./changes/make_history.py

- name: check dist
run: make check-dist

test-linux:
name: test py${{ matrix.python-version }} on ubuntu
name: test py${{ matrix.python-version }} on linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.6', '3.7', '3.8']
python-version: ['3.6', '3.7', '3.8', '3.9']
env:
PYTHON: ${{ matrix.python-version }}
OS: ubuntu
Expand All @@ -28,26 +56,14 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: install dependencies
- name: install
run: |
make install
make install-testing
pip freeze
- name: lint
run: make lint

- name: mypy
run: make mypy

- name: make history
run: python3 ./changes/make_history.py

- name: check dist
run: make check-dist

- name: compile
run: |
make build-cython-trace
make build-trace
python -c "import sys, pydantic; print('compiled:', pydantic.compiled); sys.exit(0 if pydantic.compiled else 1)"
ls -alh
ls -alh pydantic/
Expand All @@ -56,7 +72,7 @@ jobs:
run: make test

- run: coverage xml
- uses: codecov/codecov-action@v1.0.13
- uses: codecov/codecov-action@v1.0.14
with:
file: ./coverage.xml
env_vars: COMPILED,DEPS,PYTHON,OS
Expand All @@ -71,7 +87,7 @@ jobs:
run: make test

- run: coverage xml
- uses: codecov/codecov-action@v1.0.13
- uses: codecov/codecov-action@v1.0.14
with:
file: ./coverage.xml
env_vars: COMPILED,DEPS,PYTHON,OS
Expand All @@ -89,7 +105,7 @@ jobs:
run: make test

- run: coverage xml
- uses: codecov/codecov-action@v1.0.13
- uses: codecov/codecov-action@v1.0.14
with:
file: ./coverage.xml
env_vars: COMPILED,DEPS,PYTHON,OS
Expand All @@ -103,7 +119,7 @@ jobs:
fail-fast: false
matrix:
os: [macos, windows]
python-version: ['3.6', '3.7', '3.8']
python-version: ['3.6', '3.7', '3.8', '3.9']
env:
PYTHON: ${{ matrix.python-version }}
OS: ${{ matrix.os }}
Expand All @@ -120,20 +136,14 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: install
run: make install

- name: lint
run: make lint

- name: mypy
run: make mypy
run: make install-testing

- name: test
run: make test

- run: coverage xml

- uses: codecov/codecov-action@v1.0.13
- uses: codecov/codecov-action@v1.0.14
with:
file: ./coverage.xml
env_vars: COMPILED,DEPS,PYTHON,OS
Expand All @@ -149,7 +159,11 @@ jobs:
with:
python-version: '3.7'

- run: make test-fastapi
- name: install
run: make install-testing

- name: test
run: make test-fastapi

benchmark:
name: run benchmarks
Expand All @@ -163,33 +177,26 @@ jobs:
- name: set up python
uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8'

- name: install and build
run: |
make install
make build-cython
pip install -r benchmarks/requirements.txt
make build
make install-benchmarks
- run: make benchmark-pydantic
- run: make benchmark-all
- run: make benchmark-json

build:
name: build py3.${{ matrix.python-version }} on ${{ matrix.platform || matrix.os }}
needs: [test-linux, test-windows-mac, test-fastapi]
needs: [lint, test-linux, test-windows-mac, test-fastapi]
if: "success() && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master')"
strategy:
fail-fast: false
matrix:
os:
- ubuntu
- macos
- windows
python-version:
- '6'
- '7'
- '8'
os: [ubuntu , macos , windows]
python-version: ['6', '7', '8', '9']
include:
- os: ubuntu
platform: linux
Expand All @@ -206,12 +213,10 @@ jobs:
python-version: '3.8'

- name: install
run: |
make install
pip install -U setuptools wheel cibuildwheel
run: pip install -U twine setuptools wheel cibuildwheel

- name: build sdist
if: matrix.os == 'ubuntu' && matrix.python-version == '8'
if: matrix.os == 'ubuntu' && matrix.python-version == '9'
run: python setup.py sdist bdist_wheel
env:
SKIP_CYTHON: 1
Expand Down Expand Up @@ -260,14 +265,20 @@ jobs:
uses: actions/download-artifact@v2
with:
name: pypi_files
path: dist

- name: install
run: make install
run: |
make install-docs
pip install -U twine
- name: twine check
run: |
mv pypi_files dist
twine check dist/*
ls -lh dist
- name: build docs
run: make docs

- name: check tag
run: ./tests/check_tag.py
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs-preview.yml
Expand Up @@ -14,7 +14,7 @@ jobs:
python-version: 3.8

- name: install
run: make install
run: make install-docs

- name: build site
run: |
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Expand Up @@ -4,6 +4,9 @@ venv/
env36/
env37/
env38/
env39/
Pipfile
*.lock
*.py[cod]
*.egg-info/
.python-version
Expand All @@ -30,4 +33,4 @@ pydantic/*.so
/sandbox/
/.ghtopdep_cache/
/fastapi/
/codecov.sh
/codecov.sh
76 changes: 76 additions & 0 deletions HISTORY.md
@@ -1,3 +1,79 @@
## v1.7.2 (2020-11-01)

* fix slow `GenericModel` concrete model creation, allow `GenericModel` concrete name reusing in module, #2078 by @MrMrRobat
* keep the order of the fields when `validate_assignment` is set, #2073 by @PrettyWood
* forward all the params of the stdlib `dataclass` when converted into _pydantic_ `dataclass`, #2065 by @PrettyWood

## v1.7.1 (2020-10-28)

Thank you to pydantic's sponsors:
@timdrijvers, @BCarley, @chdsbd, @tiangolo, @matin, @linusg, @kevinalh, @jorgecarleitao, @koxudaxi, @primer-api, @mkeen
for their kind support.

* fix annotation of `validate_arguments` when passing configuration as argument, #2055 by @layday
* Fix mypy assignment error when using `PrivateAttr`, #2048 by @aphedges
* fix `underscore_attrs_are_private` causing `TypeError` when overriding `__init__`, #2047 by @samuelcolvin
* Fixed regression introduced in v1.7 involving exception handling in field validators when `validate_assignment=True`, #2044 by @johnsabath
* fix: _pydantic_ `dataclass` can inherit from stdlib `dataclass`
and `Config.arbitrary_types_allowed` is supported, #2042 by @PrettyWood

## v1.7 (2020-10-26)

Thank you to pydantic's sponsors:
@timdrijvers, @BCarley, @chdsbd, @tiangolo, @matin, @linusg, @kevinalh, @jorgecarleitao, @koxudaxi, @primer-api
for their kind support.

### Highlights

* python 3.9 support, thanks @PrettyWood
* [Private model attributes](https://pydantic-docs.helpmanual.io/usage/models/#private-model-attributes), thanks @MrMrRobat
* ["secrets files" support in `BaseSettings`](https://pydantic-docs.helpmanual.io/usage/settings/#secret-support), thanks @mdgilene
* [convert stdlib dataclasses to pydantic dataclasses and use stdlib dataclasses in models](https://pydantic-docs.helpmanual.io/usage/dataclasses/#stdlib-dataclasses-and-pydantic-dataclasses), thanks @PrettyWood

### Changes

* **Breaking Change:** remove `__field_defaults__`, add `default_factory` support with `BaseModel.construct`.
Use `.get_default()` method on fields in `__fields__` attribute instead, #1732 by @PrettyWood
* Rearrange CI to run linting as a separate job, split install recipes for different tasks, #2020 by @samuelcolvin
* Allows subclasses of generic models to make some, or all, of the superclass's type parameters concrete, while
also defining new type parameters in the subclass, #2005 by @choogeboom
* Call validator with the correct `values` parameter type in `BaseModel.__setattr__`,
when `validate_assignment = True` in model config, #1999 by @me-ransh
* Force `fields.Undefined` to be a singleton object, fixing inherited generic model schemas, #1981 by @daviskirk
* Include tests in source distributions, #1976 by @sbraz
* Add ability to use `min_length/max_length` constraints with secret types, #1974 by @uriyyo
* Also check `root_validators` when `validate_assignment` is on, #1971 by @PrettyWood
* Fix const validators not running when custom validators are present, #1957 by @hmvp
* add `deque` to field types, #1935 by @wozniakty
* add basic support for python 3.9, #1832 by @PrettyWood
* Fix typo in the anchor of exporting_models.md#modelcopy and incorrect description, #1821 by @KimMachineGun
* Added ability for `BaseSettings` to read "secret files", #1820 by @mdgilene
* add `parse_raw_as` utility function, #1812 by @PrettyWood
* Support home directory relative paths for `dotenv` files (e.g. `~/.env`), #1803 by @PrettyWood
* Clarify documentation for `parse_file` to show that the argument
should be a file *path* not a file-like object, #1794 by @mdavis-xyz
* Fix false positive from mypy plugin when a class nested within a `BaseModel` is named `Model`, #1770 by @selimb
* add basic support of Pattern type in schema generation, #1767 by @PrettyWood
* Support custom title, description and default in schema of enums, #1748 by @PrettyWood
* Properly represent `Literal` Enums when `use_enum_values` is True, #1747 by @noelevans
* Allows timezone information to be added to strings to be formatted as time objects. Permitted formats are `Z` for UTC
or an offset for absolute positive or negative time shifts. Or the timezone data can be omitted, #1744 by @noelevans
* Add stub `__init__` with python 3.6 signature for `ForwardRef`, #1738 by @sirtelemak
* Fix behaviour with forward refs and optional fields in nested models, #1736 by @PrettyWood
* add `Enum` and `IntEnum` as valid types for fields, #1735 by @PrettyWood
* Change default value of `__module__` argument of `create_model` from `None` to `'pydantic.main'`.
Set reference of created concrete model to it's module to allow pickling (not applied to models created in
functions), #1686 by @MrMrRobat
* Add private attributes support, #1679 by @MrMrRobat
* add `config` to `@validate_arguments`, #1663 by @samuelcolvin
* Allow descendant Settings models to override env variable names for the fields defined in parent Settings models with
`env` in their `Config`. Previously only `env_prefix` configuration option was applicable, #1561 by @ojomio
* Support `ref_template` when creating schema `$ref`s, #1479 by @kilo59
* Add a `__call__` stub to `PyObject` so that mypy will know that it is callable, #1352 by @brianmaissy
* `pydantic.dataclasses.dataclass` decorator now supports built-in `dataclasses.dataclass`.
It is hence possible to convert an existing `dataclass` easily to add *pydantic* validation.
Moreover nested dataclasses are also supported, #744 by @PrettyWood

## v1.6.1 (2020-07-15)

* fix validation and parsing of nested models with `default_factory`, #1710 by @PrettyWood
Expand Down

0 comments on commit c0a4377

Please sign in to comment.