From 8d862b37b46c5ceaf7b5566913d2b41a323e2f13 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Sun, 6 Mar 2016 13:37:22 +0100 Subject: [PATCH] documentation updates (clarified cross-module dependencies, added contributors, improved CSS) --- README.md | 7 ++++--- docs/_static/theme_overrides.css | 4 ++-- docs/advanced.rst | 18 ++++++++++++++++-- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 6763c06fd..802d4ebfa 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Documentation Status](https://readthedocs.org/projects/pybind11/badge/?version=latest)](http://pybind11.readthedocs.org/en/latest/?badge=latest) [![Build Status](https://travis-ci.org/pybind/pybind11.svg?branch=master)](https://travis-ci.org/pybind/pybind11) -[![Build status](https://ci.appveyor.com/api/projects/status/riaj54pn4h08xy40?svg=true)](https://ci.appveyor.com/project/pybind/pybind11) +[![Build status](https://ci.appveyor.com/api/projects/status/riaj54pn4h08xy40?svg=true)](https://ci.appveyor.com/project/wjakob/pybind11) **pybind11** is a lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python bindings of existing C++ code. Its @@ -92,8 +92,9 @@ Significant features and/or improvements to the code were contributed by Jonas Adler, Sylvain Corlay, Axel Huebl, -Johan Mabille, and -Tomasz Miąsko. +Johan Mabille, +Tomasz Miąsko, and +Ben Pritchard. ### License diff --git a/docs/_static/theme_overrides.css b/docs/_static/theme_overrides.css index d74682961..f678ab548 100644 --- a/docs/_static/theme_overrides.css +++ b/docs/_static/theme_overrides.css @@ -1,7 +1,7 @@ .wy-table-responsive table td, .wy-table-responsive table th { - white-space: initial; + white-space: initial !important; } .rst-content table.docutils td { - vertical-align: top; + vertical-align: top !important; } diff --git a/docs/advanced.rst b/docs/advanced.rst index f23ac53fc..f24d3b506 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -1019,8 +1019,8 @@ like so: Partitioning code over multiple extension modules ================================================= -It's straightforward to split binding code over multiple extension modules and -reference types declared elsewhere. Everything "just" works without any special +It's straightforward to split binding code over multiple extension modules, while +referencing types that are declared elsewhere. Everything "just" works without any special precautions. One exception to this rule occurs when wanting to extend a type declared in another extension module. Recall the basic example from Section :ref:`inheritance`. @@ -1049,3 +1049,17 @@ However, it can be acquired as follows: .def(py::init()) .def("bark", &Dog::bark); +Alternatively, we can rely on the ``base`` tag, which performs an automated +lookup of the corresponding Python type. However, this also requires invoking +the ``import`` function once to ensure that the pybind11 binding code of the +module ``basic`` has been executed. + +Naturally, both methods will fail when there are cyclic dependencies. + +.. code-block:: cpp + + py::module::import("basic"); + + py::class_(m, "Dog", py::base()) + .def(py::init()) + .def("bark", &Dog::bark);