25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

39 lines
1.0 KiB

  1. __all__ = 'compiled', 'VERSION', 'version_info'
  2. VERSION = '1.10.21'
  3. try:
  4. import cython # type: ignore
  5. except ImportError:
  6. compiled: bool = False
  7. else: # pragma: no cover
  8. try:
  9. compiled = cython.compiled
  10. except AttributeError:
  11. compiled = False
  12. def version_info() -> str:
  13. import platform
  14. import sys
  15. from importlib import import_module
  16. from pathlib import Path
  17. optional_deps = []
  18. for p in ('devtools', 'dotenv', 'email-validator', 'typing-extensions'):
  19. try:
  20. import_module(p.replace('-', '_'))
  21. except ImportError:
  22. continue
  23. optional_deps.append(p)
  24. info = {
  25. 'pydantic version': VERSION,
  26. 'pydantic compiled': compiled,
  27. 'install path': Path(__file__).resolve().parent,
  28. 'python version': sys.version,
  29. 'platform': platform.platform(),
  30. 'optional deps. installed': optional_deps,
  31. }
  32. return '\n'.join('{:>30} {}'.format(k + ':', str(v).replace('\n', ' ')) for k, v in info.items())