Skip to content

Commit cb9f7b6

Browse files
committed
Add workflow info and contribution link
1 parent f97dffd commit cb9f7b6

File tree

3 files changed

+46
-5
lines changed

3 files changed

+46
-5
lines changed

generate.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
from datetime import datetime, timezone
1414
from pathlib import Path
1515
from tempfile import TemporaryDirectory
16-
from typing import cast
16+
from typing import cast, Literal
1717

1818
from git import Repo
1919
from jinja2 import Template
2020

21+
import workflow
2122
import repositories
2223
import build_status
2324
import visitors
@@ -27,7 +28,9 @@
2728

2829

2930
def get_completion_progress() -> (
30-
Iterator[tuple[str, str, float, int, int, bool, bool | None]]
31+
Iterator[
32+
tuple[str, str, float, int, int, bool, bool | None, bool, str | Literal[False]]
33+
]
3134
):
3235
with TemporaryDirectory() as clones_dir:
3336
Repo.clone_from(
@@ -52,12 +55,24 @@ def get_completion_progress() -> (
5255
for lang, repo in repositories.get_languages_and_repos(devguide_dir):
5356
built = lang in languages_built
5457
in_switcher = languages_built.get(lang)
58+
tx = lang in workflow.pulling_from_transifex
59+
contrib_link = workflow.get_contrib_link(lang)
5560
if not repo:
56-
yield lang, cast(str, repo), 0.0, 0, 0, built, in_switcher
61+
yield lang, cast(str, repo), 0.0, 0, 0, built, in_switcher, False, False
5762
continue
5863
completion, translators = get_completion(clones_dir, repo)
5964
visitors_num = visitors.get_number_of_visitors(lang) if built else 0
60-
yield lang, repo, completion, translators, visitors_num, built, in_switcher
65+
yield (
66+
lang,
67+
repo,
68+
completion,
69+
translators,
70+
visitors_num,
71+
built,
72+
in_switcher,
73+
tx,
74+
contrib_link,
75+
)
6176

6277

6378
if __name__ == '__main__':

template.html.jinja

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99
<thead>
1010
<tr>
1111
<th>language</th>
12+
<th>workflow</th>
1213
<th>build</th>
1314
<th><a href="https://plausible.io/data-policy#how-we-count-unique-users-without-cookies" target="_blank">visitors</a></th>
1415
<th>translators</th>
1516
<th>completion</th>
1617
</tr>
1718
</thead>
1819
<tbody>
19-
{% for language, repo, completion, translators, visitors, build, in_switcher in completion_progress | sort(attribute='2,3') | reverse %}
20+
{% for language, repo, completion, translators, visitors, build, in_switcher, on_platform in completion_progress | sort(attribute='2,3') | reverse %}
2021
<tr>
2122
{% if repo %}
2223
<td data-label="language">
@@ -27,6 +28,11 @@
2728
{% else %}
2829
<td data-label="language">{{ language }}</td>
2930
{% endif %}
31+
<td data-label="workflow">
32+
{% if contrib_link %}<a href="https://explore.transifex.com/python-doc/python-newest/" target="_blank">{% endif %}
33+
{% if on_platform %}platform{% else %}repository{% endif %}
34+
{% if contrib_link %}</a>{% endif %}
35+
</td>
3036
<td data-label="build">
3137
{% if build %}
3238
<a href="https://docs.python.org/{{ language }}/" target="_blank">✓{% if in_switcher %} in switcher{% endif %}</a>

workflow.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from typing import Literal
2+
3+
pulling_from_transifex = ('zh-cn', 'pt-br', 'ja', 'uk', 'pl')
4+
5+
custom_contributing_links = {
6+
'es': 'https://python-docs-es.readthedocs.io/page/CONTRIBUTING.html',
7+
'ko': 'https://www.flowdas.com/pages/python-docs-ko.html',
8+
'zh-tw': 'https://github.com/python/python-docs-zh-tw/blob/3.13/README.rst#%E5%8F%83%E8%88%87%E7%BF%BB%E8%AD%AF',
9+
'fr': 'https://git.afpy.org/AFPy/python-docs-fr/src/branch/3.13/CONTRIBUTING.rst',
10+
'id': 'https://github.com/python/python-docs-id/blob/master/README.md#berkontribusi-untuk-menerjemahkan',
11+
'tr': 'https://github.com/python/python-docs-tr/blob/3.12/README.md#%C3%A7eviriye-katk%C4%B1da-bulunmak',
12+
'gr': 'https://github.com/pygreece/python-docs-gr/blob/3.12/CONTRIBUTING.md',
13+
}
14+
15+
16+
def get_contrib_link(language: str) -> str | Literal[False]:
17+
return custom_contributing_links.get(language) or (
18+
language in pulling_from_transifex
19+
and 'https://explore.transifex.com/python-doc/python-newest/'
20+
)

0 commit comments

Comments
 (0)