[C++-sig] Re: Getting started with Boost.Python v2?

David Abrahams david.abrahams at rcn.com
Wed May 22 20:07:55 CEST 2002


----- Original Message -----
From: "Christian Hudon" <chrish at cynovad.com>

>
> we have a bunch of C++ code in-house that I'd like to be able to use
> from Python (for prototyping work, exploration, etc.). Since this will
> be for my personal use only (at least in the beginning), I thought I'd
> give Boost.Python v2 a try, to get all the benefits of the new-style
> classes (and generally so I don't have to port the thing from v1 to v2
> six months from now, if/when this get more widely used within the
> company).

Sounds like a good plan.

> Could you send me the instructions on getting started with
> Boost.Python v2?

Sure; but please in the future post questions to the C++-sig, where answers
will benefit everyone (and somebody else may answer them!)

1. Get the current boost CVS state from
http://sourceforge.net/cvs/?group_id=7586
2. Get the mpl-development branch of boost/mpl. From the boost root
directory:

    cvs update -d -rmpl-development boost/mpl

3. cd to the libs/python/test directory
4. bjam -sTOOLS=<my-toolset> test to build and run the tests

See documentation in libs/python/doc/v2/reference.html

To make your own Jamfile which builds an extension, use the following
template:

---
project-root ;

# bring in the rules for python
SEARCH on python.jam = $(BOOST_BUILD_PATH) ;
include python.jam ;

local PYTHON_PROPERTIES = $(BOOST_PYTHON_V2_PROPERTIES) ;

extension my_module : my_source1.cpp my_source2.cpp my_source3.cpp ...
                      <library-file>path/to/bpl.so
                    ;

# declare a test
boost-python-runtest my_test : my_test_driver.py <pyd>my_module
    : <library-path>path-to-boost_python <findlibs>boost_python
    ;

----

> I also saw your summaries for March, April, etc. Thanks for writing
> these! I'd have a quick question and maybe a suggestion. The question
> is, would you say that Boost.Python v2 as it stands now it about on par
> (feature-wise, excluding the documentation) with v1?

Getting close. By early next month we'll be there, and I'll retire v1.

> The suggestion is,
> it's be really helpful in seeing how v2 is shaping up if you could add a
>    Done keyword to the items in the "Development Goals" list on
> http://www.python.org/sigs/c++-sig/ and update that when you write a new
> monthly summary. That way it's be easier than reading all the montly
> summaries for newbies to Boost.Python (like me) to get an overview of
> where v2 currently is.

A nice idea, but I don't control that page. Ralf runs C++-sig, and can only
get the page updated indirectly by making a request, so I don't think we'll
change it frequently. However, when v2 is released it will be updated.

> PS On http://www.boost.org/libs/python/doc/index.html, there's a typo in
> one of the URLs: "Boost.Python is known to have been tested
> against <a href="http://www.python/org/2.2.1">Python 2.2.1</a> using
> the following compilers"         ^^^ This should probably be a period,
> unless Python gets its own TLD soon. :-)


Hmm, thanks. I probably won't fix it, since it isn't long for this world
;-)

-Dave







More information about the Cplusplus-sig mailing list