[C++-sig] Is there a good Python C/C++ IDE?
Hubert.Holin at meteo.fr
Fri Aug 12 15:00:37 CEST 2005
[Xposted and followups to pythonmac list which is perhaps more
Somewhere in the E.U., le 12/08/2005
On 12 août 2005, at 12:00, c++-sig-request at python.org wrote:
> Date: Thu, 11 Aug 2005 13:49:08 -0400
> From: Scott Kaplan <pythondeveloper at gmail.com>
> Subject: [C++-sig] Is there a good Python C/C++ IDE?
> To: Development of Python/C++ integration <c++-sig at python.org>
> Message-ID: <86afeadf05081110495776a14b at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
> Being new to Python, I was wondering if anyone knows of a good IDE
> that would let me develop Python and add extensions in C/C++, with the
> capability of debugging those extensions.
> This will be on a Mac.
> It looks like the standard download comes with PyObjC, however I want
> to extend Python to handle my C/C++ extensions not the other way
> around + I don't want to have to learn any ObjectiveC / ObjC syntax.
Well, if you do not want to create GUIs, but do want to use
one, it is possible to use XCode (2.1, though the last few previous
versions would presumably also work).
More precisely, you can launch the command-line Python from
within XCode with a chosen script as argument (and any other
arguments you may care about), and of course you can do the C++
programming within that environment. I have not actually tried to
have a custom Python extension used in such a setting, but it is in
my current work plan. You can even use the free (and excellent)
TextWrangler as the code editor (for C++ and Python). The debugging
of the extension can then be done using XCode's front-end to GDB. For
debugging of Python scripts proper, however, the (free) PythonIDE is
preferable, though (which leads to: development of scripts within
PythonIDE, extension coding and integration in XCode). You are, as
well, not restricted to using the Apple-supplied version of Python.
As an example, I installed Bob Ippolito's "Official
Unofficial" Python 2.4.1. I then created an XCode project (***empty
project***) "Python via XCode", added a target "Invoked Snake" (of
type aggregate), and to it added a custom executable "Python 2.4.1
(Official Unofficial)", setting its properties as "Executable path: /
Library/Frameworks/Python.framework/Versions/2.4/bin/python" and with
an argument ""/Users/hubertholin/Documents/Scratch/Python via Xcode/
test.py"" (adding quotes around path arguments is safer... note the
whitespaces). Clicking on the "Build and Go" icon then invoked python
with my test script as argument.
The creation of extensions should be straightforward from
the Boost.Python documentation (so far, I have only tried embedding,
not extension, which is on my to-do list). I am still trying to
refine the process to something I like, though.
As far as Objective-C and Objective-C++ are concerned, I
only see them as something of an inconvenience, much as in the same
way that Apple's system documentation had long been geared towards
Pascal rather than C. PyObjC goes a long way to ease our suffering,
though there are some rough spots still (and the Python Carbon
bindings need a full overhaul). It should be said that Interface
Builder is superb, though, and in the absence of a NIB to whatever-
portable-package Python will understand (like there appears to be for
PERL), if one wants GUIs, then building them in IB, using PyObjC as
the glue (using documentation written for ObjC) and extending with C+
+ is a possible road. At least that's the road I am taking, and if
anybody's interested I'll report back if it actually leads
somewhere :-) .
More information about the Cplusplus-sig