Skip to content

[All] Several fixes on main branch to pass CI - #1554

Closed
loumalouomega wants to merge 13 commits into
nschloe:mainfrom
loumalouomega:minor-fixes-main
Closed

[All] Several fixes on main branch to pass CI#1554
loumalouomega wants to merge 13 commits into
nschloe:mainfrom
loumalouomega:minor-fixes-main

Conversation

@loumalouomega

@loumalouomega loumalouomega commented Apr 8, 2026

Copy link
Copy Markdown

Description

This PR addresses several critical issues identified in the CI and provides better compatibility with modern environments (NumPy 2.0+) and older Python versions (3.8).

Summary of Changes

1. Fix Windows CI Failure (Python 3.8)

  • Problem: The Windows build for Python 3.8 was failing because pip attempted to build netCDF4 from source, which required HDF5 headers that were missing from the runner.
  • Solution: Modified tox.ini to explicitly list dependencies and use environment markers (netCDF4; sys_platform != "win32" or python_version != "3.8") to skip netCDF4 only in this specific failing environment.

2. NumPy 2.0+ Compatibility

  • Problem: NumPy 2.0 changed the repr() of scalars to include the type (e.g., np.float64(1.23) instead of 1.23). This broke several ASCII file writers that used {!r}, %r, or repr() for formatting, as the resulting files could not be parsed by standard readers.
  • Solution:
    • Updated writers for GMSH, MDPA, DOLFIN, and UGRID to use str() ({!s}, %s) instead of repr().
    • Improved ASCII reading robustness in GMSH and UGRID by replacing np.fromfile(..., sep=" ") with a more reliable readline().split() approach to handle potential whitespace/newline issues.

3. Python 3.8 Compatibility & Modernization

  • Type Hints: Replaced modern | union type hints with typing.Union in several files to maintain compatibility with Python 3.8.
  • Version Discovery: Improved src/meshio/__about__.py to use importlib.metadata (with a fallback to importlib_metadata) more robustly.
  • CLI: Adjusted argparse subparser requirement syntax for better compatibility across Python versions.

4. Linter and CI Updates

  • flake8: Added venv and .tox to the exclusion list in .flake8 to avoid false positives from third-party packages in local development environments.
  • GitHub Actions: Updated the tox command in CI to explicitly select the appropriate environment (py38 or py312).

Verification Results

  • Python 3.8 (Linux): 740 passed, 10 skipped.
  • Python 3.12 (Linux): 740 passed, 10 skipped.
  • Linter: isort, black, and flake8 pass cleanly.
  • NumPy: Verified fix for np.float64 string representation issues in NumPy 2.4.4.

Vicente Mataix Ferrándiz added 12 commits April 8, 2026 15:03
- Replace | with Union in type hints for compatibility with Python < 3.10
- Add missing topological_dimension import in meshio/__init__.py
- Update tox.ini and CI to explicitly use py38 and py312 environments
- Ensure tox uses the correct environment version in GitHub Actions
- Use math.prod in VTK writers (as suggested in code)
- Fix argparse subparser compatibility
- Refine __about__.py version discovery
- General cleanup of type hints and imports
@loumalouomega

Copy link
Copy Markdown
Author

Fantastic, now CI passes, i will try to minimize changes and pass the CI

@mariam-simvia

Copy link
Copy Markdown

Hello @loumalouomega,

Thank you for putting all of this together, it's great to see meshio's CI passing again!

As you've probably noticed, meshio is no longer actively maintained, so contributions like this risk going unmerged. At Simvia, we've started meshlane : an actively maintained descendant of meshio that keeps the full history and attribution.

If you'd like to bring this PR over to meshlane, we'd be glad to review and merge it there so your work can ship in a release.

Thank you again for the work here, it's clearly useful to the community.

@loumalouomega

Copy link
Copy Markdown
Author

Hello @loumalouomega,

Thank you for putting all of this together, it's great to see meshio's CI passing again!

As you've probably noticed, meshio is no longer actively maintained, so contributions like this risk going unmerged. At Simvia, we've started meshlane : an actively maintained descendant of meshio that keeps the full history and attribution.

If you'd like to bring this PR over to meshlane, we'd be glad to review and merge it there so your work can ship in a release.

Thank you again for the work here, it's clearly useful to the community.

Hello, in fact I was writing my own fork, haha, I will take a look at yours

@loumalouomega

Copy link
Copy Markdown
Author

Hello @loumalouomega,

Thank you for putting all of this together, it's great to see meshio's CI passing again!

As you've probably noticed, meshio is no longer actively maintained, so contributions like this risk going unmerged. At Simvia, we've started meshlane : an actively maintained descendant of meshio that keeps the full history and attribution.

If you'd like to bring this PR over to meshlane, we'd be glad to review and merge it there so your work can ship in a release.

Thank you again for the work here, it's clearly useful to the community.

Huum, I took a look, and as you have fully renamed the library the port will not be trivial.

@loumalouomega

Copy link
Copy Markdown
Author

Hello @loumalouomega,

Thank you for putting all of this together, it's great to see meshio's CI passing again!

As you've probably noticed, meshio is no longer actively maintained, so contributions like this risk going unmerged. At Simvia, we've started meshlane : an actively maintained descendant of meshio that keeps the full history and attribution.

If you'd like to bring this PR over to meshlane, we'd be glad to review and merge it there so your work can ship in a release.

Thank you again for the work here, it's clearly useful to the community.

Hello, I actully took a look at the moment, but converting my changes into your branch was very troublesome with all the conflicts. Additionally I ahve been working in the last months in a C++ port of meshio to integrate directly into HPC suites without passing by python which is not always available, see https://github.com/loumalouomega/meshioplusplus. It binds to python with pybind11 and JS/TS with WASM. I have as TODO to have a fortran and C backend, so other solvers HPC can be used. I see youa re part of EDF, so probably a fortran backend will be usable for CodeASTER, so I can keep you updated.

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.

2 participants