With CentOS 7 Python 3.6, running install from source with pip failed:
sudo podman run -ti --rm centos:7
yum -y update
yum -y install epel-release
yum -y install git python3 python3-devel python3-pip python3-setuptools python3-wheel
git clone https://github.com/samuelcolvin/pydantic.git
cd pydantic
pip3 install .
With following error message:
[root@c99d0585636c pydantic]# pip3 install .
Processing /pydantic
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-91v_ixvz-build/setup.py", line 62, in <module>
history = (THIS_DIR / 'HISTORY.md').read_text()
File "/usr/lib64/python3.6/pathlib.py", line 1197, in read_text
return f.read()
File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 14648: ordinal not in range(128)
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-91v_ixvz-build/
This PR add the required `read_text(encoding='utf-8')` for `setup.py`.
Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
* refactor: extra `BaseConfig` and `Extra` in dedicated `config` module
* refactor: clean useless `#noqa: F401`
* refactor: clean useless `#noqa: F811`
* refactor: replace enum check
Error with 3.10
> DeprecationWarning: accessing one member from another is not supported
* refactor: avoid using `distutils` directly
error with python 3.10
> DeprecationWarning: The distutils package is deprecated and slated
> for removal in Python 3.12.
> Use setuptools or check PEP 632 for potential alternatives
* fix: `__annotations__` always exists
* fix: origin of `typing.Hashable` is not `None`
* ci: add run with 3.10.0b2
* docs: add 3.10
* feat: support `|` union operator properly
`|` operator has origin `types.Union` (and not `typing.Union`)
* fix: enum repr is different with 3.10+
* fix: error message changed a bit
change from basic `__init__` to `test_hashable_required.<locals>.MyDataclass.__init__()` (with `__qualname__`)
* fix: always exists and is not inherited anymore
* fix: avoid calling `asyncio.get_event_loop` directly
With python 3.10, calling it results in
> DeprecationWarning: There is no current event loop
* fix(ci): do not run 3.10 on linux for now
For now it can not be compiled.
Let's just skip the check on linux for now instead of tuning the CI pipeline
* fix(ci): ignore DeprecationWarning raised by `mypy` on windows
* docs: add change file
* Infer root type from Annotated
* Extract Field from Annotated
* Add changelog
* Extend existing get_args/get_origin
* Fix Annotated on py3.6 without typing-extensions
* Handle Ellipsis default
* Fix field reuse after FieldInfo.default mutation
* Fix ci
* linting as a separate ci step
* CI and docs improvements
* fix docs preview
* fix docs, benchmarks fastapi tests
* fix formatting and docs build
* tweak publishing docs
* fix for new download-artifact action
* skip check tag to check docs build
* prepare for merge
* feat: use partially get_origin and get_args from typing
Rework of d86a184072655d93652d6ea941421005f34de962 by @hmvp
We cannot directly use `typing.get_origin` and `typing.get_args` for
our custom types for which args and origin are wrong by default.
But at least we now have a unified behaviour, which can be improved
in the near future
* feat: add fallback in `get_args` for generics in python 3.9
* feat: add new `_evaluate` for python 3.9
In python 3.9, `typing._evaluate` has a new required
positional argument `recursive_guard`
* chore: add pragma no cover for python 3.9 fallbacks
* chore: add change file
* chore: add comments
* feat(ci): add python 3.9 support
* fix: mypy assumption is wrong
* allow use of a `.env`-style files in BaseSettings (#607)
* address various issues with initial implementation
- allow specifying `_env_file` kwarg in instantiation
* overrides any `env_file` specified in the `Config` class
- cast `os.environ` as a dict for better consistenty of behavior
- `env_path` should be a `Path` type
- replace `with open()` with `read_text`
- use regex for parsing the dotenv files and throw error on invalid line
- factor out `read_env_file` into separate file for easier testing
* move back into a single file; revert typing changes; use regex better
* pass `_env_file` argument around instead of setting a class attribute
* add dotenv docs
* add dotenv tests
* Add changes file
* Flesh out the docs a bit
* Apply suggestions from @samuelcolvin's code review
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* wrap docs
* add not about priority
* fix tests and imports
* fix tests
* switch to python-dotenv
* cleanup, test example
* more docs tweaks
* typo
* fix tests for dotenv
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* moving docs to mkdocs
* transfering readme to md and more
* fixing build
* splitting usage.md
* improving schema.md and index.md
* fix make_history.rst
* models intro
* working on data conversation and required fields
* more fixes to models.md
* list all standard types supported
* list of pydantic types
* tweaks
* update links in code
* Apply suggestions from code review
incorporate @dmontagu's suggestions.
Co-Authored-By: dmontagu <35119617+dmontagu@users.noreply.github.com>
* Apply suggestions from code review
more missed suggestions.
Co-Authored-By: dmontagu <35119617+dmontagu@users.noreply.github.com>
* Apply suggestions from code review
more corrects.
* cleanup
* Field order warning
* fix and regenerate benchmarks
* format examples better, cleanup
* improve schema mapping table
* correct highlighting file types in schema.md
* add redirects in javascript
* add logo
* big performance improvement!
* exception performance improvement
* check errors and explicit export from errors.py
* more tweaks
* fix coverage
* fix tests and remove "from e" in exceptions for performance
Whilst working on the Reproducible Builds effort [0] we noticed
that pydantic could not be built reproducibly.
This is due to it generating the contents of the `PKG-INFO` file
via iterating over the contents of a set.
This was originally filed in Debian as #940156 [1].
[0] https://reproducible-builds.org/
[1] https://bugs.debian.org/940156
Signed-off-by: Chris Lamb <lamby@debian.org>
fix#561
* Add support for Literal annotation
* Updated requirements.txt
* incorporating feedback
* skip typing_extensions tests if not installed
* missed a spot
* address feedback
* Make work with python 3.6
* Work for *both* 3.6 and 3.7
* incorporate feedback
* fixed naming and quotes
* Trying to fix LGTM bot issue
* Added generic functionality
* Skip tests in python 3.6
* double quote -> single quote
* Simplified, with more comprehensive tests
* double quote -> single quote
* Remove unintentional file
* Add caching
* don't cythonize generics.py
* Make work with mypy
* Remove __parameters__
* double quote -> single quote i'll remember one day
* More cleanup and validation
* Removed unwanted file
* A little more cleanup, and finish the PR
* Add proper inheritance
* Added note about inheritance to docs
* Added error for double-parameterizing
* Should build for python3.7
* Works with both 3.6 and 3.7
* Fixed bug with caching for single argument
* handle __name__ for generic models
* double quote -> single quote
* Updated error messages
* working on parsers
* starting parse tests
* proper tests for parse
* adding parse docs
* tweaks and history
* add test for datetime direct, fix tests
* tweak docs