Skip to content

add exts_formatter param to allow formatting extension names in module files - #4125

Open
smoors wants to merge 5 commits into
easybuilders:developfrom
smoors:exts_formatter
Open

add exts_formatter param to allow formatting extension names in module files#4125
smoors wants to merge 5 commits into
easybuilders:developfrom
smoors:exts_formatter

Conversation

@smoors

@smoors smoors commented May 2, 2026

Copy link
Copy Markdown
Contributor

param exts_formatter allows to format extension names in module files for PythonPackage, PythonBundle, and Python easyblocks.

by default, partially normalize the names: replace _ with -, but keep ., as was agreed during a previous conf call: https://github.com/easybuilders/easybuild/wiki/Conference-call-notes-20260211

will do nothing without companion framework PR (so can be safely merged)

@smoors smoors changed the title add exts_formatter param for python packages add exts_formatter param to format extension names in module files May 2, 2026
@smoors smoors changed the title add exts_formatter param to format extension names in module files add exts_formatter param to allow formatting extension names in module files May 2, 2026
@smoors

smoors commented May 3, 2026

Copy link
Copy Markdown
Contributor Author

Test report by @smoors

Overview of tested easyconfigs (in order)

  • SUCCESS flit-core-3.12.0-GCCcore-14.2.0.eb

Build succeeded for 1 out of 1 (total: 23 secs) (1 easyconfigs in total)
node711.hydra.os - Linux Rocky Linux 9.7, x86_64, AMD EPYC 9535 64-Core Processor (zen5), Python 3.9.25
See https://gist.github.com/smoors/6e5b6fe74f9b20e224e3dac8933cd4d8 for a full test report.

@smoors

smoors commented May 3, 2026

Copy link
Copy Markdown
Contributor Author

example of what this does:

@@ -12,20 +12,20 @@                                                                              
                                                                                                 
 Included extensions
 ===================                                                                             
-flit_core-3.12.0
+flit-core-3.12.0
 ]==])
  
 whatis([==[Description: This provides a PEP 517 build backend for packages using Flit.]==])
 whatis([==[Homepage: https://pypi.org/project/flit]==])
 whatis([==[URL: https://pypi.org/project/flit]==])
-whatis([==[Extensions: flit_core-3.12.0]==])
+whatis([==[Extensions: flit-core-3.12.0]==])
  
 local root = "/scratch/brussel/vo/000/bvo00005/vsc10009/ebtest/testnormalize/software/flit-core/3.12.0-GCCcore-14.2.0"
  
 conflict("flit-core")
  
 if convertToCanonical(LmodVersion()) >= convertToCanonical("8.2.8") then
-    extensions("flit_core/3.12.0")
+    extensions("flit-core/3.12.0")
 end
  
  
@@ -40,5 +40,5 @@
  
 prepend_path("EBPYTHONPREFIXES", root)
 -- Built with EasyBuild version 5.3.1.dev0-r7691c52d99cfcc202f794e3d3c752b300f1a76e6
-setenv("EBEXTSLISTFLITMINCORE", "flit_core-3.12.0")
+setenv("EBEXTSLISTFLITMINCORE", "flit-core-3.12.0")

@boegel boegel added this to the next release (5.3.2?) milestone Jul 29, 2026
return REGEX_PIP_NORMALIZE.sub('-', name).lower()


def partial_normalize_pip(name):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@smoors Can we add a unit test for this function specifically?

Ideally it uses a couple of real-world cases, like flit_core, and also includes at least one case which features multiple subsequent underscores`, since currently:

>>> name = 'flit__core'
>>> REGEX_PIP_PARTIAL_NORMALIZE.sub('-', name).lower()
'flit-core'

(not sure if that's intentional?)

@smoors smoors Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

(not sure if that's intentional?)

yes, that's intentional
see also https://packaging.python.org/en/latest/specifications/name-normalization/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK, good, then we can make that clear in the test for partial_normalize_pip.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

test added (and regex fixed)

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