pybFoam 0.1.8__tar.gz → 0.1.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. {pybfoam-0.1.8 → pybfoam-0.1.10}/.github/workflows/ci.yaml +7 -1
  2. {pybfoam-0.1.8 → pybfoam-0.1.10}/CMakeLists.txt +1 -1
  3. {pybfoam-0.1.8 → pybfoam-0.1.10}/PKG-INFO +25 -2
  4. {pybfoam-0.1.8 → pybfoam-0.1.10}/README.md +21 -1
  5. {pybfoam-0.1.8 → pybfoam-0.1.10}/benchmark/benchmark_expression_complex.py +46 -19
  6. {pybfoam-0.1.8 → pybfoam-0.1.10}/benchmark/benchmark_expression_vec_add.py +23 -1
  7. {pybfoam-0.1.8 → pybfoam-0.1.10}/benchmark/benchmark_expression_vec_add_4.py +23 -1
  8. {pybfoam-0.1.8 → pybfoam-0.1.10}/cmake/Dependencies.cmake +0 -24
  9. pybfoam-0.1.10/docs/api.rst +6 -0
  10. {pybfoam-0.1.8 → pybfoam-0.1.10}/docs/conf.py +1 -1
  11. {pybfoam-0.1.8 → pybfoam-0.1.10}/pyproject.toml +15 -4
  12. pybfoam-0.1.10/scripts/clean_stubs.py +166 -0
  13. pybfoam-0.1.10/scripts/generate_stubs.sh +73 -0
  14. pybfoam-0.1.10/src/pybFoam/__init__.py +112 -0
  15. pybfoam-0.1.10/src/pybFoam/__init__.pyi +109 -0
  16. pybfoam-0.1.10/src/pybFoam/_version.py +1 -0
  17. pybfoam-0.1.10/src/pybFoam/_version.pyi +3 -0
  18. pybfoam-0.1.10/src/pybFoam/fvc/__init__.pyi +2 -0
  19. pybfoam-0.1.10/src/pybFoam/fvc/bind_fvc.cpp +197 -0
  20. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/fvc.pyi +81 -25
  21. pybfoam-0.1.10/src/pybFoam/fvm/__init__.pyi +2 -0
  22. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/fvm/bind_fvm.cpp +10 -9
  23. pybfoam-0.1.10/src/pybFoam/fvm.pyi +217 -0
  24. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/io/model_base.py +20 -18
  25. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/bind_cfdTools.cpp +25 -0
  26. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/bind_dict.cpp +126 -100
  27. pybfoam-0.1.10/src/pybFoam/pybFoam_core/bind_dimensioned.cpp +141 -0
  28. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/bind_dimensioned.hpp +1 -1
  29. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/bind_fields.cpp +205 -14
  30. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/bind_fields.hpp +3 -0
  31. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/bind_fvMatrix.cpp +3 -1
  32. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/bind_geo_fields.cpp +170 -14
  33. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/bind_primitives.cpp +92 -13
  34. pybfoam-0.1.10/src/pybFoam/pybFoam_core.pyi +2759 -0
  35. pybfoam-0.1.10/src/pybFoam/runTimeTables/__init__.pyi +2 -0
  36. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/runTimeTables.pyi +1 -1
  37. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/sampling/CMakeLists.txt +8 -8
  38. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/sampling/__init__.py +1 -1
  39. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/sampling/bind_sampling.cpp +46 -46
  40. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/sampling/sampling.cpp +1 -1
  41. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/sampling/set_configs.py +29 -30
  42. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/sampling/surface_configs.py +11 -11
  43. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/sampling/utils.py +13 -8
  44. pybfoam-0.1.10/src/pybFoam/sampling_bindings.pyi +188 -0
  45. pybfoam-0.1.10/src/pybFoam/thermo/__init__.pyi +2 -0
  46. pybfoam-0.1.10/src/pybFoam/thermo.pyi +36 -0
  47. pybfoam-0.1.10/src/pybFoam/turbulence/__init__.pyi +2 -0
  48. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/turbulence/bind_turbulence.cpp +2 -2
  49. pybfoam-0.1.10/src/pybFoam/turbulence.pyi +141 -0
  50. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/io/test_parse_ofdict.py +30 -0
  51. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/test_dict.py +1 -1
  52. pybfoam-0.1.10/tests/pybind/test_dimensioned.py +416 -0
  53. pybfoam-0.1.10/tests/pybind/test_field_tmp_interop.py +197 -0
  54. pybfoam-0.1.10/tests/pybind/test_fvc.py +69 -0
  55. pybfoam-0.1.10/tests/pybind/test_geoFields.py +192 -0
  56. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/test_primitives.py +145 -1
  57. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/test_set_sampling.py +0 -5
  58. pybfoam-0.1.10/tests/pybind/test_uniform_fields.py +68 -0
  59. pybfoam-0.1.8/docs/api.rst +0 -6
  60. pybfoam-0.1.8/scripts/generate_stubs.py +0 -77
  61. pybfoam-0.1.8/scripts/pyInstall.sh +0 -76
  62. pybfoam-0.1.8/src/pybFoam/__init__.py +0 -26
  63. pybfoam-0.1.8/src/pybFoam/_version.py +0 -1
  64. pybfoam-0.1.8/src/pybFoam/fvc/bind_fvc.cpp +0 -143
  65. pybfoam-0.1.8/src/pybFoam/pybFoam_core/bind_dimensioned.cpp +0 -47
  66. pybfoam-0.1.8/src/pybFoam/pybFoam_core.pyi +0 -777
  67. pybfoam-0.1.8/src/pybFoam/sampling.pyi +0 -258
  68. pybfoam-0.1.8/src/pybFoam/thermo.pyi +0 -23
  69. pybfoam-0.1.8/src/pybFoam/turbulence.pyi +0 -41
  70. pybfoam-0.1.8/tests/pybind/test_fvc.py +0 -34
  71. pybfoam-0.1.8/tests/pybind/test_geoFields.py +0 -66
  72. {pybfoam-0.1.8 → pybfoam-0.1.10}/.github/workflows/pages.yaml +0 -0
  73. {pybfoam-0.1.8 → pybfoam-0.1.10}/.github/workflows/release.yaml +0 -0
  74. {pybfoam-0.1.8 → pybfoam-0.1.10}/.gitignore +0 -0
  75. {pybfoam-0.1.8 → pybfoam-0.1.10}/CHANGELOG.md +0 -0
  76. {pybfoam-0.1.8 → pybfoam-0.1.10}/CMakePresets.json +0 -0
  77. {pybfoam-0.1.8 → pybfoam-0.1.10}/LICENSE +0 -0
  78. {pybfoam-0.1.8 → pybfoam-0.1.10}/benchmark/bench_complex.png +0 -0
  79. {pybfoam-0.1.8 → pybfoam-0.1.10}/benchmark/bench_vec_add.png +0 -0
  80. {pybfoam-0.1.8 → pybfoam-0.1.10}/benchmark/bench_vec_add_4.png +0 -0
  81. {pybfoam-0.1.8 → pybfoam-0.1.10}/cmake/FindOpenFOAM.cmake +0 -0
  82. {pybfoam-0.1.8 → pybfoam-0.1.10}/conftest.py +0 -0
  83. {pybfoam-0.1.8 → pybfoam-0.1.10}/docs/Makefile +0 -0
  84. {pybfoam-0.1.8 → pybfoam-0.1.10}/docs/README.md +0 -0
  85. {pybfoam-0.1.8 → pybfoam-0.1.10}/docs/changelog.rst +0 -0
  86. {pybfoam-0.1.8 → pybfoam-0.1.10}/docs/contributing.rst +0 -0
  87. {pybfoam-0.1.8 → pybfoam-0.1.10}/docs/index.rst +0 -0
  88. {pybfoam-0.1.8 → pybfoam-0.1.10}/docs/installation.rst +0 -0
  89. {pybfoam-0.1.8 → pybfoam-0.1.10}/docs/introduction.rst +0 -0
  90. {pybfoam-0.1.8 → pybfoam-0.1.10}/docs/make.bat +0 -0
  91. {pybfoam-0.1.8 → pybfoam-0.1.10}/docs/usage.rst +0 -0
  92. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/CMakeLists.txt +0 -0
  93. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/fvc/CMakeLists.txt +0 -0
  94. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/fvc/bind_fvc.hpp +0 -0
  95. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/fvc/fvc.cpp +0 -0
  96. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/fvm/CMakeLists.txt +0 -0
  97. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/fvm/bind_fvm.hpp +0 -0
  98. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/fvm/fvm.cpp +0 -0
  99. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/io/__init__.py +0 -0
  100. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/io/system.py +0 -0
  101. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/py.typed +0 -0
  102. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/CMakeLists.txt +0 -0
  103. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/bind_cfdTools.hpp +0 -0
  104. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/bind_control.cpp +0 -0
  105. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/bind_control.hpp +0 -0
  106. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/bind_dict.hpp +0 -0
  107. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/bind_fvMatrix.hpp +0 -0
  108. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/bind_geo_fields.hpp +0 -0
  109. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/bind_io.cpp +0 -0
  110. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/bind_io.hpp +0 -0
  111. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/bind_mesh.cpp +0 -0
  112. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/bind_mesh.hpp +0 -0
  113. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/bind_primitives.hpp +0 -0
  114. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/pybFoam_core/pybFoam.cpp +0 -0
  115. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/runTimeTables/CMakeLists.txt +0 -0
  116. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/runTimeTables/foam_runTimeTables.C +0 -0
  117. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/runTimeTables/foam_runTimeTables.H +0 -0
  118. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/runTimeTables/runTimeTables.C +0 -0
  119. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/sampling/bind_sampling.hpp +0 -0
  120. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/thermo/CMakeLists.txt +0 -0
  121. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/thermo/bind_thermo.cpp +0 -0
  122. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/thermo/bind_thermo.hpp +0 -0
  123. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/thermo/thermo.cpp +0 -0
  124. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/turbulence/CMakeLists.txt +0 -0
  125. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/turbulence/bind_turbulence.hpp +0 -0
  126. {pybfoam-0.1.8 → pybfoam-0.1.10}/src/pybFoam/turbulence/turbulence.cpp +0 -0
  127. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/cavity/0.orig/U +0 -0
  128. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/cavity/0.orig/nu +0 -0
  129. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/cavity/0.orig/p +0 -0
  130. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/cavity/Allclean +0 -0
  131. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/cavity/Allrun +0 -0
  132. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/cavity/constant/transportProperties +0 -0
  133. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/cavity/icoFoam.py +0 -0
  134. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/cavity/log2 +0 -0
  135. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/cavity/system/PDRblockMeshDict +0 -0
  136. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/cavity/system/blockMeshDict +0 -0
  137. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/cavity/system/controlDict +0 -0
  138. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/cavity/system/decomposeParDict +0 -0
  139. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/cavity/system/fvSchemes +0 -0
  140. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/cavity/system/fvSolution +0 -0
  141. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/elbow/0.orig/U +0 -0
  142. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/elbow/0.orig/nu +0 -0
  143. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/elbow/0.orig/p +0 -0
  144. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/elbow/Allclean +0 -0
  145. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/elbow/Allrun +0 -0
  146. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/elbow/constant/transportProperties +0 -0
  147. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/elbow/icoFoam.py +0 -0
  148. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/elbow/system/controlDict +0 -0
  149. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/elbow/system/foamDataToFluentDict +0 -0
  150. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/elbow/system/fvSchemes +0 -0
  151. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/elbow/system/fvSolution +0 -0
  152. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/io/TestDict +0 -0
  153. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/io/TestDict.json +0 -0
  154. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/io/TestDict.yaml +0 -0
  155. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/io/controlDict +0 -0
  156. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/io/fvSchemes +0 -0
  157. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/io/fvSolution +0 -0
  158. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/io/test_controlDict.py +0 -0
  159. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/io/test_fvSchemes.py +0 -0
  160. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/io/test_fvSolution.py +0 -0
  161. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/0/U +0 -0
  162. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/0/alpha.water +0 -0
  163. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/0/p_rgh +0 -0
  164. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/0.orig/U +0 -0
  165. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/0.orig/alpha.water +0 -0
  166. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/0.orig/p_rgh +0 -0
  167. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/Allclean +0 -0
  168. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/Allrun +0 -0
  169. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/Allrun-parallel +0 -0
  170. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/constant/dynamicMeshDict +0 -0
  171. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/constant/g +0 -0
  172. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/constant/polyMesh/boundary +0 -0
  173. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/constant/polyMesh/faces +0 -0
  174. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/constant/polyMesh/neighbour +0 -0
  175. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/constant/polyMesh/owner +0 -0
  176. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/constant/polyMesh/points +0 -0
  177. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/constant/transportProperties +0 -0
  178. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/constant/turbulenceProperties +0 -0
  179. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/system/TestDict +0 -0
  180. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/system/blockMeshDict +0 -0
  181. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/system/controlDict +0 -0
  182. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/system/decomposeParDict +0 -0
  183. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/system/fvSchemes +0 -0
  184. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/system/fvSolution +0 -0
  185. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/system/setFieldsDict +0 -0
  186. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/test_fvm.py +0 -0
  187. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/pybind/test_surface_sampling.py +0 -0
  188. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/test_sampling_models.py +0 -0
  189. {pybfoam-0.1.8 → pybfoam-0.1.10}/tests/test_sampling_set_configs.py +0 -0
@@ -28,9 +28,15 @@ jobs:
28
28
  - name: Install build dependencies
29
29
  run: |
30
30
  python -m pip install --upgrade pip
31
+
31
32
  - name: Build package
32
33
  run: |
33
34
  pip install .[dev]
35
+
34
36
  - name: Run tests
35
37
  run: |
36
- pytest
38
+ pytest
39
+
40
+ - name: run type checking
41
+ run: |
42
+ mypy
@@ -5,7 +5,7 @@ if(POLICY CMP0169)
5
5
  cmake_policy(SET CMP0169 OLD)
6
6
  endif()
7
7
 
8
- project(pybFoam VERSION 0.1.8 LANGUAGES CXX)
8
+ project(pybFoam VERSION 0.1.10 LANGUAGES CXX)
9
9
 
10
10
  # Set C++ standard
11
11
  set(CMAKE_CXX_STANDARD 17)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pybFoam
3
- Version: 0.1.8
3
+ Version: 0.1.10
4
4
  Summary: python bindings for OpenFOAM
5
5
  Keywords: OpenFOAM,simulation,CFD
6
6
  Author-Email: Henning Scheufler <henning.scheufler@web.de>
@@ -36,6 +36,8 @@ Requires-Dist: isort; extra == "dev"
36
36
  Requires-Dist: mypy; extra == "dev"
37
37
  Requires-Dist: cmake>=3.18; extra == "dev"
38
38
  Requires-Dist: pybind11-stubgen>=2.5; extra == "dev"
39
+ Requires-Dist: mypy; extra == "dev"
40
+ Requires-Dist: types-PyYAML; extra == "dev"
39
41
  Provides-Extra: docs
40
42
  Requires-Dist: sphinx>=4.0; extra == "docs"
41
43
  Requires-Dist: sphinx-sitemap; extra == "docs"
@@ -46,6 +48,7 @@ Requires-Dist: jax; extra == "benchmark"
46
48
  Requires-Dist: seaborn; extra == "benchmark"
47
49
  Requires-Dist: matplotlib; extra == "benchmark"
48
50
  Requires-Dist: PyQt6; extra == "benchmark"
51
+ Requires-Dist: tabulate; extra == "benchmark"
49
52
  Provides-Extra: all
50
53
  Requires-Dist: pybFoam[benchmark,dev,docs]; extra == "all"
51
54
  Description-Content-Type: text/markdown
@@ -103,9 +106,27 @@ pip install .
103
106
 
104
107
  For development:
105
108
  ```bash
106
- pip install -e . --no-build-isolation
109
+ pip install -e .[all]
110
+ ```
111
+
112
+ #### Generating Type Stubs (Development only)
113
+
114
+ Type stubs (.pyi files) are generated post-installation using a separate script:
115
+
116
+ ```bash
117
+ # Install the package first
118
+ uv pip install -e .[all]
119
+
120
+ # Generate and verify stubs
121
+ ./scripts/generate_stubs.sh
107
122
  ```
108
123
 
124
+ This script:
125
+ 1. Generates stubs using pybind11-stubgen
126
+ 2. Cleans and formats the stubs
127
+ 3. Copies them to the source directory
128
+ 4. Verifies them with mypy
129
+
109
130
  ---
110
131
 
111
132
  ## Quick Start
@@ -216,6 +237,8 @@ Full documentation is available at: [https://henningscheufler.github.io/pybFoam/
216
237
  2. Install development dependencies:
217
238
  ```bash
218
239
  pip install -e ".[dev]"
240
+ # or build with stubs
241
+ pip install -e .[all] -C cmake.define.ENABLE_PYBFOAM_STUBS=ON -v
219
242
  ```
220
243
  3. Run tests before committing:
221
244
  ```bash
@@ -51,9 +51,27 @@ pip install .
51
51
 
52
52
  For development:
53
53
  ```bash
54
- pip install -e . --no-build-isolation
54
+ pip install -e .[all]
55
55
  ```
56
56
 
57
+ #### Generating Type Stubs (Development only)
58
+
59
+ Type stubs (.pyi files) are generated post-installation using a separate script:
60
+
61
+ ```bash
62
+ # Install the package first
63
+ uv pip install -e .[all]
64
+
65
+ # Generate and verify stubs
66
+ ./scripts/generate_stubs.sh
67
+ ```
68
+
69
+ This script:
70
+ 1. Generates stubs using pybind11-stubgen
71
+ 2. Cleans and formats the stubs
72
+ 3. Copies them to the source directory
73
+ 4. Verifies them with mypy
74
+
57
75
  ---
58
76
 
59
77
  ## Quick Start
@@ -164,6 +182,8 @@ Full documentation is available at: [https://henningscheufler.github.io/pybFoam/
164
182
  2. Install development dependencies:
165
183
  ```bash
166
184
  pip install -e ".[dev]"
185
+ # or build with stubs
186
+ pip install -e .[all] -C cmake.define.ENABLE_PYBFOAM_STUBS=ON -v
167
187
  ```
168
188
  3. Run tests before committing:
169
189
  ```bash
@@ -86,43 +86,70 @@ def add_data(n_elements, duration, method):
86
86
  for n_elements in [10, 100, 1000, 10_000, 100_000, 1_000_000, 10_000_000]:
87
87
 
88
88
  bench = pybfoam_expression(n_elements)
89
- # duration = timeit.timeit(bench, number=1)
90
- t0 = time.perf_counter() # lower overhead than timeit
91
- bench()
92
- t1 = time.perf_counter()
93
- duration = t1 - t0
94
- add_data(n_elements, duration, "pybFoam")
89
+ n_repeat = 100
90
+ duration = timeit.timeit(bench, number=n_repeat)
91
+ # t0 = time.perf_counter() # lower overhead than timeit
92
+ # bench()
93
+ # t1 = time.perf_counter()
94
+ # duration = t1 - t0
95
+ add_data(n_elements, duration / n_repeat, "pybFoam")
95
96
 
96
97
  bench = numpy_expression(n_elements)
97
- # duration = timeit.timeit(bench, number=1)
98
- t0 = time.perf_counter() # lower overhead than timeit
99
- bench()
100
- t1 = time.perf_counter()
101
- duration = t1 - t0
102
- add_data(n_elements, duration, "NumPy")
98
+ duration = timeit.timeit(bench, number=n_repeat)
99
+ # t0 = time.perf_counter() # lower overhead than timeit
100
+ # bench()
101
+ # t1 = time.perf_counter()
102
+ # duration = t1 - t0
103
+ add_data(n_elements, duration / n_repeat, "NumPy")
103
104
 
104
105
  bench = jax_expression(n_elements)
105
106
  # First call to compile
106
107
  bench()
107
- # duration = timeit.timeit(bench, number=1)
108
- t0 = time.perf_counter() # lower overhead than timeit
109
- bench()
110
- t1 = time.perf_counter()
111
- duration = t1 - t0
112
- add_data(n_elements, duration, "JAX")
108
+ duration = timeit.timeit(bench, number=n_repeat)
109
+ # t0 = time.perf_counter() # lower overhead than timeit
110
+ # bench()
111
+ # t1 = time.perf_counter()
112
+ # duration = t1 - t0
113
+ add_data(n_elements, duration / n_repeat, "JAX")
113
114
 
114
115
 
115
116
  df_vector_add = pd.DataFrame(vector_add_data)
116
117
  df_vector_add["time_per_element [ns]"] = df_vector_add["duration"] / df_vector_add["n_elements"] * 1e9 # time per element in nanoseconds
117
118
  print("Vector Addition Benchmark:",df_vector_add)
118
119
 
120
+ # Save results to CSV
121
+ df_vector_add.to_csv("results/benchmark_complex.csv", index=False)
122
+ print("\nResults saved to: results/benchmark_complex.csv")
123
+
124
+ # Create pivot table for markdown
125
+ pivot_df = df_vector_add.pivot(index="n_elements", columns="method", values="time_per_element [ns]")
126
+ pivot_df = pivot_df.round(2)
127
+
128
+ # Save markdown table
129
+ with open("results/benchmark_complex.md", "w") as f:
130
+ f.write("# Complex Expression Benchmark\n\n")
131
+ f.write("Expression: `(x * y + b) / (a + 1.0)`\n\n")
132
+ f.write("where:\n")
133
+ f.write("- `x = a * b + c`\n")
134
+ f.write("- `y = d - a * c`\n\n")
135
+ f.write("## Results (time per element in nanoseconds)\n\n")
136
+ f.write(pivot_df.to_markdown())
137
+ f.write("\n\n## Summary\n\n")
138
+ for n_elem in [1_000_000, 10_000_000]:
139
+ if n_elem in pivot_df.index:
140
+ f.write(f"\n### {n_elem:,} elements:\n\n")
141
+ for method in pivot_df.columns:
142
+ f.write(f"- **{method}**: {pivot_df.loc[n_elem, method]:.2f} ns per element\n")
143
+
144
+ print("Results table saved to: results/benchmark_complex.md")
145
+
119
146
  sns.lineplot(data=df_vector_add, x="n_elements", y="time_per_element [ns]", hue="method", marker="o")
120
147
  plt.xscale("log")
121
148
  plt.yscale("log")
122
149
  plt.xlabel("Number of Elements")
123
150
  plt.ylabel("Time per Element (nanoseconds)")
124
151
  plt.title("Expression: (x * y + b) / (a + 1.0)")
125
- plt.savefig("bench_complex.png")
152
+ plt.savefig("results/bench_complex.png")
126
153
  n_elements = 10_000_000
127
154
  timings = df_vector_add[df_vector_add["n_elements"] == n_elements]
128
155
  print(f"Timings for {n_elements} elements:")
@@ -97,13 +97,35 @@ df_vector_add = pd.DataFrame(vector_add_data)
97
97
  df_vector_add["time_per_element [ns]"] = df_vector_add["duration"] / df_vector_add["n_elements"] * 1e9 # time per element in nanoseconds
98
98
  print("Vector Addition Benchmark:",df_vector_add)
99
99
 
100
+ # Save results to CSV
101
+ df_vector_add.to_csv("results/benchmark_vec_add.csv", index=False)
102
+ print("\nResults saved to: results/benchmark_vec_add.csv")
103
+
104
+ # Create pivot table for markdown
105
+ pivot_df = df_vector_add.pivot(index="n_elements", columns="method", values="time_per_element [ns]")
106
+ pivot_df = pivot_df.round(2)
107
+
108
+ # Save markdown table
109
+ with open("results/benchmark_vec_add.md", "w") as f:
110
+ f.write("# Simple Vector Addition Benchmark\n\n")
111
+ f.write("Expression: `c = a + b`\n\n")
112
+ f.write("## Results (time per element in nanoseconds)\n\n")
113
+ f.write(pivot_df.to_markdown())
114
+ f.write("\n\n## Summary\n\n")
115
+ f.write(f"\n### {10_000_000:,} elements:\n\n")
116
+ if 10_000_000 in pivot_df.index:
117
+ for method in pivot_df.columns:
118
+ f.write(f"- **{method}**: {pivot_df.loc[10_000_000, method]:.2f} ns per element\n")
119
+
120
+ print("Results table saved to: results/benchmark_vec_add.md")
121
+
100
122
  sns.lineplot(data=df_vector_add, x="n_elements", y="time_per_element [ns]", hue="method", marker="o")
101
123
  plt.xscale("log")
102
124
  plt.yscale("log")
103
125
  plt.xlabel("Number of Elements")
104
126
  plt.ylabel("Time per Element (nanoseconds)")
105
127
  plt.title("Expression: c = a + b")
106
- plt.savefig("bench_vec_add.png")
128
+ plt.savefig("results/bench_vec_add.png")
107
129
 
108
130
  n_elements = 10_000_000
109
131
  timings = df_vector_add[df_vector_add["n_elements"] == n_elements]
@@ -101,13 +101,35 @@ df_vector_add = pd.DataFrame(vector_add_data_4)
101
101
  df_vector_add["time_per_element [ns]"] = df_vector_add["duration"] / df_vector_add["n_elements"] * 1e9 # time per element in nanoseconds
102
102
  print("Vector Addition Benchmark:",df_vector_add)
103
103
 
104
+ # Save results to CSV
105
+ df_vector_add.to_csv("results/benchmark_vec_add_4.csv", index=False)
106
+ print("\nResults saved to: results/benchmark_vec_add_4.csv")
107
+
108
+ # Create pivot table for markdown
109
+ pivot_df = df_vector_add.pivot(index="n_elements", columns="method", values="time_per_element [ns]")
110
+ pivot_df = pivot_df.round(2)
111
+
112
+ # Save markdown table
113
+ with open("results/benchmark_vec_add_4.md", "w") as f:
114
+ f.write("# 4-Element Vector Addition Benchmark\n\n")
115
+ f.write("Expression: `c = a + b + c + a`\n\n")
116
+ f.write("## Results (time per element in nanoseconds)\n\n")
117
+ f.write(pivot_df.to_markdown())
118
+ f.write("\n\n## Summary\n\n")
119
+ f.write(f"\n### {10_000_000:,} elements:\n\n")
120
+ if 10_000_000 in pivot_df.index:
121
+ for method in pivot_df.columns:
122
+ f.write(f"- **{method}**: {pivot_df.loc[10_000_000, method]:.2f} ns per element\n")
123
+
124
+ print("Results table saved to: results/benchmark_vec_add_4.md")
125
+
104
126
  sns.lineplot(data=df_vector_add, x="n_elements", y="time_per_element [ns]", hue="method", marker="o")
105
127
  plt.xscale("log")
106
128
  plt.yscale("log")
107
129
  plt.xlabel("Number of Elements")
108
130
  plt.ylabel("Time per Element (nanoseconds)")
109
131
  plt.title("Expression: c = a + b + c + a")
110
- plt.savefig("bench_vec_add_4.png")
132
+ plt.savefig("results/bench_vec_add_4.png")
111
133
  n_elements = 10_000_000
112
134
  timings = df_vector_add[df_vector_add["n_elements"] == n_elements]
113
135
  print(f"Timings for {n_elements} elements:")
@@ -42,35 +42,11 @@ function(add_pybind11)
42
42
  endif()
43
43
  endfunction()
44
44
 
45
- # Function to add testing dependencies
46
- function(add_testing_deps)
47
- # Add Catch2 for C++ testing
48
- CPMAddPackage(
49
- NAME Catch2
50
- GITHUB_REPOSITORY catchorg/Catch2
51
- VERSION 3.4.0
52
- OPTIONS
53
- "CATCH_INSTALL_DOCS OFF"
54
- "CATCH_INSTALL_EXTRAS OFF"
55
- )
56
-
57
- if(Catch2_ADDED)
58
- message(STATUS "Added Catch2 for testing")
59
- endif()
60
- endfunction()
61
-
62
45
  # Main function to configure all dependencies
63
46
  function(configure_dependencies)
64
47
  message(STATUS "Configuring dependencies with CPM...")
65
-
66
48
  # Essential dependencies
67
49
  add_pybind11()
68
-
69
- option(PYBFOAM_BUILD_TESTS "Build tests" ON)
70
- if(PYBFOAM_BUILD_TESTS)
71
- add_testing_deps()
72
- endif()
73
-
74
50
  message(STATUS "Dependencies configuration complete")
75
51
  endfunction()
76
52
 
@@ -0,0 +1,6 @@
1
+ API Reference
2
+ =============
3
+
4
+ .. automodule:: pybFoam
5
+ :members:
6
+ :undoc-members:
@@ -9,7 +9,7 @@
9
9
  project = "pybFoam"
10
10
  copyright = "2025, Henning Scheufler"
11
11
  author = "Henning Scheufler"
12
- release = "0.1.8"
12
+ release = "0.1.10"
13
13
 
14
14
  # -- General configuration ---------------------------------------------------
15
15
  # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pybFoam"
3
- version = "0.1.8"
3
+ version = "0.1.10"
4
4
  authors = [
5
5
  {name = "Henning Scheufler", email = "henning.scheufler@web.de"},
6
6
  ]
@@ -42,6 +42,8 @@ dev = [
42
42
  "mypy",
43
43
  "cmake>=3.18",
44
44
  "pybind11-stubgen>=2.5",
45
+ "mypy",
46
+ "types-PyYAML",
45
47
  ]
46
48
  docs = [
47
49
  "sphinx>=4.0",
@@ -53,7 +55,8 @@ benchmark = [
53
55
  "jax",
54
56
  "seaborn",
55
57
  "matplotlib",
56
- "PyQt6"
58
+ "PyQt6",
59
+ "tabulate"
57
60
  ]
58
61
  all = [
59
62
  "pybFoam[dev,docs,benchmark]",
@@ -72,7 +75,7 @@ zip-safe = false
72
75
  requires = [
73
76
  "scikit-build-core[pyproject]>=0.4.3",
74
77
  "pybind11>=2.6.0",
75
- "cmake>=3.18",
78
+ "cmake>=3.18"
76
79
  ]
77
80
  build-backend = "scikit_build_core.build"
78
81
 
@@ -92,11 +95,19 @@ editable.rebuild = false
92
95
  [tool.scikit-build.cmake.define]
93
96
  PYBIND11_FINDPYTHON = "ON"
94
97
  CMAKE_CXX_STANDARD = "17"
98
+ # Stub generation disabled by default
99
+ # Developers enable with: uv sync --all-extras -C cmake.define.ENABLE_PYBFOAM_STUBS=ON
95
100
 
96
101
  # Generate stubs for better IDE support
97
102
  [tool.scikit-build.experimental]
98
103
  generate-type-stubs = true
99
104
 
100
105
  [tool.pytest.ini_options]
101
- addopts = "-ra -v"
106
+ addopts = "-ra -v -s"
102
107
  testpaths = ["tests"]
108
+
109
+ [tool.mypy]
110
+ plugins = ["pydantic.mypy"]
111
+ mypy_path = ["src"]
112
+ strict = true
113
+ files = ["src"]
@@ -0,0 +1,166 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Clean pybFoam_core.pyi by replacing C++ Foam:: types with Python types.
4
+ """
5
+
6
+ import re
7
+ from pathlib import Path
8
+
9
+ # Type replacements: C++ pattern -> Python type
10
+ # IMPORTANT: Order matters! Most complex/specific patterns FIRST, simple patterns LAST
11
+ # This prevents partial replacements from breaking complex pattern matching
12
+ TYPE_REPLACEMENTS = {
13
+ # ===================================================================
14
+ # MOST COMPLEX PATTERNS FIRST - tmp wrapped geometric fields
15
+ # ===================================================================
16
+
17
+ # tmp wrapped geometric fields - volume
18
+ r'Foam::tmp<Foam::GeometricField<double,\s*Foam::fvPatchField,\s*Foam::volMesh>>': 'tmp_volScalarField',
19
+ r'Foam::tmp<Foam::GeometricField<Foam::Vector<double>,\s*Foam::fvPatchField,\s*Foam::volMesh>>': 'tmp_volVectorField',
20
+ r'Foam::tmp<Foam::GeometricField<Foam::Tensor<double>,\s*Foam::fvPatchField,\s*Foam::volMesh>>': 'tmp_volTensorField',
21
+ r'Foam::tmp<Foam::GeometricField<Foam::SymmTensor<double>,\s*Foam::fvPatchField,\s*Foam::volMesh>>': 'tmp_volSymmTensorField',
22
+
23
+ # tmp wrapped geometric fields - surface
24
+ r'Foam::tmp<Foam::GeometricField<double,\s*Foam::fvsPatchField,\s*Foam::surfaceMesh>>': 'tmp_surfaceScalarField',
25
+ r'Foam::tmp<Foam::GeometricField<Foam::Vector<double>,\s*Foam::fvsPatchField,\s*Foam::surfaceMesh>>': 'tmp_surfaceVectorField',
26
+ r'Foam::tmp<Foam::GeometricField<Foam::Tensor<double>,\s*Foam::fvsPatchField,\s*Foam::surfaceMesh>>': 'tmp_surfaceTensorField',
27
+ r'Foam::tmp<Foam::GeometricField<Foam::SymmTensor<double>,\s*Foam::fvsPatchField,\s*Foam::surfaceMesh>>': 'tmp_surfaceSymmTensorField',
28
+
29
+ # tmp wrapped fields with full type names
30
+ r'Foam::tmp<Foam::Field<double>>': 'tmp_scalarField',
31
+ r'Foam::tmp<Foam::Field<Foam::Vector<double>>>': 'tmp_vectorField',
32
+ r'Foam::tmp<Foam::Field<Foam::Tensor<double>>>': 'tmp_tensorField',
33
+ r'Foam::tmp<Foam::Field<Foam::SymmTensor<double>>>': 'tmp_symmTensorField',
34
+
35
+ # ===================================================================
36
+ # GEOMETRIC FIELDS - volume and surface
37
+ # ===================================================================
38
+
39
+ # Geometric fields - volume
40
+ r'Foam::GeometricField<double,\s*Foam::fvPatchField,\s*Foam::volMesh>': 'volScalarField',
41
+ r'Foam::GeometricField<Foam::Vector<double>,\s*Foam::fvPatchField,\s*Foam::volMesh>': 'volVectorField',
42
+ r'Foam::GeometricField<Foam::Tensor<double>,\s*Foam::fvPatchField,\s*Foam::volMesh>': 'volTensorField',
43
+ r'Foam::GeometricField<Foam::SymmTensor<double>,\s*Foam::fvPatchField,\s*Foam::volMesh>': 'volSymmTensorField',
44
+
45
+ # Geometric fields - surface
46
+ r'Foam::GeometricField<double,\s*Foam::fvsPatchField,\s*Foam::surfaceMesh>': 'surfaceScalarField',
47
+ r'Foam::GeometricField<Foam::Vector<double>,\s*Foam::fvsPatchField,\s*Foam::surfaceMesh>': 'surfaceVectorField',
48
+ r'Foam::GeometricField<Foam::Tensor<double>,\s*Foam::fvsPatchField,\s*Foam::surfaceMesh>': 'surfaceTensorField',
49
+ r'Foam::GeometricField<Foam::SymmTensor<double>,\s*Foam::fvsPatchField,\s*Foam::surfaceMesh>': 'surfaceSymmTensorField',
50
+
51
+ # ===================================================================
52
+ # FIELD TYPES with full type names
53
+ # ===================================================================
54
+
55
+ r'Foam::Field<double>': 'scalarField',
56
+ r'Foam::Field<Foam::Vector<double>>': 'vectorField',
57
+ r'Foam::Field<Foam::Tensor<double>>': 'tensorField',
58
+ r'Foam::Field<Foam::SymmTensor<double>>': 'symmTensorField',
59
+
60
+ # ===================================================================
61
+ # SOLVER PERFORMANCE with full type names
62
+ # ===================================================================
63
+
64
+ r'Foam::SolverPerformance<double>': 'SolverScalarPerformance',
65
+ r'Foam::SolverPerformance<Foam::Vector<double>\s*>': 'SolverVectorPerformance',
66
+ r'Foam::SolverPerformance<Foam::Tensor<double>\s*>': 'SolverTensorPerformance',
67
+ r'Foam::SolverPerformance<Foam::SymmTensor<double>\s*>': 'SolverSymmTensorPerformance',
68
+
69
+ # ===================================================================
70
+ # DIMENSIONED TYPES with full type names
71
+ # ===================================================================
72
+
73
+ r'Foam::dimensioned<double>': 'dimensionedScalar',
74
+ r'Foam::dimensioned<Foam::Vector<double>\s*>': 'dimensionedVector',
75
+ r'Foam::dimensioned<Foam::Tensor<double>\s*>': 'dimensionedTensor',
76
+ r'Foam::dimensioned<Foam::SymmTensor<double>\s*>': 'dimensionedSymmTensor',
77
+
78
+ # ===================================================================
79
+ # FV MATRIX TYPES with full type names
80
+ # ===================================================================
81
+
82
+ r'Foam::fvMatrix<double>': 'fvScalarMatrix',
83
+ r'Foam::fvMatrix<Foam::Vector<double>\s*>': 'fvVectorMatrix',
84
+ r'Foam::fvMatrix<Foam::Tensor<double>\s*>': 'fvTensorMatrix',
85
+ r'Foam::fvMatrix<Foam::SymmTensor<double>\s*>': 'fvSymmTensorMatrix',
86
+
87
+ # ===================================================================
88
+ # LISTS
89
+ # ===================================================================
90
+
91
+ r'Foam::List<Foam::word>': 'wordList',
92
+ r'Foam::List<Foam::instant>': 'instantList',
93
+ r'Foam::List<int>': 'labelList',
94
+ r'Foam::List<bool>': 'boolList',
95
+
96
+ # ===================================================================
97
+ # SIMPLE TYPES - Must come LAST!
98
+ # ===================================================================
99
+
100
+ # dictionary
101
+ r'Foam::dictionary': 'dictionary',
102
+
103
+ # Primitives - these come last to avoid breaking complex patterns
104
+ r'Foam::Vector<double>': 'vector',
105
+ r'Foam::Tensor<double>': 'tensor',
106
+ r'Foam::SymmTensor<double>': 'symmTensor',
107
+
108
+ # Simple object types
109
+ r'Foam::word': 'Word',
110
+ r'Foam::Time': 'Time',
111
+ r'Foam::fvMesh': 'fvMesh',
112
+ r'Foam::instant': 'instant',
113
+ }
114
+
115
+
116
+ def main():
117
+ # Look for stubs directory relative to current working directory
118
+ cwd = Path.cwd()
119
+ stubs_dir = cwd / 'stubs'
120
+
121
+ # If not found in cwd, try relative to script location
122
+ if not stubs_dir.exists():
123
+ script_dir = Path(__file__).parent.parent
124
+ stubs_dir = script_dir / 'stubs'
125
+
126
+ if not stubs_dir.exists():
127
+ print(f"Error: stubs directory not found (tried {cwd / 'stubs'} and {script_dir / 'stubs'})")
128
+ return
129
+
130
+ # Process all .pyi files in stubs directory recursively
131
+ stub_files = list(stubs_dir.glob('**/*.pyi'))
132
+
133
+ if not stub_files:
134
+ print(f"No stub files found in {stubs_dir}")
135
+ return
136
+
137
+ print(f"Cleaning {len(stub_files)} stub file(s) in {stubs_dir}...")
138
+
139
+ for stub_file in stub_files:
140
+ # Show relative path for clarity
141
+ relative_path = stub_file.relative_to(stubs_dir)
142
+ print(f" Processing {relative_path}...")
143
+ content = stub_file.read_text()
144
+ original = content
145
+
146
+ # Normalize whitespace in C++ templates first
147
+ # Fix broken scope operators: "Foam: :Type" -> "Foam::Type"
148
+ content = re.sub(r':\s+:', '::', content)
149
+ # Remove spaces before closing >
150
+ content = re.sub(r'\s+>', '>', content)
151
+
152
+ # Apply all replacements
153
+ for pattern, replacement in TYPE_REPLACEMENTS.items():
154
+ content = re.sub(pattern, replacement, content)
155
+
156
+ if content != original:
157
+ stub_file.write_text(content)
158
+ print(f" ✓ Cleaned {relative_path}")
159
+ else:
160
+ print(f" - No changes needed for {relative_path}")
161
+
162
+ print(f"\nStub cleaning complete!")
163
+
164
+
165
+ if __name__ == '__main__':
166
+ main()
@@ -0,0 +1,73 @@
1
+ #!/bin/bash
2
+ # Generate type stubs for pybFoam after installation
3
+ # Usage: ./scripts/generate_stubs.sh
4
+
5
+ set -e
6
+
7
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
+ PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
9
+ STUBS_DIR="$PROJECT_ROOT/stubs"
10
+ SRC_DIR="$PROJECT_ROOT/src/pybFoam"
11
+
12
+ echo "Project Root: $PROJECT_ROOT"
13
+ echo "Source Directory: $SRC_DIR"
14
+ echo "Stubs Directory: $STUBS_DIR"
15
+
16
+ echo "==================================="
17
+ echo "pybFoam Stub Generator"
18
+ echo "==================================="
19
+ echo ""
20
+
21
+ # Check if pybFoam is installed
22
+ if ! uv run python -c "import pybFoam" 2>/dev/null; then
23
+ echo "Error: pybFoam is not installed!"
24
+ echo "Please install first: uv pip install -e .[all]"
25
+ exit 1
26
+ fi
27
+
28
+ echo "✓ pybFoam is installed"
29
+ echo ""
30
+
31
+ # Generate stubs
32
+ echo "Generating stubs..."
33
+ rm -rf "$STUBS_DIR"
34
+ uv run pybind11-stubgen -o "$STUBS_DIR" --print-invalid-expressions-as-is pybFoam
35
+
36
+ if [ ! -d "$STUBS_DIR/pybFoam" ]; then
37
+ echo "Error: Stub generation failed!"
38
+ exit 1
39
+ fi
40
+
41
+ echo "✓ Stubs generated in $STUBS_DIR"
42
+ echo ""
43
+
44
+ # Clean stubs
45
+ echo "Cleaning stubs..."
46
+ uv run python "$SCRIPT_DIR/clean_stubs.py"
47
+ echo "✓ Stubs cleaned"
48
+ echo ""
49
+
50
+ # Copy stubs to source directory
51
+ echo "Copying stubs to source directory..."
52
+ cp -r "$STUBS_DIR/pybFoam/"* "$SRC_DIR/"
53
+ echo "✓ Stubs copied to $SRC_DIR"
54
+ echo ""
55
+
56
+ # Verify with mypy
57
+ echo "Verifying stubs with mypy..."
58
+ if uv run mypy --version >/dev/null 2>&1; then
59
+ echo ""
60
+ echo "Running mypy on pybFoam..."
61
+ uv run mypy "$SRC_DIR" --show-error-codes || true
62
+ echo ""
63
+ else
64
+ echo "Warning: mypy not installed, skipping verification"
65
+ echo "Install with: uv pip install mypy"
66
+ fi
67
+
68
+ echo "==================================="
69
+ echo "✓ Stub generation complete!"
70
+ echo "==================================="
71
+ echo ""
72
+ echo "Generated stub files:"
73
+ find "$SRC_DIR" -name "*.pyi" -type f | sort