xcoll 0.5.12__py3-none-any.whl → 0.6.0__py3-none-any.whl

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.

Potentially problematic release.


This version of xcoll might be problematic. Click here for more details.

Files changed (333) hide show
  1. xcoll/__init__.py +5 -18
  2. xcoll/beam_elements/__init__.py +1 -0
  3. xcoll/beam_elements/absorber.py +12 -2
  4. xcoll/beam_elements/base.py +162 -62
  5. xcoll/beam_elements/blowup.py +1 -0
  6. xcoll/beam_elements/elements_src/black_absorber.h +57 -58
  7. xcoll/beam_elements/elements_src/black_crystal.h +49 -50
  8. xcoll/beam_elements/elements_src/everest_block.h +21 -11
  9. xcoll/beam_elements/elements_src/everest_collimator.h +100 -91
  10. xcoll/beam_elements/elements_src/everest_crystal.h +145 -140
  11. xcoll/beam_elements/elements_src/transparent_collimator.h +126 -0
  12. xcoll/beam_elements/elements_src/transparent_crystal.h +118 -0
  13. xcoll/beam_elements/everest.py +16 -5
  14. xcoll/beam_elements/monitor.py +1 -0
  15. xcoll/beam_elements/transparent.py +83 -0
  16. xcoll/colldb.py +15 -6
  17. xcoll/general.py +1 -1
  18. xcoll/headers/particle_states.py +51 -0
  19. xcoll/initial_distribution.py +121 -91
  20. xcoll/interaction_record/interaction_record.py +2 -1
  21. xcoll/interaction_record/interaction_types.py +2 -2
  22. xcoll/line_tools.py +163 -73
  23. xcoll/lossmap.py +519 -127
  24. xcoll/plot.py +109 -0
  25. xcoll/rf_sweep.py +6 -0
  26. xcoll/scattering_routines/engine.py +414 -217
  27. xcoll/scattering_routines/environment.py +297 -0
  28. xcoll/scattering_routines/everest/amorphous.h +95 -71
  29. xcoll/scattering_routines/everest/{channeling.h → channelling.h} +121 -112
  30. xcoll/scattering_routines/everest/constants.h +1 -1
  31. xcoll/scattering_routines/everest/crystal_parameters.h +9 -9
  32. xcoll/scattering_routines/everest/everest.h +8 -3
  33. xcoll/scattering_routines/everest/everest.py +2 -1
  34. xcoll/scattering_routines/everest/ionisation_loss.h +141 -0
  35. xcoll/scattering_routines/everest/jaw.h +19 -24
  36. xcoll/scattering_routines/everest/materials.py +2 -0
  37. xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +2 -2
  38. xcoll/scattering_routines/everest/nuclear_interaction.h +35 -19
  39. xcoll/scattering_routines/everest/properties.h +3 -72
  40. xcoll/xaux.py +65 -109
  41. {xcoll-0.5.12.dist-info → xcoll-0.6.0.dist-info}/METADATA +5 -5
  42. xcoll-0.6.0.dist-info/RECORD +135 -0
  43. xcoll/_manager.py +0 -22
  44. xcoll/headers/particle_states.h +0 -25
  45. xcoll/install.py +0 -35
  46. xcoll/scattering_routines/geant4/collimasim/.git +0 -1
  47. xcoll/scattering_routines/geant4/collimasim/.gitignore +0 -12
  48. xcoll/scattering_routines/geant4/collimasim/.gitmodules +0 -3
  49. xcoll/scattering_routines/geant4/collimasim/CMakeLists.txt +0 -26
  50. xcoll/scattering_routines/geant4/collimasim/README.md +0 -21
  51. xcoll/scattering_routines/geant4/collimasim/docs/Makefile +0 -20
  52. xcoll/scattering_routines/geant4/collimasim/docs/make.bat +0 -35
  53. xcoll/scattering_routines/geant4/collimasim/docs/source/collimasim.rst +0 -10
  54. xcoll/scattering_routines/geant4/collimasim/docs/source/conf.py +0 -59
  55. xcoll/scattering_routines/geant4/collimasim/docs/source/index.rst +0 -26
  56. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.appveyor.yml +0 -37
  57. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-format +0 -19
  58. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-tidy +0 -65
  59. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.cmake-format.yaml +0 -73
  60. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.git +0 -1
  61. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CODEOWNERS +0 -9
  62. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CONTRIBUTING.md +0 -386
  63. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/bug-report.yml +0 -45
  64. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/config.yml +0 -8
  65. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/dependabot.yml +0 -16
  66. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler.yml +0 -8
  67. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler_merged.yml +0 -3
  68. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/pull_request_template.md +0 -19
  69. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/ci.yml +0 -969
  70. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/configure.yml +0 -84
  71. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/format.yml +0 -48
  72. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/labeler.yml +0 -16
  73. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/pip.yml +0 -103
  74. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.gitignore +0 -45
  75. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.pre-commit-config.yaml +0 -151
  76. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.readthedocs.yml +0 -3
  77. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/CMakeLists.txt +0 -297
  78. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/LICENSE +0 -29
  79. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/MANIFEST.in +0 -6
  80. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/README.rst +0 -180
  81. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Doxyfile +0 -23
  82. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Makefile +0 -192
  83. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/_static/theme_overrides.css +0 -11
  84. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/chrono.rst +0 -81
  85. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/custom.rst +0 -93
  86. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/eigen.rst +0 -310
  87. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/functional.rst +0 -109
  88. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/index.rst +0 -43
  89. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/overview.rst +0 -171
  90. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/stl.rst +0 -251
  91. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/strings.rst +0 -305
  92. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/classes.rst +0 -1297
  93. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/embedding.rst +0 -262
  94. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/exceptions.rst +0 -396
  95. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/functions.rst +0 -568
  96. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/misc.rst +0 -337
  97. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/index.rst +0 -13
  98. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/numpy.rst +0 -463
  99. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/object.rst +0 -286
  100. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/utilities.rst +0 -155
  101. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/smart_ptrs.rst +0 -174
  102. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/basics.rst +0 -308
  103. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.py +0 -91
  104. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.rst +0 -95
  105. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/changelog.rst +0 -2050
  106. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/classes.rst +0 -542
  107. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/cmake/index.rst +0 -8
  108. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/compiling.rst +0 -648
  109. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/conf.py +0 -381
  110. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/faq.rst +0 -343
  111. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/index.rst +0 -48
  112. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/installing.rst +0 -105
  113. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/limitations.rst +0 -72
  114. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11-logo.png +0 -0
  115. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.png +0 -0
  116. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.svg +0 -427
  117. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.png +0 -0
  118. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.svg +0 -427
  119. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/reference.rst +0 -130
  120. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/release.rst +0 -96
  121. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/requirements.txt +0 -8
  122. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/upgrade.rst +0 -548
  123. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/attr.h +0 -605
  124. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/buffer_info.h +0 -144
  125. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/cast.h +0 -1432
  126. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/chrono.h +0 -213
  127. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/common.h +0 -2
  128. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/complex.h +0 -65
  129. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/class.h +0 -709
  130. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/common.h +0 -1021
  131. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/descr.h +0 -104
  132. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/init.h +0 -346
  133. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/internals.h +0 -467
  134. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/type_caster_base.h +0 -978
  135. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/typeid.h +0 -55
  136. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eigen.h +0 -606
  137. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/embed.h +0 -284
  138. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eval.h +0 -163
  139. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/functional.h +0 -121
  140. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/gil.h +0 -193
  141. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/iostream.h +0 -275
  142. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/numpy.h +0 -1741
  143. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/operators.h +0 -163
  144. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/options.h +0 -65
  145. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pybind11.h +0 -2497
  146. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pytypes.h +0 -1879
  147. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl/filesystem.h +0 -103
  148. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl.h +0 -375
  149. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl_bind.h +0 -747
  150. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/noxfile.py +0 -88
  151. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__init__.py +0 -11
  152. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__main__.py +0 -52
  153. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.py +0 -12
  154. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.pyi +0 -6
  155. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/commands.py +0 -21
  156. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/py.typed +0 -0
  157. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.py +0 -482
  158. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.pyi +0 -63
  159. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pyproject.toml +0 -41
  160. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.cfg +0 -56
  161. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.py +0 -155
  162. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/CMakeLists.txt +0 -503
  163. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/conftest.py +0 -208
  164. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/constructor_stats.h +0 -275
  165. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/cross_module_gil_utils.cpp +0 -73
  166. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/env.py +0 -33
  167. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/pytest.ini +0 -0
  168. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/test_files.py +0 -279
  169. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/pytest.ini +0 -0
  170. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/test_setuphelper.py +0 -143
  171. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/local_bindings.h +0 -85
  172. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/object.h +0 -179
  173. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_cross_module_tests.cpp +0 -151
  174. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.cpp +0 -91
  175. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.h +0 -85
  176. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pytest.ini +0 -19
  177. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/requirements.txt +0 -12
  178. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.cpp +0 -26
  179. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.py +0 -25
  180. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.cpp +0 -216
  181. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.py +0 -163
  182. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.cpp +0 -286
  183. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.py +0 -536
  184. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.cpp +0 -107
  185. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.py +0 -248
  186. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.cpp +0 -227
  187. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.py +0 -202
  188. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.cpp +0 -84
  189. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.py +0 -210
  190. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.cpp +0 -550
  191. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.py +0 -473
  192. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/CMakeLists.txt +0 -84
  193. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/embed.cpp +0 -21
  194. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +0 -28
  195. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +0 -39
  196. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +0 -46
  197. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/main.cpp +0 -6
  198. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +0 -41
  199. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +0 -35
  200. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +0 -41
  201. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/test.py +0 -10
  202. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.cpp +0 -165
  203. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.py +0 -53
  204. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.cpp +0 -238
  205. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.py +0 -126
  206. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.cpp +0 -141
  207. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.py +0 -117
  208. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.cpp +0 -41
  209. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.py +0 -50
  210. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.cpp +0 -69
  211. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.py +0 -42
  212. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.cpp +0 -348
  213. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.py +0 -771
  214. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/CMakeLists.txt +0 -47
  215. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/catch.cpp +0 -22
  216. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/external_module.cpp +0 -23
  217. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.cpp +0 -326
  218. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.py +0 -15
  219. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.cpp +0 -148
  220. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.py +0 -272
  221. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.cpp +0 -119
  222. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.py +0 -51
  223. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval_call.py +0 -5
  224. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.cpp +0 -285
  225. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.h +0 -12
  226. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.py +0 -265
  227. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.cpp +0 -397
  228. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.py +0 -520
  229. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.cpp +0 -49
  230. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.py +0 -94
  231. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.cpp +0 -125
  232. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.py +0 -331
  233. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.cpp +0 -153
  234. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.py +0 -284
  235. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.cpp +0 -107
  236. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.py +0 -257
  237. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.cpp +0 -412
  238. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.py +0 -517
  239. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.cpp +0 -102
  240. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.py +0 -92
  241. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.cpp +0 -233
  242. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.py +0 -360
  243. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.cpp +0 -472
  244. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.py +0 -593
  245. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.cpp +0 -524
  246. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.py +0 -441
  247. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.cpp +0 -103
  248. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.py +0 -267
  249. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.cpp +0 -73
  250. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.py +0 -59
  251. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.cpp +0 -235
  252. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.py +0 -146
  253. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.cpp +0 -189
  254. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.py +0 -82
  255. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.cpp +0 -560
  256. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.py +0 -651
  257. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.cpp +0 -500
  258. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.py +0 -253
  259. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.cpp +0 -452
  260. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.py +0 -318
  261. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.cpp +0 -342
  262. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.py +0 -291
  263. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.cpp +0 -131
  264. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.py +0 -318
  265. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.cpp +0 -144
  266. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.py +0 -29
  267. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.cpp +0 -66
  268. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.py +0 -44
  269. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.cpp +0 -22
  270. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.py +0 -9
  271. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.cpp +0 -510
  272. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.py +0 -408
  273. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-numpy-scipy.supp +0 -140
  274. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-python.supp +0 -117
  275. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindCatch.cmake +0 -70
  276. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindEigen3.cmake +0 -86
  277. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindPythonLibsNew.cmake +0 -257
  278. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/check-style.sh +0 -44
  279. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/cmake_uninstall.cmake.in +0 -23
  280. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/libsize.py +0 -39
  281. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/make_changelog.py +0 -64
  282. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Common.cmake +0 -402
  283. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Config.cmake.in +0 -233
  284. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11NewTools.cmake +0 -276
  285. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Tools.cmake +0 -214
  286. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pyproject.toml +0 -3
  287. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_global.py.in +0 -65
  288. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_main.py.in +0 -41
  289. xcoll/scattering_routines/geant4/collimasim/pyproject.toml +0 -8
  290. xcoll/scattering_routines/geant4/collimasim/setup.py +0 -144
  291. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.cpp +0 -403
  292. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.hh +0 -100
  293. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.cpp +0 -763
  294. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.hh +0 -118
  295. xcoll/scattering_routines/geant4/collimasim/src/collimasim/__init__.py +0 -8
  296. xcoll/scattering_routines/geant4/collimasim/src/collimasim/bindings.cpp +0 -63
  297. xcoll/scattering_routines/geant4/collimasim/src/collimasim/pyCollimatorPass.py +0 -142
  298. xcoll/scattering_routines/geant4/collimasim/src/collimasim/xtrack_collimator.py +0 -556
  299. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/PKG-INFO +0 -6
  300. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/SOURCES.txt +0 -24
  301. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/dependency_links.txt +0 -1
  302. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/not-zip-safe +0 -1
  303. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/top_level.txt +0 -1
  304. xcoll/scattering_routines/geant4/collimasim/tests/README.md +0 -25
  305. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_forions.dat +0 -25
  306. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_new_example.dat +0 -18
  307. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_old_example.dat +0 -68
  308. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_testing.dat +0 -15
  309. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_yaml_example.yaml +0 -110
  310. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps.dat +0 -7
  311. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps_pyat_test.dat +0 -3
  312. xcoll/scattering_routines/geant4/collimasim/tests/resources/collonly_twiss_file_example.tfs +0 -54
  313. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings.gmad +0 -3
  314. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_black_absorber.gmad +0 -3
  315. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_ions.gmad +0 -5
  316. xcoll/scattering_routines/geant4/collimasim/tests/resources/twiss_file_testing.tfs +0 -51
  317. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat.py +0 -65
  318. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_passmethod.py +0 -59
  319. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_tracking.py +0 -102
  320. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack.py +0 -75
  321. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_angle.py +0 -74
  322. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_colldb_load.py +0 -84
  323. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction.py +0 -159
  324. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction_ion.py +0 -99
  325. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_ions.py +0 -78
  326. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_lost_energy.py +0 -88
  327. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tilt.py +0 -80
  328. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking.py +0 -97
  329. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking_ions.py +0 -96
  330. xcoll-0.5.12.dist-info/RECORD +0 -415
  331. {xcoll-0.5.12.dist-info → xcoll-0.6.0.dist-info}/LICENSE +0 -0
  332. {xcoll-0.5.12.dist-info → xcoll-0.6.0.dist-info}/NOTICE +0 -0
  333. {xcoll-0.5.12.dist-info → xcoll-0.6.0.dist-info}/WHEEL +0 -0
@@ -1,548 +0,0 @@
1
- Upgrade guide
2
- #############
3
-
4
- This is a companion guide to the :doc:`changelog`. While the changelog briefly
5
- lists all of the new features, improvements and bug fixes, this upgrade guide
6
- focuses only the subset which directly impacts your experience when upgrading
7
- to a new version. But it goes into more detail. This includes things like
8
- deprecated APIs and their replacements, build system changes, general code
9
- modernization and other useful information.
10
-
11
- .. _upgrade-guide-2.9:
12
-
13
- v2.9
14
- ====
15
-
16
- * Any usage of the recently added ``py::make_simple_namespace`` should be
17
- converted to using ``py::module_::import("types").attr("SimpleNamespace")``
18
- instead.
19
-
20
-
21
- .. _upgrade-guide-2.7:
22
-
23
- v2.7
24
- ====
25
-
26
- *Before* v2.7, ``py::str`` can hold ``PyUnicodeObject`` or ``PyBytesObject``,
27
- and ``py::isinstance<str>()`` is ``true`` for both ``py::str`` and
28
- ``py::bytes``. Starting with v2.7, ``py::str`` exclusively holds
29
- ``PyUnicodeObject`` (`#2409 <https://github.com/pybind/pybind11/pull/2409>`_),
30
- and ``py::isinstance<str>()`` is ``true`` only for ``py::str``. To help in
31
- the transition of user code, the ``PYBIND11_STR_LEGACY_PERMISSIVE`` macro
32
- is provided as an escape hatch to go back to the legacy behavior. This macro
33
- will be removed in future releases. Two types of required fixes are expected
34
- to be common:
35
-
36
- * Accidental use of ``py::str`` instead of ``py::bytes``, masked by the legacy
37
- behavior. These are probably very easy to fix, by changing from
38
- ``py::str`` to ``py::bytes``.
39
-
40
- * Reliance on py::isinstance<str>(obj) being ``true`` for
41
- ``py::bytes``. This is likely to be easy to fix in most cases by adding
42
- ``|| py::isinstance<bytes>(obj)``, but a fix may be more involved, e.g. if
43
- ``py::isinstance<T>`` appears in a template. Such situations will require
44
- careful review and custom fixes.
45
-
46
-
47
- .. _upgrade-guide-2.6:
48
-
49
- v2.6
50
- ====
51
-
52
- Usage of the ``PYBIND11_OVERLOAD*`` macros and ``get_overload`` function should
53
- be replaced by ``PYBIND11_OVERRIDE*`` and ``get_override``. In the future, the
54
- old macros may be deprecated and removed.
55
-
56
- ``py::module`` has been renamed ``py::module_``, but a backward compatible
57
- typedef has been included. This change was to avoid a language change in C++20
58
- that requires unqualified ``module`` not be placed at the start of a logical
59
- line. Qualified usage is unaffected and the typedef will remain unless the
60
- C++ language rules change again.
61
-
62
- The public constructors of ``py::module_`` have been deprecated. Use
63
- ``PYBIND11_MODULE`` or ``module_::create_extension_module`` instead.
64
-
65
- An error is now thrown when ``__init__`` is forgotten on subclasses. This was
66
- incorrect before, but was not checked. Add a call to ``__init__`` if it is
67
- missing.
68
-
69
- A ``py::type_error`` is now thrown when casting to a subclass (like
70
- ``py::bytes`` from ``py::object``) if the conversion is not valid. Make a valid
71
- conversion instead.
72
-
73
- The undocumented ``h.get_type()`` method has been deprecated and replaced by
74
- ``py::type::of(h)``.
75
-
76
- Enums now have a ``__str__`` method pre-defined; if you want to override it,
77
- the simplest fix is to add the new ``py::prepend()`` tag when defining
78
- ``"__str__"``.
79
-
80
- If ``__eq__`` defined but not ``__hash__``, ``__hash__`` is now set to
81
- ``None``, as in normal CPython. You should add ``__hash__`` if you intended the
82
- class to be hashable, possibly using the new ``py::hash`` shortcut.
83
-
84
- The constructors for ``py::array`` now always take signed integers for size,
85
- for consistency. This may lead to compiler warnings on some systems. Cast to
86
- ``py::ssize_t`` instead of ``std::size_t``.
87
-
88
- The ``tools/clang`` submodule and ``tools/mkdoc.py`` have been moved to a
89
- standalone package, `pybind11-mkdoc`_. If you were using those tools, please
90
- use them via a pip install from the new location.
91
-
92
- The ``pybind11`` package on PyPI no longer fills the wheel "headers" slot - if
93
- you were using the headers from this slot, they are available by requesting the
94
- ``global`` extra, that is, ``pip install "pybind11[global]"``. (Most users will
95
- be unaffected, as the ``pybind11/include`` location is reported by ``python -m
96
- pybind11 --includes`` and ``pybind11.get_include()`` is still correct and has
97
- not changed since 2.5).
98
-
99
- .. _pybind11-mkdoc: https://github.com/pybind/pybind11-mkdoc
100
-
101
- CMake support:
102
- --------------
103
-
104
- The minimum required version of CMake is now 3.4. Several details of the CMake
105
- support have been deprecated; warnings will be shown if you need to change
106
- something. The changes are:
107
-
108
- * ``PYBIND11_CPP_STANDARD=<platform-flag>`` is deprecated, please use
109
- ``CMAKE_CXX_STANDARD=<number>`` instead, or any other valid CMake CXX or CUDA
110
- standard selection method, like ``target_compile_features``.
111
-
112
- * If you do not request a standard, pybind11 targets will compile with the
113
- compiler default, but not less than C++11, instead of forcing C++14 always.
114
- If you depend on the old behavior, please use ``set(CMAKE_CXX_STANDARD 14 CACHE STRING "")``
115
- instead.
116
-
117
- * Direct ``pybind11::module`` usage should always be accompanied by at least
118
- ``set(CMAKE_CXX_VISIBILITY_PRESET hidden)`` or similar - it used to try to
119
- manually force this compiler flag (but not correctly on all compilers or with
120
- CUDA).
121
-
122
- * ``pybind11_add_module``'s ``SYSTEM`` argument is deprecated and does nothing;
123
- linking now behaves like other imported libraries consistently in both
124
- config and submodule mode, and behaves like a ``SYSTEM`` library by
125
- default.
126
-
127
- * If ``PYTHON_EXECUTABLE`` is not set, virtual environments (``venv``,
128
- ``virtualenv``, and ``conda``) are prioritized over the standard search
129
- (similar to the new FindPython mode).
130
-
131
- In addition, the following changes may be of interest:
132
-
133
- * ``CMAKE_INTERPROCEDURAL_OPTIMIZATION`` will be respected by
134
- ``pybind11_add_module`` if set instead of linking to ``pybind11::lto`` or
135
- ``pybind11::thin_lto``.
136
-
137
- * Using ``find_package(Python COMPONENTS Interpreter Development)`` before
138
- pybind11 will cause pybind11 to use the new Python mechanisms instead of its
139
- own custom search, based on a patched version of classic ``FindPythonInterp``
140
- / ``FindPythonLibs``. In the future, this may become the default. A recent
141
- (3.15+ or 3.18.2+) version of CMake is recommended.
142
-
143
-
144
-
145
- v2.5
146
- ====
147
-
148
- The Python package now includes the headers as data in the package itself, as
149
- well as in the "headers" wheel slot. ``pybind11 --includes`` and
150
- ``pybind11.get_include()`` report the new location, which is always correct
151
- regardless of how pybind11 was installed, making the old ``user=`` argument
152
- meaningless. If you are not using the function to get the location already, you
153
- are encouraged to switch to the package location.
154
-
155
-
156
- v2.2
157
- ====
158
-
159
- Deprecation of the ``PYBIND11_PLUGIN`` macro
160
- --------------------------------------------
161
-
162
- ``PYBIND11_MODULE`` is now the preferred way to create module entry points.
163
- The old macro emits a compile-time deprecation warning.
164
-
165
- .. code-block:: cpp
166
-
167
- // old
168
- PYBIND11_PLUGIN(example) {
169
- py::module m("example", "documentation string");
170
-
171
- m.def("add", [](int a, int b) { return a + b; });
172
-
173
- return m.ptr();
174
- }
175
-
176
- // new
177
- PYBIND11_MODULE(example, m) {
178
- m.doc() = "documentation string"; // optional
179
-
180
- m.def("add", [](int a, int b) { return a + b; });
181
- }
182
-
183
-
184
- New API for defining custom constructors and pickling functions
185
- ---------------------------------------------------------------
186
-
187
- The old placement-new custom constructors have been deprecated. The new approach
188
- uses ``py::init()`` and factory functions to greatly improve type safety.
189
-
190
- Placement-new can be called accidentally with an incompatible type (without any
191
- compiler errors or warnings), or it can initialize the same object multiple times
192
- if not careful with the Python-side ``__init__`` calls. The new-style custom
193
- constructors prevent such mistakes. See :ref:`custom_constructors` for details.
194
-
195
- .. code-block:: cpp
196
-
197
- // old -- deprecated (runtime warning shown only in debug mode)
198
- py::class<Foo>(m, "Foo")
199
- .def("__init__", [](Foo &self, ...) {
200
- new (&self) Foo(...); // uses placement-new
201
- });
202
-
203
- // new
204
- py::class<Foo>(m, "Foo")
205
- .def(py::init([](...) { // Note: no `self` argument
206
- return new Foo(...); // return by raw pointer
207
- // or: return std::make_unique<Foo>(...); // return by holder
208
- // or: return Foo(...); // return by value (move constructor)
209
- }));
210
-
211
- Mirroring the custom constructor changes, ``py::pickle()`` is now the preferred
212
- way to get and set object state. See :ref:`pickling` for details.
213
-
214
- .. code-block:: cpp
215
-
216
- // old -- deprecated (runtime warning shown only in debug mode)
217
- py::class<Foo>(m, "Foo")
218
- ...
219
- .def("__getstate__", [](const Foo &self) {
220
- return py::make_tuple(self.value1(), self.value2(), ...);
221
- })
222
- .def("__setstate__", [](Foo &self, py::tuple t) {
223
- new (&self) Foo(t[0].cast<std::string>(), ...);
224
- });
225
-
226
- // new
227
- py::class<Foo>(m, "Foo")
228
- ...
229
- .def(py::pickle(
230
- [](const Foo &self) { // __getstate__
231
- return py::make_tuple(self.value1(), self.value2(), ...); // unchanged
232
- },
233
- [](py::tuple t) { // __setstate__, note: no `self` argument
234
- return new Foo(t[0].cast<std::string>(), ...);
235
- // or: return std::make_unique<Foo>(...); // return by holder
236
- // or: return Foo(...); // return by value (move constructor)
237
- }
238
- ));
239
-
240
- For both the constructors and pickling, warnings are shown at module
241
- initialization time (on import, not when the functions are called).
242
- They're only visible when compiled in debug mode. Sample warning:
243
-
244
- .. code-block:: none
245
-
246
- pybind11-bound class 'mymodule.Foo' is using an old-style placement-new '__init__'
247
- which has been deprecated. See the upgrade guide in pybind11's docs.
248
-
249
-
250
- Stricter enforcement of hidden symbol visibility for pybind11 modules
251
- ---------------------------------------------------------------------
252
-
253
- pybind11 now tries to actively enforce hidden symbol visibility for modules.
254
- If you're using either one of pybind11's :doc:`CMake or Python build systems
255
- <compiling>` (the two example repositories) and you haven't been exporting any
256
- symbols, there's nothing to be concerned about. All the changes have been done
257
- transparently in the background. If you were building manually or relied on
258
- specific default visibility, read on.
259
-
260
- Setting default symbol visibility to *hidden* has always been recommended for
261
- pybind11 (see :ref:`faq:symhidden`). On Linux and macOS, hidden symbol
262
- visibility (in conjunction with the ``strip`` utility) yields much smaller
263
- module binaries. `CPython's extension docs`_ also recommend hiding symbols
264
- by default, with the goal of avoiding symbol name clashes between modules.
265
- Starting with v2.2, pybind11 enforces this more strictly: (1) by declaring
266
- all symbols inside the ``pybind11`` namespace as hidden and (2) by including
267
- the ``-fvisibility=hidden`` flag on Linux and macOS (only for extension
268
- modules, not for embedding the interpreter).
269
-
270
- .. _CPython's extension docs: https://docs.python.org/3/extending/extending.html#providing-a-c-api-for-an-extension-module
271
-
272
- The namespace-scope hidden visibility is done automatically in pybind11's
273
- headers and it's generally transparent to users. It ensures that:
274
-
275
- * Modules compiled with different pybind11 versions don't clash with each other.
276
-
277
- * Some new features, like ``py::module_local`` bindings, can work as intended.
278
-
279
- The ``-fvisibility=hidden`` flag applies the same visibility to user bindings
280
- outside of the ``pybind11`` namespace. It's now set automatic by pybind11's
281
- CMake and Python build systems, but this needs to be done manually by users
282
- of other build systems. Adding this flag:
283
-
284
- * Minimizes the chances of symbol conflicts between modules. E.g. if two
285
- unrelated modules were statically linked to different (ABI-incompatible)
286
- versions of the same third-party library, a symbol clash would be likely
287
- (and would end with unpredictable results).
288
-
289
- * Produces smaller binaries on Linux and macOS, as pointed out previously.
290
-
291
- Within pybind11's CMake build system, ``pybind11_add_module`` has always been
292
- setting the ``-fvisibility=hidden`` flag in release mode. From now on, it's
293
- being applied unconditionally, even in debug mode and it can no longer be opted
294
- out of with the ``NO_EXTRAS`` option. The ``pybind11::module`` target now also
295
- adds this flag to its interface. The ``pybind11::embed`` target is unchanged.
296
-
297
- The most significant change here is for the ``pybind11::module`` target. If you
298
- were previously relying on default visibility, i.e. if your Python module was
299
- doubling as a shared library with dependents, you'll need to either export
300
- symbols manually (recommended for cross-platform libraries) or factor out the
301
- shared library (and have the Python module link to it like the other
302
- dependents). As a temporary workaround, you can also restore default visibility
303
- using the CMake code below, but this is not recommended in the long run:
304
-
305
- .. code-block:: cmake
306
-
307
- target_link_libraries(mymodule PRIVATE pybind11::module)
308
-
309
- add_library(restore_default_visibility INTERFACE)
310
- target_compile_options(restore_default_visibility INTERFACE -fvisibility=default)
311
- target_link_libraries(mymodule PRIVATE restore_default_visibility)
312
-
313
-
314
- Local STL container bindings
315
- ----------------------------
316
-
317
- Previous pybind11 versions could only bind types globally -- all pybind11
318
- modules, even unrelated ones, would have access to the same exported types.
319
- However, this would also result in a conflict if two modules exported the
320
- same C++ type, which is especially problematic for very common types, e.g.
321
- ``std::vector<int>``. :ref:`module_local` were added to resolve this (see
322
- that section for a complete usage guide).
323
-
324
- ``py::class_`` still defaults to global bindings (because these types are
325
- usually unique across modules), however in order to avoid clashes of opaque
326
- types, ``py::bind_vector`` and ``py::bind_map`` will now bind STL containers
327
- as ``py::module_local`` if their elements are: builtins (``int``, ``float``,
328
- etc.), not bound using ``py::class_``, or bound as ``py::module_local``. For
329
- example, this change allows multiple modules to bind ``std::vector<int>``
330
- without causing conflicts. See :ref:`stl_bind` for more details.
331
-
332
- When upgrading to this version, if you have multiple modules which depend on
333
- a single global binding of an STL container, note that all modules can still
334
- accept foreign ``py::module_local`` types in the direction of Python-to-C++.
335
- The locality only affects the C++-to-Python direction. If this is needed in
336
- multiple modules, you'll need to either:
337
-
338
- * Add a copy of the same STL binding to all of the modules which need it.
339
-
340
- * Restore the global status of that single binding by marking it
341
- ``py::module_local(false)``.
342
-
343
- The latter is an easy workaround, but in the long run it would be best to
344
- localize all common type bindings in order to avoid conflicts with
345
- third-party modules.
346
-
347
-
348
- Negative strides for Python buffer objects and numpy arrays
349
- -----------------------------------------------------------
350
-
351
- Support for negative strides required changing the integer type from unsigned
352
- to signed in the interfaces of ``py::buffer_info`` and ``py::array``. If you
353
- have compiler warnings enabled, you may notice some new conversion warnings
354
- after upgrading. These can be resolved using ``static_cast``.
355
-
356
-
357
- Deprecation of some ``py::object`` APIs
358
- ---------------------------------------
359
-
360
- To compare ``py::object`` instances by pointer, you should now use
361
- ``obj1.is(obj2)`` which is equivalent to ``obj1 is obj2`` in Python.
362
- Previously, pybind11 used ``operator==`` for this (``obj1 == obj2``), but
363
- that could be confusing and is now deprecated (so that it can eventually
364
- be replaced with proper rich object comparison in a future release).
365
-
366
- For classes which inherit from ``py::object``, ``borrowed`` and ``stolen``
367
- were previously available as protected constructor tags. Now the types
368
- should be used directly instead: ``borrowed_t{}`` and ``stolen_t{}``
369
- (`#771 <https://github.com/pybind/pybind11/pull/771>`_).
370
-
371
-
372
- Stricter compile-time error checking
373
- ------------------------------------
374
-
375
- Some error checks have been moved from run time to compile time. Notably,
376
- automatic conversion of ``std::shared_ptr<T>`` is not possible when ``T`` is
377
- not directly registered with ``py::class_<T>`` (e.g. ``std::shared_ptr<int>``
378
- or ``std::shared_ptr<std::vector<T>>`` are not automatically convertible).
379
- Attempting to bind a function with such arguments now results in a compile-time
380
- error instead of waiting to fail at run time.
381
-
382
- ``py::init<...>()`` constructor definitions are also stricter and now prevent
383
- bindings which could cause unexpected behavior:
384
-
385
- .. code-block:: cpp
386
-
387
- struct Example {
388
- Example(int &);
389
- };
390
-
391
- py::class_<Example>(m, "Example")
392
- .def(py::init<int &>()); // OK, exact match
393
- // .def(py::init<int>()); // compile-time error, mismatch
394
-
395
- A non-``const`` lvalue reference is not allowed to bind to an rvalue. However,
396
- note that a constructor taking ``const T &`` can still be registered using
397
- ``py::init<T>()`` because a ``const`` lvalue reference can bind to an rvalue.
398
-
399
- v2.1
400
- ====
401
-
402
- Minimum compiler versions are enforced at compile time
403
- ------------------------------------------------------
404
-
405
- The minimums also apply to v2.0 but the check is now explicit and a compile-time
406
- error is raised if the compiler does not meet the requirements:
407
-
408
- * GCC >= 4.8
409
- * clang >= 3.3 (appleclang >= 5.0)
410
- * MSVC >= 2015u3
411
- * Intel C++ >= 15.0
412
-
413
-
414
- The ``py::metaclass`` attribute is not required for static properties
415
- ---------------------------------------------------------------------
416
-
417
- Binding classes with static properties is now possible by default. The
418
- zero-parameter version of ``py::metaclass()`` is deprecated. However, a new
419
- one-parameter ``py::metaclass(python_type)`` version was added for rare
420
- cases when a custom metaclass is needed to override pybind11's default.
421
-
422
- .. code-block:: cpp
423
-
424
- // old -- emits a deprecation warning
425
- py::class_<Foo>(m, "Foo", py::metaclass())
426
- .def_property_readonly_static("foo", ...);
427
-
428
- // new -- static properties work without the attribute
429
- py::class_<Foo>(m, "Foo")
430
- .def_property_readonly_static("foo", ...);
431
-
432
- // new -- advanced feature, override pybind11's default metaclass
433
- py::class_<Bar>(m, "Bar", py::metaclass(custom_python_type))
434
- ...
435
-
436
-
437
- v2.0
438
- ====
439
-
440
- Breaking changes in ``py::class_``
441
- ----------------------------------
442
-
443
- These changes were necessary to make type definitions in pybind11
444
- future-proof, to support PyPy via its ``cpyext`` mechanism (`#527
445
- <https://github.com/pybind/pybind11/pull/527>`_), and to improve efficiency
446
- (`rev. 86d825 <https://github.com/pybind/pybind11/commit/86d825>`_).
447
-
448
- 1. Declarations of types that provide access via the buffer protocol must
449
- now include the ``py::buffer_protocol()`` annotation as an argument to
450
- the ``py::class_`` constructor.
451
-
452
- .. code-block:: cpp
453
-
454
- py::class_<Matrix>("Matrix", py::buffer_protocol())
455
- .def(py::init<...>())
456
- .def_buffer(...);
457
-
458
- 2. Classes which include static properties (e.g. ``def_readwrite_static()``)
459
- must now include the ``py::metaclass()`` attribute. Note: this requirement
460
- has since been removed in v2.1. If you're upgrading from 1.x, it's
461
- recommended to skip directly to v2.1 or newer.
462
-
463
- 3. This version of pybind11 uses a redesigned mechanism for instantiating
464
- trampoline classes that are used to override virtual methods from within
465
- Python. This led to the following user-visible syntax change:
466
-
467
- .. code-block:: cpp
468
-
469
- // old v1.x syntax
470
- py::class_<TrampolineClass>("MyClass")
471
- .alias<MyClass>()
472
- ...
473
-
474
- // new v2.x syntax
475
- py::class_<MyClass, TrampolineClass>("MyClass")
476
- ...
477
-
478
- Importantly, both the original and the trampoline class are now specified
479
- as arguments to the ``py::class_`` template, and the ``alias<..>()`` call
480
- is gone. The new scheme has zero overhead in cases when Python doesn't
481
- override any functions of the underlying C++ class.
482
- `rev. 86d825 <https://github.com/pybind/pybind11/commit/86d825>`_.
483
-
484
- The class type must be the first template argument given to ``py::class_``
485
- while the trampoline can be mixed in arbitrary order with other arguments
486
- (see the following section).
487
-
488
-
489
- Deprecation of the ``py::base<T>()`` attribute
490
- ----------------------------------------------
491
-
492
- ``py::base<T>()`` was deprecated in favor of specifying ``T`` as a template
493
- argument to ``py::class_``. This new syntax also supports multiple inheritance.
494
- Note that, while the type being exported must be the first argument in the
495
- ``py::class_<Class, ...>`` template, the order of the following types (bases,
496
- holder and/or trampoline) is not important.
497
-
498
- .. code-block:: cpp
499
-
500
- // old v1.x
501
- py::class_<Derived>("Derived", py::base<Base>());
502
-
503
- // new v2.x
504
- py::class_<Derived, Base>("Derived");
505
-
506
- // new -- multiple inheritance
507
- py::class_<Derived, Base1, Base2>("Derived");
508
-
509
- // new -- apart from `Derived` the argument order can be arbitrary
510
- py::class_<Derived, Base1, Holder, Base2, Trampoline>("Derived");
511
-
512
-
513
- Out-of-the-box support for ``std::shared_ptr``
514
- ----------------------------------------------
515
-
516
- The relevant type caster is now built in, so it's no longer necessary to
517
- include a declaration of the form:
518
-
519
- .. code-block:: cpp
520
-
521
- PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>)
522
-
523
- Continuing to do so won’t cause an error or even a deprecation warning,
524
- but it's completely redundant.
525
-
526
-
527
- Deprecation of a few ``py::object`` APIs
528
- ----------------------------------------
529
-
530
- All of the old-style calls emit deprecation warnings.
531
-
532
- +---------------------------------------+---------------------------------------------+
533
- | Old syntax | New syntax |
534
- +=======================================+=============================================+
535
- | ``obj.call(args...)`` | ``obj(args...)`` |
536
- +---------------------------------------+---------------------------------------------+
537
- | ``obj.str()`` | ``py::str(obj)`` |
538
- +---------------------------------------+---------------------------------------------+
539
- | ``auto l = py::list(obj); l.check()`` | ``py::isinstance<py::list>(obj)`` |
540
- +---------------------------------------+---------------------------------------------+
541
- | ``py::object(ptr, true)`` | ``py::reinterpret_borrow<py::object>(ptr)`` |
542
- +---------------------------------------+---------------------------------------------+
543
- | ``py::object(ptr, false)`` | ``py::reinterpret_steal<py::object>(ptr)`` |
544
- +---------------------------------------+---------------------------------------------+
545
- | ``if (obj.attr("foo"))`` | ``if (py::hasattr(obj, "foo"))`` |
546
- +---------------------------------------+---------------------------------------------+
547
- | ``if (obj["bar"])`` | ``if (obj.contains("bar"))`` |
548
- +---------------------------------------+---------------------------------------------+