mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
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:
@@ -0,0 +1 @@
|
||||
Add `__version__` attribute to pydantic module.
|
||||
@@ -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__ = [
|
||||
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user