Skip to content

Rename Metadata to Build details #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ jobs:
curl -Lo index.html-public https://github.com/python-docs-translations/dashboard/raw/refs/heads/gh-pages/index.html
diff --color=always -u index.html-public build/index.html || :
cat build/index.html
- run: uv run generate_metadata.py # generates metadata.html
- name: Deploy metadata view 🚀
- run: uv run generate_build_details.py # generates build-details.html
- name: Deploy build details view 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4
with:
Expand Down
14 changes: 8 additions & 6 deletions generate_metadata.py → generate_build_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@
generation_time = datetime.now(timezone.utc)


def get_projects_metadata(
def get_projects_build_details(
completion_progress: Sequence[LanguageProjectData],
) -> Iterator[tuple[int, int, datetime | None]]:
with concurrent.futures.ProcessPoolExecutor() as executor:
return executor.map(
get_metadata,
get_build_details,
*zip(*map(get_language_repo_and_completion, completion_progress)),
itertools.repeat(Path('clones')),
)


def get_metadata(
def get_build_details(
language: Language, repo: str | None, completion: float, clones_dir: str
) -> tuple[int, int, datetime | None]:
if not repo or not (repo_path := Path(clones_dir, 'translations', repo)).exists():
Expand Down Expand Up @@ -65,10 +65,12 @@ def get_language_repo_and_completion(
dacite.from_dict(LanguageProjectData, project) for project in index_json
]

output = env.get_template('metadata.html.jinja').render(
metadata=zip(completion_progress, get_projects_metadata(completion_progress)),
output = env.get_template('build-details.html.jinja').render(
build_details=zip(
completion_progress, get_projects_build_details(completion_progress)
),
generation_time=generation_time,
duration=(datetime.now(timezone.utc) - generation_time).seconds,
)

Path('build/metadata.html').write_text(output)
Path('build/build-details.html').write_text(output)
2 changes: 1 addition & 1 deletion templates/base.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="metadata.html">Metadata</a>
<a class="nav-link" href="build-details.html">🛠️ Build details</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://devguide.python.org/documentation/translations/translating/">🔗 Translating</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</tr>
</thead>
<tbody>
{% for project, metadata in metadata | sort(attribute='0.completion,0.translators.number') | reverse %}
{% for project, metadata in build_details | sort(attribute='0.completion,0.translators.number') | reverse %}
<tr>
<td data-label="language">{{ project.language.name }} ({{ project.language.code }})</td>
<td data-label="branch">{{ project.branch }}</td>
Expand Down
Loading