/
main.py
executable file
·31 lines (22 loc) · 1 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/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'(\s)#(\d+)', r'\1[#\2](https://github.com/pydantic/pydantic/issues/\2)', 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())