fix: provide __version__ attribute (#2573)

* fix: provide __version__ attribute

Pyinstaller is giving an error packaging a script that uses pydantic, "AttributeError: Module 'pydantic' has no attribute '__version__'"

See Issue #2572

* chore: add md file in changes folder

* test: __version__ attribute of pydantic module
This commit is contained in:
Pax
2021-05-09 05:44:55 -07:00
committed by GitHub
parent 31c4efb7f0
commit 68784f63c0
3 changed files with 12 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
Add `__version__` attribute to pydantic module.
+2
View File
@@ -14,6 +14,8 @@ from .tools import *
from .types import *
from .version import VERSION
__version__ = VERSION
# WARNING __all__ from .errors is not included here, it will be removed as an export here in v2
# please use "from pydantic.errors import ..." instead
__all__ = [
+9
View File
@@ -0,0 +1,9 @@
import pydantic
def test_version_attribute_is_present():
assert hasattr(pydantic, '__version__')
def test_version_attribute_is_a_string():
assert isinstance(pydantic.__version__, str)