# Switch from Swig to Pybind11 imminent

**URL:** <https://www.rubin.community/t/switch-from-swig-to-pybind11-imminent/1688>\
**Category:** DM Notifications\
**Tags:** dm-dev\
**Created:** [March 3, 2017, 5:05pm UTC](https://www.rubin.community/t/switch-from-swig-to-pybind11-imminent/1688 "2017-03-03T17:05:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pschella](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/pschella/32/655_2.png) [@pschella](https://www.rubin.community/u/pschella)\
**Post date:** [March 3, 2017, 5:05pm UTC](https://www.rubin.community/t/switch-from-swig-to-pybind11-imminent/1688/1 "2017-03-03T17:05:47Z")

</div>

We plan to merge DM-8467 to master on Monday morning (after the latest weekly, `w_2017_10`, has been tagged). This is a comprehensive change affecting almost all packages in `lsst_distrib`.

From that point on, all C++ to Python wrappers will be generated with [Pybind11](https://github.com/pybind/pybind11) Instead of Swig.

At the same time a new [DM Pybind11 Style Guide](https://developer.lsst.io/v/DM-8577/coding/pybind11_style_guide.html) (DM-8577) and a new [step-by-step Pybind11 wrapping tutorial](https://developer.lsst.io/v/DM-9089/coding/python_wrappers_for_cpp_with_pybind11.html) (DM-9089) will be merged. Please see these ticket branches for documentation.

**How does this affect me?**

- If you are using, or developing against, a stable release you won’t be affected at all. The latest, `13.0`, release is still based on Swig.
- If you are developing against the latest weekly, consider sticking to `w_2017_10` for a while. Alternatively you can use the `13.0` release instead.
- If you are developing in Python against master you might see small API changes (that will be documented in the release notes on Monday), but in general should not notice a major difference. The current Pybind11 switch attempts to minimize API changes from Swig. But Pybind11 enables more Pythonic API’s for wrapped C++ classes, so you may get nicer interfaces over time.
- If you are developing in C++ and your code needs to be called from Python, you will have to add Pybind11 wrappers. See the aforementioned documentation.

**I’m about to merge some code, what should I do?**

Even if it is a pure Python package (which will probably just work). If it is part of `lsst_distrib`, please let us know before merging. You can reach us on Slack at `#dm-pybind11-porting`, or reply to this post. We are also happy to assist you at the JTM hack session to help you add Pybind11 wrappers.

**Can I try it already?**

Yes. Using [lsstsw](https://developer.lsst.io/build-ci/lsstsw.html) you can issue:

```
rebuild -r tickets/DM-8467 lsst_distrib

```

to build a Pybind11 stack. Note that there will be quite some churn the coming days due to cleanup, commit squashing, etc. But please feel free to try it out!
