Skip to content
Open
Show file tree
Hide file tree
Changes from 15 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
1 change: 1 addition & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
- run: sudo apt-get install -y gettext
- run: pip install -r requirements.txt
- run: uv run generate.py # generates index.html and index.json
- run: uv run generate_related_projects.py # generates related.html
- name: Deploy 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4
Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,11 @@ repos:
- id: deptry
args: ["--per-rule-ignores", "DEP002=python-docs-theme", "--package-module-name-map", "gitpython=git,sphinx-lint=sphinxlint"]

- repo: https://github.com/oxipng/oxipng
rev: v9.1.5
hooks:
- id: oxipng
args: [ --strip=safe, --alpha ]

ci:
autoupdate_schedule: quarterly
6 changes: 3 additions & 3 deletions generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from dataclasses import dataclass, asdict
from datetime import datetime, timezone
from pathlib import Path
from shutil import copyfile

from git import Repo
from jinja2 import Environment, FileSystemLoader
Expand Down Expand Up @@ -104,9 +105,8 @@ class LanguageProjectData:
generation_time=generation_time,
duration=(datetime.now(timezone.utc) - generation_time).seconds,
)

Path('build/style.css').write_bytes(Path('src/style.css').read_bytes())
Path('build/logo.png').write_bytes(Path('src/logo.png').read_bytes())
copyfile('src/style.css', 'build/style.css')
copyfile('src/logo.png', 'build/logo.png')
Path('build/index.html').write_text(index)

Path('build/index.json').write_text(
Expand Down
21 changes: 21 additions & 0 deletions generate_related_projects.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import tomllib
from pathlib import Path
from shutil import copyfile, copytree

from jinja2 import Environment, FileSystemLoader


if __name__ == '__main__':
Path('build').mkdir(parents=True, exist_ok=True)

with open('related_projects.toml', 'rb') as f:
data = tomllib.load(f)
projects = data['projects']

env = Environment(loader=FileSystemLoader('templates'))
related = env.get_template('related.html.jinja').render(projects=projects)

Path('build/related.html').write_text(related)
copyfile('src/style.css', 'build/style.css')
copyfile('src/logo.png', 'build/logo.png')
copytree('src/images', 'build/images', dirs_exist_ok=True)
35 changes: 35 additions & 0 deletions related_projects.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[[projects]]
name = "packaging.python.org"
description = "Python Packaging User Guide translation"
logo = "images/pypa_logo.png"
url = "https://hosted.weblate.org/projects/pypa/packaging-python-org/#information"

[[projects]]
name = "PyPI (Warehouse)"
description = "Python Package Index translation"
logo = "images/pypi_logo.svg"
url = "https://hosted.weblate.org/projects/pypa/warehouse/#information"

[[projects]]
name = "Scientific Python"
description = "Scientific Python ecosystem translations"
logo = "images/scientific-python_logo.svg"
url = "https://scientific-python-translations.github.io/status/"

[[projects]]
name = "micro:bit"
description = "micro:bit translation programme"
logo = "images/microbit_logo.svg"
url = "https://microbit.org/translate/"

[[projects]]
name = "Django"
description = "Localizing Django documentation"
logo = "images/django_logo.svg"
url = "https://docs.djangoproject.com/en/dev/internals/contributing/localizing/"

[[projects]]
name = "Sphinx"
description = "Sphinx documentation generator translation"
logo = "images/sphinx_logo.png"
url = "https://www.sphinx-doc.org/en/master/usage/advanced/intl.html#contributing-to-sphinx-reference-translation"
38 changes: 38 additions & 0 deletions src/images/django_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions src/images/microbit_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/pypa_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/images/pypi_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading