Skip to content

Enable flake8-comprehension code style check and fix issues#3989

Open
Flamefire wants to merge 7 commits intoeasybuilders:developfrom
Flamefire:comprehensions
Open

Enable flake8-comprehension code style check and fix issues#3989
Flamefire wants to merge 7 commits intoeasybuilders:developfrom
Flamefire:comprehensions

Conversation

@Flamefire
Copy link
Contributor

@Flamefire Flamefire commented Nov 14, 2025

https://pypi.org/project/flake8-comprehensions/ has various useful checks, most importantly:

C419 Unnecessary list comprehension in <any/all>() prevents short-circuiting - rewrite as a generator.

I.e. things like any([expensive_check(x) for x in collection]) runs the check after processing the full collection instead of stopping after the first "match" which costs performance.

To me the whole collection of checks look useful for performance and readability so enable them all.

See easybuilders/easybuild-framework#5043

Requires:

@boegel boegel changed the title CI: Enable flake8-comprehension and fix issues Enable flake8-comprehension code style check and fix issues Nov 19, 2025
@boegel boegel added this to the next release (5.2.0) milestone Nov 19, 2025
@Flamefire
Copy link
Contributor Author

@boegel Looks good with recent develop

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
Copy link
Member

boegel commented Jan 20, 2026

Test report by @boegel

Overview of tested easyconfigs (in order)

  • SUCCESS FlexiBLAS-3.4.5-GCC-14.3.0.eb

  • SUCCESS matplotlib-3.9.2-gfbf-2024a.eb

  • SUCCESS OpenMPI-5.0.8-GCC-14.3.0.eb

  • FAIL PETSc-3.24.0-foss-2025b.eb (unhandled exception: 0)

Traceback (most recent call last):
File "/arcanine/scratch/gent/vo/000/gvo00002/vsc40023/easybuild/easybuild-framework/easybuild/main.py", line 178, in build_and_install_software
  (ec_res['success'], app_log, err_msg, err_code) = build_and_install_one(ec, init_env)
File "/arcanine/scratch/gent/vo/000/gvo00002/vsc40023/easybuild/easybuild-framework/easybuild/framework/easyblock.py", line 5109, in build_and_install_one
  result = app.run_all_steps(run_test_cases=run_test_cases)
File "/arcanine/scratch/gent/vo/000/gvo00002/vsc40023/easybuild/easybuild-framework/easybuild/framework/easyblock.py", line 4922, in run_all_steps
  self.run_step(step_name, step_methods)
File "/arcanine/scratch/gent/vo/000/gvo00002/vsc40023/easybuild/easybuild-framework/easybuild/framework/easyblock.py", line 4763, in run_step
  current_method()
File "/tmp/eb-5gxx147t/included-easyblocks-ziq59zuk/easybuild/easyblocks/petsc.py", line 262, in configure_step
  deproot = get_software_root(dep[0])
KeyError: 0

Build succeeded for 4 out of 6 (total: 1 hour 30 mins 2 secs) (6 easyconfigs in total)
node4247.shinx.os - Linux RHEL 9.6, x86_64, AMD EPYC 9654 96-Core Processor (zen4), Python 3.9.21
See https://gist.github.com/boegel/f0d96fc88d9c28a1f95bc7231add45d3 for a full test report.

'papi', 'ScaLAPACK', 'SciPy-bundle', 'SCOTCH', 'SuiteSparse']

for dep in [dep['name'] for dep in self.cfg.dependencies(runtime_only=True) if dep['name'] not in sep_deps]:
for dep in (name for name in self.cfg.dependencies(runtime_only=True) if name not in sep_deps):
Copy link
Member

Choose a reason for hiding this comment

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

@Flamefire I guess you wanted to use self.cfg.dependency_names here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was the intention, not sure what happened. Fixed

@boegel
Copy link
Member

boegel commented Jan 28, 2026

Test report by @boegel

Overview of tested easyconfigs (in order)

  • SUCCESS PETSc-3.24.0-foss-2025b.eb

  • SUCCESS SLEPc-3.24.0-foss-2025b.eb

Build succeeded for 2 out of 2 (total: 2 hours 43 mins 27 secs) (2 easyconfigs in total)
node4212.shinx.os - Linux RHEL 9.6, x86_64, AMD EPYC 9654 96-Core Processor (zen4), Python 3.9.21
See https://gist.github.com/boegel/9a67611b1098bb178093f7a5553c6559 for a full test report.

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