FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Switch to Hatchling build hooks for i18n packaging and exclude .po from wheels by StanFromIreland · Pull Request #312 · python/python-docs-theme · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .po  (1) .py  (1) .toml  (1) .txt  (1) .yml  (1) All 5 file types selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 0 additions & 6 deletions .github/workflows/pypi-package.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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@d44ca7d91762de7a7d5436ddae667c6da6d1c3df # v2.18.0

# Upload to real PyPI on GitHub Releases.
Expand Down
7 changes: 7 additions & 0 deletions babel_runner.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
# Translators:
# Cristián Maureira-Fredes, 2025
#
#, fuzzy
Comment thread
StanFromIreland marked this conversation as resolved.
msgid ""
msgstr ""
"Project-Id-Version: python-docs-theme 2025.5\n"
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# for babel_runner.py
Babel
hatchling
Jinja2
Comment thread
hugovk marked this conversation as resolved.
Loading

Back | FazBrowse Home | New Git URL