Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Latest commit

 

History

History
83 lines (60 loc) · 2.27 KB

README.md

File metadata and controls

83 lines (60 loc) · 2.27 KB

python_example

An example project built with pybind11.

Installation

On Unix (Linux, OS X)

  • clone this repository
  • pip install ./python_example

On Windows (Requires Visual Studio 2015)

  • For Python 3.5:

    • clone this repository
    • pip install ./python_example
  • For earlier versions of Python, including Python 2.7:

    Pybind11 requires a C++11 compliant compiler (i.e. Visual Studio 2015 on Windows). Running a regular pip install command will detect the version of the compiler used to build Python and attempt to build the extension with it. We must force the use of Visual Studio 2015.

    • clone this repository
    • "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x64
    • set DISTUTILS_USE_SDK=1
    • set MSSdk=1
    • pip install ./python_example

    Note that this requires the user building python_example to have registry edition rights on the machine, to be able to run the vcvarsall.bat script.

Windows runtime requirements

On Windows, the Visual C++ 2015 redistributable packages are a runtime requirement for this project. It can be found here.

If you use the Anaconda python distribution, you may require the Visual Studio runtime as a platform-dependent runtime requirement for you package:

requirements:
  build:
    - python
    - setuptools
    - pybind11

  run:
   - python
   - vs2015_runtime  # [win]

Building the documentation

Documentation for the example project is generated using Sphinx. Sphinx has the ability to automatically inspect the signatures and documentation strings in the extension module to generate beautiful documentation in a variety formats. The following command generates HTML-based reference documentation; for other formats please refer to the Sphinx manual:

  • cd python_example/docs
  • make html

License

pybind11 is provided under a BSD-style license that can be found in the LICENSE file. By using, distributing, or contributing to this project, you agree to the terms and conditions of this license.

Test call

import python_example
python_example.add(1, 2)