mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
c24d33e5f1
* Generate docs exampels for Python 3.10 and above Code quality is not great and main intent here is to show the result. * Fix docs build on 3.9 * Build docs on 3.10 * What's Python 3.1? * Create temp dir if not exists * Refactor and improve imlementetion * Keep runtime typing in examples * Revert unrelated formatting changes * Add changes file * Allow specifying requirements in examples * Pin autoflake and pyupgrade * Add docs/build to Makefile lint/format/mypy * ignore_missing_imports for ansi2html and devtools * Add .tmp-projections to .gitignore * Remove dont-upgrade now when Pattern is supported * Update postponed evaluation examples Co-authored-by: Samuel Colvin <s@muelcolvin.com>
32 lines
1022 B
Python
Executable File
32 lines
1022 B
Python
Executable File
#!/usr/bin/env python3
|
|
import re
|
|
import sys
|
|
from importlib.machinery import SourceFileLoader
|
|
from pathlib import Path
|
|
|
|
THIS_DIR = Path(__file__).parent
|
|
PROJECT_ROOT = THIS_DIR / '..' / '..'
|
|
|
|
|
|
def main() -> int:
|
|
history = (PROJECT_ROOT / 'HISTORY.md').read_text()
|
|
history = re.sub(r'#(\d+)', r'[#\1](https://github.com/pydantic/pydantic/issues/\1)', history)
|
|
history = re.sub(r'(\s)@([\w\-]+)', r'\1[@\2](https://github.com/\2)', history, flags=re.I)
|
|
history = re.sub('@@', '@', history)
|
|
|
|
(PROJECT_ROOT / 'docs/.changelog.md').write_text(history)
|
|
|
|
version = SourceFileLoader('version', str(PROJECT_ROOT / 'pydantic/version.py')).load_module()
|
|
(PROJECT_ROOT / 'docs/.version.md').write_text(f'Documentation for version: **v{version.VERSION}**\n')
|
|
|
|
sys.path.append(str(THIS_DIR.resolve()))
|
|
from schema_mapping import build_schema_mappings
|
|
from exec_examples import exec_examples
|
|
|
|
build_schema_mappings()
|
|
return exec_examples()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|