PDEP's (pandas enhancement proposals) are not part of the bar navigation. They are included as lists in the "Roadmap" page and linked from there. This preprocessor obtains the list of PDEP's in different status from the directory tree and GitHub.
(context)
| 271 | |
| 272 | @staticmethod |
| 273 | def roadmap_pdeps(context): |
| 274 | """ |
| 275 | PDEP's (pandas enhancement proposals) are not part of the bar |
| 276 | navigation. They are included as lists in the "Roadmap" page |
| 277 | and linked from there. This preprocessor obtains the list of |
| 278 | PDEP's in different status from the directory tree and GitHub. |
| 279 | """ |
| 280 | KNOWN_STATUS = { |
| 281 | "Draft", |
| 282 | "Under discussion", |
| 283 | "Accepted", |
| 284 | "Implemented", |
| 285 | "Rejected", |
| 286 | "Withdrawn", |
| 287 | } |
| 288 | context["pdeps"] = collections.defaultdict(list) |
| 289 | |
| 290 | # accepted, rejected and implemented |
| 291 | pdeps_path = ( |
| 292 | pathlib.Path(context["source_path"]) / context["roadmap"]["pdeps_path"] |
| 293 | ) |
| 294 | for pdep in sorted(pdeps_path.iterdir()): |
| 295 | if pdep.suffix != ".md": |
| 296 | continue |
| 297 | with pdep.open() as f: |
| 298 | title = f.readline()[2:] # removing markdown title "# " |
| 299 | status = None |
| 300 | for line in f: |
| 301 | if line.startswith("- Status: "): |
| 302 | status = line.strip().split(": ", 1)[1] |
| 303 | break |
| 304 | if status not in KNOWN_STATUS: |
| 305 | raise RuntimeError( |
| 306 | f'PDEP "{pdep}" status "{status}" is unknown. ' |
| 307 | f"Should be one of: {KNOWN_STATUS}" |
| 308 | ) |
| 309 | html_file = pdep.with_suffix(".html").name |
| 310 | context["pdeps"][status].append( |
| 311 | { |
| 312 | "title": title, |
| 313 | "url": f"pdeps/{html_file}", |
| 314 | } |
| 315 | ) |
| 316 | |
| 317 | # under discussion |
| 318 | github_repo_url = context["main"]["github_repo_url"] |
| 319 | resp = requests.get( |
| 320 | "https://api.github.com/search/issues?" |
| 321 | f"q=is:pr is:open label:PDEP draft:false repo:{github_repo_url}", |
| 322 | headers=GITHUB_API_HEADERS, |
| 323 | timeout=5, |
| 324 | ) |
| 325 | if resp.status_code == 403: |
| 326 | sys.stderr.write("WARN: GitHub API quota exceeded when fetching pdeps\n") |
| 327 | resp_bkp = requests.get( |
| 328 | context["main"]["production_url"] + "pdeps.json", timeout=5 |
| 329 | ) |
| 330 | resp_bkp.raise_for_status() |
nothing calls this directly
no test coverage detected