32
32
33
33
34
34
def create_pep_json (peps : list [parser .PEP ]) -> str :
35
- pep_dict = {
36
- pep .number : {
37
- "title" : pep .title ,
38
- "authors" : ", " .join (pep .authors .nick for pep .authors in pep .authors ),
39
- "discussions_to" : pep .discussions_to ,
40
- "status" : pep .status ,
41
- "type" : pep .pep_type ,
42
- "created" : pep .created ,
43
- "python_version" : pep .python_version ,
44
- "post_history" : pep .post_history ,
45
- "resolution" : pep .resolution ,
46
- "requires" : pep .requires ,
47
- "replaces" : pep .replaces ,
48
- "superseded_by" : pep .superseded_by ,
49
- "url" : f"https://peps.python.org/pep-{ pep .number :0>4} /" ,
50
- }
51
- for pep in sorted (peps )
52
- }
53
- return json .dumps (pep_dict , indent = 1 )
35
+ return json .dumps ({pep .number : pep .full_details for pep in peps }, indent = 1 )
54
36
55
37
56
38
def create_pep_zero (app : Sphinx , env : BuildEnvironment , docnames : list [str ]) -> None :
@@ -77,7 +59,9 @@ def create_pep_zero(app: Sphinx, env: BuildEnvironment, docnames: list[str]) ->
77
59
pep = parser .PEP (path .joinpath (file_path ).absolute (), authors_overrides )
78
60
peps .append (pep )
79
61
80
- pep0_text = writer .PEPZeroWriter ().write_pep0 (sorted (peps ))
62
+ peps = sorted (peps )
63
+
64
+ pep0_text = writer .PEPZeroWriter ().write_pep0 (peps )
81
65
pep0_path = Path (f"{ pep_zero_filename } .rst" )
82
66
pep0_path .write_text (pep0_text , encoding = "utf-8" )
83
67
@@ -89,7 +73,6 @@ def create_pep_zero(app: Sphinx, env: BuildEnvironment, docnames: list[str]) ->
89
73
env .found_docs .add (pep_zero_filename )
90
74
91
75
# Create peps.json
92
- pep0_json = create_pep_json (peps )
93
- out_dir = Path (app .outdir ) / "api"
94
- out_dir .mkdir (exist_ok = True )
95
- Path (out_dir , "peps.json" ).write_text (pep0_json , encoding = "utf-8" )
76
+ json_path = Path (app .outdir , "api" , "peps.json" ).resolve ()
77
+ json_path .parent .mkdir (exist_ok = True )
78
+ json_path .write_text (create_pep_json (peps ), encoding = "utf-8" )
0 commit comments