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

Adopt pyproject.toml #1618

Merged
merged 11 commits into from
Feb 29, 2024
Merged

Conversation

ThomasWaldmann
Copy link
Member

@ThomasWaldmann ThomasWaldmann commented Feb 22, 2024

Modern python packaging expects to find a pyproject.toml, which can also be used to contain configuration information for a lot of python-related tools.

Direct calls to setup.py are deprecated. Fixes #1619.

Fixes #1571.

@ThomasWaldmann
Copy link
Member Author

ThomasWaldmann commented Feb 22, 2024

@RogerHaase I put your name/email into maintainer list (as found in git logs).

@UlrichB22 I didn't find a usable email in git logs, so I didn't add you into maintainer list yet.

Are you both ok with adopting ruff instead of flake8? The latter still can't read its settings from pyproject.toml.

@ThomasWaldmann ThomasWaldmann changed the title Start adopting pyproject.toml Adopt pyproject.toml Feb 23, 2024
@ThomasWaldmann
Copy link
Member Author

Note: I didn't do much practical testing of this yet, help is appreciated.

@ThomasWaldmann ThomasWaldmann marked this pull request as ready for review February 23, 2024 02:14
@UlrichB22
Copy link
Collaborator

I started testing in a fresh install from a git clone (for developers).

Following tests were successful after short check:

  • quickinstall.py
  • ./m extras
  • ./m tests
  • moin create-instance --full && moin run

Now I'm testing pybabel extract, the resulting MoinMoin.pot is only half the size of the old version and git diff doesn't help because of the different sort order. But that's not a showstopper. I will investigate this further as I want to update the German translations in the next step.

For me it is fine not to be on the list of maintainers.

@ThomasWaldmann
Copy link
Member Author

@UlrichB22 thanks for testing.

translations: maybe the size difference comes from (missing) comments? iirc, there is an option to include src file / line no as a comment.

@UlrichB22
Copy link
Collaborator

Regarding babel, please change babel.cfg to

[python: **/**.py]
encoding = utf-8

[jinja2: **/templates/**.html]
encoding = utf-8

[jinja2: **/templates/dictionary.js]
# all JS translatable strings must be defined here for jQuery i18n plugin
encoding = utf-8

and add following options to the babel extract command in docs/devel/translate.rst:

--project="moin" 
--version="<version>"

@ThomasWaldmann
Copy link
Member Author

When reviewers think this is ready, please approve.

After that, I'ld like to squash some commits before merging.

@RogerHaase
Copy link
Member

RogerHaase commented Feb 23, 2024

I tested clone on windows, all OK except for test 3 errors (Cannot create a file when that file already exists:) that did not repeat on 2nd try. This happens occasionally on Windows, workaround is to rerun.

@ThomasWaldmann
Copy link
Member Author

@RogerHaase Are you saying this problem is new, caused by my changes and does not happen in master branch?

@RogerHaase
Copy link
Member

Not a new problem. Windows seems to have problems dealing with tests that delete a file and then recreate a file with same name. Happens around 1 in 50 or 100 tests. Cannot reproduce.

@ThomasWaldmann
Copy link
Member Author

@RogerHaase OK, guess that should be in a ticket then, not in this PR. I remember we have seen very strange windows fs effects in the past, too.

@UlrichB22
Copy link
Collaborator

The translation with pybabel works fine now.
I think you will test all the packaging stuff.

@ThomasWaldmann
Copy link
Member Author

ThomasWaldmann commented Feb 24, 2024

I manually and automatically compared the sdist *.tgz files produced by this PR and master branch - there were no unexpected differences.

So, if there is nothing else, I'll squash some commits and make it ready to merge.

- setuptools build-system
- replace deprecated and problematic setup_requires by build-system.requires
- move setuptools_scm's config there
TODO: message_extractors for babel
instead of its setuptools integration.

for now, keep a minimal setup.py so it can still be called.
note really needed, it works with conf.py and Makefile / make.bat.
Let's focus on python packaging and leave the many kinds of
Linux (and other) dist packaging to the dist package maintainers.
ruff supports pyproject.toml (and is quite fast).
install       -> pip install ...
sdist / bdist -> python -m build
upload        -> twine ...
translations  -> pybabel ...
@ThomasWaldmann
Copy link
Member Author

Squashed some fix commits and force-pushed. Ready AFAIAC.

@RogerHaase RogerHaase merged commit b447b5e into moinwiki:master Feb 29, 2024
5 checks passed
@ThomasWaldmann ThomasWaldmann deleted the pyproject-toml branch February 29, 2024 22:13
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.

drop direct calls to setup.py adopt pyproject.toml
3 participants