spiral-project / ihatemoney

A simple shared budget manager web application
https://ihatemoney.org
Other
1.21k stars 271 forks source link

Do not version the compiled catalogs #1238

Closed azmeuk closed 11 months ago

azmeuk commented 1 year ago

I just noticed *.mo files are versioned in the git repository. While they must be included in python packages, they do not need to be in the git repository. They make the repository bigger, and as git retrieves all the commit when cloning, with enough time this can become noticeable. They can also induce unnecessary conflicts.

Catalog can be compiled just in time when tests are launched (via a pytest fixture for example) or when the python packages are built (via setuptools/hatch/poetry/etc. hooks).

What do you think? If this OK with you I can submit a PR.

zorun commented 1 year ago

I agree it's not ideal, but it's intended. Several years ago we converged on this behaviour, but I couldn't find the discussion. I believe it was because we sometimes forgot to rebuild translations for releases, and maybe there was an issue with weblate.

I'm completely open to revisit this, your help would be appreciated! Things to keep in mind:

almet commented 1 year ago

Hi @azmeuk, and thanks for your feedback on this.

I'm also open to revisit this, as the current behavior sometimes leads to malfunctions. Don't hesitate to submit a pull request, I'm +1 for it.

azmeuk commented 1 year ago

As I wrote in #1243 it might be better to move away from setuptools someday, and replacement tools would allow us to run some custom code at build time (such as catalog compilation). I have not seen this with setuptools+setup.cfg but I think we could do this with setuptools+setup.py

Anyways, I know that at least hatch and poetry would allow this. We moved to hatch in wtforms recently and catalog compilation at build time works, and there is no issue with weblate so far. As tox builds the packages, unit tests run with tox will have compiled catalogs. For people who would like to use pytest outside a tox environment, we can write an auto-used pytest fixture as we did in canaille.

I would suggest if/when #1243 is merged to move to hatch. What do you think?

almet commented 1 year ago

I really like the idea to move away from setuptools. Hatch seems less magic than poetry to me, which makes it more palatable. I've also used it in the past without trouble.

Thanks for bringing this, let's do it :-)