Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
encourage use of version_info() in issues (#1138)
* encourage use of version_info() in issues * improve grammar and add change * switch test import
- Loading branch information
1 parent
8a53350
commit e169bd6
Showing
8 changed files
with
80 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
move `version_info()` to `version.py`, suggest its use in issues. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,30 @@ | ||
__all__ = ['VERSION'] | ||
__all__ = ['VERSION', 'version_info'] | ||
|
||
VERSION = '1.3' | ||
VERSION = '1.3a1' | ||
|
||
|
||
def version_info() -> str: | ||
import platform | ||
import sys | ||
from importlib import import_module | ||
from pathlib import Path | ||
|
||
from .main import compiled | ||
|
||
optional_deps = [] | ||
for p in ('typing-extensions', 'email-validator', 'devtools'): | ||
try: | ||
import_module(p.replace('-', '_')) | ||
except ImportError: | ||
continue | ||
optional_deps.append(p) | ||
|
||
info = { | ||
'pydantic version': VERSION, | ||
'pydantic compiled': compiled, | ||
'install path': Path(__file__).resolve().parent, | ||
'python version': sys.version, | ||
'platform': platform.platform(), | ||
'optional deps. installed': optional_deps, | ||
} | ||
return '\n'.join('{:>30} {}'.format(k + ':', str(v).replace('\n', ' ')) for k, v in info.items()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters