[All] Several fixes on main branch to pass CI - #1554
Conversation
- 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
|
Fantastic, now CI passes, i will try to minimize changes and pass the CI |
|
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 |
Huum, I took a look, and as you have fully renamed the library the port will not be trivial. |
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. |
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)
pipattempted to buildnetCDF4from source, which required HDF5 headers that were missing from the runner.tox.inito explicitly list dependencies and use environment markers (netCDF4; sys_platform != "win32" or python_version != "3.8") to skipnetCDF4only in this specific failing environment.2. NumPy 2.0+ Compatibility
repr()of scalars to include the type (e.g.,np.float64(1.23)instead of1.23). This broke several ASCII file writers that used{!r},%r, orrepr()for formatting, as the resulting files could not be parsed by standard readers.str()({!s},%s) instead ofrepr().np.fromfile(..., sep=" ")with a more reliablereadline().split()approach to handle potential whitespace/newline issues.3. Python 3.8 Compatibility & Modernization
|union type hints withtyping.Unionin several files to maintain compatibility with Python 3.8.src/meshio/__about__.pyto useimportlib.metadata(with a fallback toimportlib_metadata) more robustly.argparsesubparser requirement syntax for better compatibility across Python versions.4. Linter and CI Updates
venvand.toxto the exclusion list in.flake8to avoid false positives from third-party packages in local development environments.toxcommand in CI to explicitly select the appropriate environment (py38orpy312).Verification Results
isort,black, andflake8pass cleanly.np.float64string representation issues in NumPy 2.4.4.