Skip to content
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

Remove *mo blobs from source control #526

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

n1ngu
Copy link

@n1ngu n1ngu commented Jan 5, 2024

Compile them at build time with a hatchling custom hook (replacing poetry!)

Closes #505

@Endzel
Copy link

Endzel commented May 27, 2024

Any chance for this to progress @n1ngu ? This issue is happening in some of my deployments.

@n1ngu
Copy link
Author

n1ngu commented May 28, 2024

While removing and ignoring *.mo files and fixing strings in *.po files are the starting point to fix the actual issues, this should be followed by either

  • Communicating a breaking change to installers, as they would now be required to run compile messages if they weren't already.
  • Changing the build and release pipeline to compile messages before packaging this module. And also communicating this breaking change to third party builders.
  • Merging this PR

But right now this is more of a proof-of-concept for a long-ago acknowledged bad practice in the Django ecosystem (see https://code.djangoproject.com/ticket/23321, https://forum.djangoproject.com/t/cease-and-desist-versioning-of-compiled-mo-files/23516). It works, but

  • It is far from being a canonical solution, as you would require Django to build Django itself. Not an issue for community modules, but still hurts my head. I would not feel comfortable merging this upstream unless it used babel or raw gettext.
  • It is very disruptive with the existing packaging solution (replacing poetry with hatch!).

So, I think there is little chance for this to progress unless the implementation is discussed with jazzmin maintainers. I am eager to have this discussion but in the meanwhile I am not pushing for this at all.


class CustomBuildHook(BuildHookInterface):
def initialize(self, version: str, build_data: dict[str, t.Any]) -> None:
django.core.management.call_command("compilemessages")
Copy link
Author

@n1ngu n1ngu May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear, I am uncomfortable with the build dependency introduced by this instruction. The only reason to do this was validating the workflow. But if community is ok with removing *.mo files and compiling them at wheel build time and replacing poetry with hatch, I'll invest some effort to rewrite this with babel or gettext.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sporadic Execution of msgfmt failed 'msgid' and 'msgstr' entries do not both begin with '\n'
2 participants