There is a newer version of the record available.

Published December 7, 2025 | Version v1.4.0
Software Open

foamlib: A modern Python package for working with OpenFOAM

Description

foamlib v1.4.0

New feature: colon (:) as index

FoamFile and related classes now support colons (:) as indices, with the meaning of "this entire file/dictionary". Accessing file[:] returns an independent copy of the entire data (it is equivalent to file.as_dict()), while setting file[:] = data will replace all of the contents of the object (except the header, if present).

File manipulation improvements

File manipulation is now safer and more robust, with minor grammar changes, a much improved data normalization step (whose purpose is to ensure that any data written by foamlib always matches what its parser expects), and additional validation of user inputs for extra certainty.

More modern codebase

Updated a huge portion of the code to use constructs from the newer versions of Python, including the use of match-case (PEP 634 structural pattern matching)—available since Python 3.10—where it makes sense.

Dropped support for Python 3.8 and 3.9

These versions are now end of life and their use is not recommended anymore. However, installing foamlib with these Python versions is still possible: you'll just get an earlier version of foamlib.

All changes

  • Bump actions/checkout from 5 to 6 by @dependabot[bot] in https://github.com/gerlero/foamlib/pull/618
  • Drop support for Python < 3.10 by @gerlero in https://github.com/gerlero/foamlib/pull/619
  • Drop future annotations imports by @gerlero in https://github.com/gerlero/foamlib/pull/620
  • Eliminate type assertion in Dimensioned initialization by @gerlero in https://github.com/gerlero/foamlib/pull/621
  • Modify scipy-stubs dependency in pyproject.toml by @gerlero in https://github.com/gerlero/foamlib/pull/622
  • Simplify parsing grammar by @gerlero in https://github.com/gerlero/foamlib/pull/623
  • Fix data normalization edge case by @gerlero in https://github.com/gerlero/foamlib/pull/625
  • Update data normalization implementation by @gerlero in https://github.com/gerlero/foamlib/pull/627
  • Specify overloads of add_to_mapping utility funcion by @gerlero in https://github.com/gerlero/foamlib/pull/628
  • Fix ty errors by @gerlero in https://github.com/gerlero/foamlib/pull/631
  • Update file serialization by @gerlero in https://github.com/gerlero/foamlib/pull/633
  • Update internal field classification function by @gerlero in https://github.com/gerlero/foamlib/pull/634
  • Fix ty errors by @gerlero in https://github.com/gerlero/foamlib/pull/635
  • Improve robustness of log monitoring by @gerlero in https://github.com/gerlero/foamlib/pull/639
  • Improve serialization by @gerlero in https://github.com/gerlero/foamlib/pull/637
  • Improve typing by @gerlero in https://github.com/gerlero/foamlib/pull/641
  • Update typing by @gerlero in https://github.com/gerlero/foamlib/pull/643
  • Update parsing by @gerlero in https://github.com/gerlero/foamlib/pull/644
  • Refactor dict workflows in parsing and serialization by @gerlero in https://github.com/gerlero/foamlib/pull/645
  • Improve typing by @gerlero in https://github.com/gerlero/foamlib/pull/647
  • Always use None to represent empty values by @gerlero in https://github.com/gerlero/foamlib/pull/648
  • Update README.md by @gerlero in https://github.com/gerlero/foamlib/pull/649
  • Update CONTRIBUTING.md by @gerlero in https://github.com/gerlero/foamlib/pull/650
  • Reject comments when parsing only data by @gerlero in https://github.com/gerlero/foamlib/pull/651
  • Do not widen user input domain by @gerlero in https://github.com/gerlero/foamlib/pull/652
  • Rename internal parsing module by @gerlero in https://github.com/gerlero/foamlib/pull/653
  • Rename internal normalization function by @gerlero in https://github.com/gerlero/foamlib/pull/654
  • Improve serialization by @gerlero in https://github.com/gerlero/foamlib/pull/656
  • Improve serialization by @gerlero in https://github.com/gerlero/foamlib/pull/657
  • Fix pattern matching for None case in _serialization.py by @gerlero in https://github.com/gerlero/foamlib/pull/658
  • Update standalone data grammar to match serialization by @gerlero in https://github.com/gerlero/foamlib/pull/659
  • Refactor FoamFile helpers by @gerlero in https://github.com/gerlero/foamlib/pull/660
  • Fix warnings in tests and examples by @gerlero in https://github.com/gerlero/foamlib/pull/662
  • Improve serialization by @gerlero in https://github.com/gerlero/foamlib/pull/661
  • Update project description for clarity by @gerlero in https://github.com/gerlero/foamlib/pull/664
  • Support colons as indices in FoamFile and related classes by @gerlero in https://github.com/gerlero/foamlib/pull/663

Full Changelog: https://github.com/gerlero/foamlib/compare/v1.3.15...v1.4.0

Notes

If you use this software, please cite our article in the Journal of Open Source Software.

Files

gerlero/foamlib-v1.4.0.zip

Files (949.7 kB)

Name Size Download all
md5:4fde6e0fc965ef40cd234d25eee3bb2e
949.7 kB Preview Download

Additional details

Related works

Is supplement to
Software: https://github.com/gerlero/foamlib/tree/v1.4.0 (URL)

Software