Skip to content

Conversation

@Flamefire
Copy link
Contributor

@Flamefire Flamefire commented Dec 3, 2025

Include https://github.com/hukkin/tomli/tree/2.3.0 in easybuild as easybuild.tools.tomllib which will be replace by tomllib in Python 3.11+

Slightly patched to make it compatible with Python 3.6:

  • Type hints (e.g. tuple[int, int] -> tuple)
  • /, * in function params (end of positional args)

I copied the example from toml.io which (hopefully) triggers most code parts of the library to shake out any issues.

I decided for tomli instead of extracting tomllib from CPython because of its goal:

A version of Tomli, the tomllib module, was added to the standard library in Python 3.11 via PEP 680. Tomli continues to provide a backport on PyPI for Python versions where the standard library module is not available and that have not yet reached their end-of-life.

It currently doesn't support Python 3.6 but 3.8 so we can use it when dropping Python < 3.9

Requires:

@Flamefire Flamefire force-pushed the tomli branch 6 times, most recently from 36df64c to 921dc88 Compare December 4, 2025 09:34
@boegel
Copy link
Member

boegel commented Dec 6, 2025

@Flamefire Can you clarify why this requires switching to setuptools (#5065)?
I'm not keen on merging that, we've been bitten in the ass by setuptools on too many times in the (distant) past...

@boegel boegel added this to the release after 5.2.0 milestone Dec 6, 2025
@boegel boegel changed the title Vendor a copy of tomli Vendor a copy of tomli in easybuild.tools.tomllib Dec 6, 2025
@Flamefire
Copy link
Contributor Author

Without setuptools you'd need to list all "packages" in the setup call and it took me multiple tries to figure out which it actually requires.

What were those issues and are they still relevant? Our usage here might have changed enough that we are "standard" enough not to run into them (anymore). Especially if those issues were from the Python 2 days. Seems most advise using setuptools unconditionally (if not even pyproject.toml) for non-ancient Pythons

An alternative if you really want to play it safe:

  • Import setuptools.find_packages if possible
  • check output against our manual list and error on difference printing the correct list
  • Have EASYBUILD_IGNORE_FINDPACKAGES=1 to skip that as a way out if it unexpectedly causes issues on some system.

But I'd really like to avoid error-prone adding (more) things to a hard-coded list if possible.

@boegel
Copy link
Member

boegel commented Dec 7, 2025

We should be discussing this in #5065, so I'm moving the discussion there...

Ideally, this PR is reworked so the changes in #5065 are not required at all, since I'm really reluctant to make setuptools a hard requirement for EasyBuild where we can avoid it.

Copy link
Member

@boegel boegel left a comment

Choose a reason for hiding this comment

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

lgtm

@boegel boegel merged commit ac1661b into easybuilders:develop Dec 9, 2025
40 checks passed
@Flamefire Flamefire deleted the tomli branch December 9, 2025 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants