Skip to content
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
6 changes: 0 additions & 6 deletions .github/workflows/pypi-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ jobs:
persist-credentials: false
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0

- name: Compile translations
run: |
pip install --upgrade pip
pip install -r requirements.txt
python babel_runner.py compile

- uses: hynek/build-and-inspect-python-package@fe0a0fb1925ca263d076ca4f2c13e93a6e92a33e # v2.17.0

# Upload to real PyPI on GitHub Releases.
Expand Down
7 changes: 7 additions & 0 deletions babel_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import tomllib
from pathlib import Path

from hatchling.builders.hooks.plugin.interface import BuildHookInterface

# Global variables used by pybabel below (paths relative to PROJECT_DIR)
DOMAIN = "python-docs-theme"
COPYRIGHT_HOLDER = "Python Software Foundation"
Expand Down Expand Up @@ -106,6 +108,11 @@ def compile_catalogs(locale: str) -> None:
subprocess.run(cmd, cwd=PROJECT_DIR, check=True)


class CustomBuildHook(BuildHookInterface):
def initialize(self, version: str, build_data: dict[str, object]) -> None:
compile_catalogs("")


def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
Expand Down
14 changes: 9 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[build-system]
build-backend = "flit_core.buildapi"
build-backend = "hatchling.build"
requires = [
"flit-core>=3.7",
"babel",
"hatchling",
]

[project]
Expand Down Expand Up @@ -36,9 +37,12 @@ urls.Download = "https://pypi.org/project/python-docs-theme/"
urls.Homepage = "https://github.com/python/python-docs-theme/"
entry-points."sphinx.html_themes".python_docs_theme = "python_docs_theme"

[tool.flit]
module.name = "python_docs_theme"
sdist.include = [ "python_docs_theme/" ]
[tool.hatch]
build.artifacts = [ "python_docs_theme/locale/**/*.mo" ]
build.hooks.custom.path = "babel_runner.py"
build.targets.wheel.packages = [ "python_docs_theme" ]
build.targets.wheel.exclude = [ "python_docs_theme/locale/**/*.po" ]
version.path = "python_docs_theme/__init__.py"

[tool.ruff]
fix = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
# Translators:
# Cristián Maureira-Fredes, 2025
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: python-docs-theme 2025.5\n"
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# for babel_runner.py
Babel
hatchling
Jinja2
Loading