Skip to content

Commit 04be8f8

Browse files
authored
Merge pull request #1244 from beenje/cfep-index
Add an index of CFEPs
2 parents 1a5610e + 1f51dfc commit 04be8f8

File tree

4 files changed

+79
-0
lines changed

4 files changed

+79
-0
lines changed

.ci_scripts/generate_cfep_index.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import re
2+
import requests
3+
from dataclasses import dataclass
4+
from pathlib import Path
5+
6+
REPO_CONTENTS = "https://api.github.com/repos/conda-forge/cfep/contents/"
7+
TITLE_PATTERN = "<td>\s*Title\s*</td><td>\s*(.*)\s*</td>"
8+
STATUS_PATTERN = "<td>\s*Status\s*</td><td>\s*(.*)\s*</td>"
9+
REPO_DIR = Path(__file__).parents[1].absolute()
10+
CFEP_INDEX_RST = REPO_DIR / "src" / "orga" / "cfep-index.rst"
11+
12+
13+
@dataclass
14+
class Cfep:
15+
filename: str
16+
title: str
17+
status: str
18+
html_url: str
19+
20+
@property
21+
def name(self) -> str:
22+
return self.filename.replace(".md", "")
23+
24+
def rst_link(self) -> str:
25+
clean_title = self.title.replace("`", "")
26+
return f"`{self.name.upper()}: {clean_title} <{self.html_url}>`_ -- *{self.status}*"
27+
28+
def md_link(self) -> str:
29+
return (
30+
f"[{self.name.upper()}: {self.title}]({self.html_url}) -- *{self.status}*"
31+
)
32+
33+
34+
def get_cfeps():
35+
"""Generator that returns all CFEPs from GitHub repo"""
36+
response = requests.get(
37+
REPO_CONTENTS, headers={"Accept": "application/vnd.github.v3+json"}
38+
)
39+
response.raise_for_status()
40+
for content in response.json():
41+
if not content["name"].startswith("cfep"):
42+
continue
43+
if content["name"] == "cfep-00.md":
44+
# Hardcode title and status for CFEP-00
45+
yield Cfep(
46+
content["name"], "CFEP Template", "Proposed", content["html_url"]
47+
)
48+
continue
49+
cfep_response = requests.get(content["download_url"])
50+
cfep_response.raise_for_status()
51+
cfep_text = cfep_response.text
52+
m = re.search(TITLE_PATTERN, cfep_text)
53+
title = m.group(1).strip() if m else ""
54+
m = re.search(STATUS_PATTERN, cfep_text)
55+
status = m.group(1).strip() if m else ""
56+
yield Cfep(content["name"], title, status, content["html_url"])
57+
58+
59+
def write_cfep_index():
60+
with CFEP_INDEX_RST.open("a") as f:
61+
for cfep in get_cfeps():
62+
f.write(f"* {cfep.rst_link()}\n")
63+
64+
65+
if __name__ == "__main__":
66+
write_cfep_index()

.ci_scripts/update_docs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ python .ci_scripts/generate_html.py
2121
mv docs/README docs-README
2222
rm -rf docs/
2323

24+
python .ci_scripts/generate_cfep_index.py
25+
2426
pushd src
2527
make html
2628
mv _build/html ../docs

src/orga/00_intro.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ Organisation Documentation
77
subteams
88
joining-the-team
99
minutes/00_intro
10+
cfep-index
1011
getting-in-touch

src/orga/cfep-index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Index of CFEPs
2+
==============
3+
4+
All major changes to the project should be submitted as conda-forge enhancement proposals (CFEP).
5+
These CFEPs are similar to `Python's PEP <https://www.python.org/dev/peps/>`_ and
6+
`IPython's IPEP <https://github.com/ipython/ipython/wiki/IPEPs:-IPython-Enhancement-Proposals>`_ processes.
7+
8+
CFEPs are stored in the `cfep GitHub repository <https://github.com/conda-forge/cfep>`_.
9+
Below is a list of conda-forge enhancement proposals (CFEP):
10+

0 commit comments

Comments
 (0)