473,434 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,434 software developers and data experts.

Managing large python/c++ project

Hi there,

I am currently involved in managing a large python/c++ project
(using swig to automagically wrap c++ code to python). So far my
current experience was that python was a second class citizen and
extremely little python code was written and everything seemed to
work.

Now this is the contrary, large portion of code are written python
with a few expection of c++ code for core algorithms. So as you might
have guess I am coming with a c++ background into the python world.

Let's consider the following layout for project 'A':

A/
moduleA.py
B/
moduleB.py
C/
moduleC.py
module1.cxx
module1.h
module1.i
A-binary-module-gcc43/
_module1.so
module1.py

I have the current questions (I guess it's all about convention):

Q1. How should I import module1 (a c++ module that is compiled/wrap
into python) ? Because I have multiple compilers, I have a binary
directory per compiler. My guess was that PYTHONPATH should contain
the toplevel project *source* directory and the toplevel project
*binary* directory.

Possible answers:
A1. 'import module1'...well in that case I should really make sure
that noone ever tries to create a directory names module1 in directory
A/ otherwise 'import module1' statement is changing meaning.

A2. 'import A-binary-module-gcc43.module1' ... well this is safer and
would avoid namespace collision but the python code becomes dependent
(implicitely) of a compiler.

A3. Leave the module1 where it belong : in A/B/C subdirectory ... in
this case I need to have a source directory per compiler, which means
I need either some subttle trick with symlinks (lndir) or be ready to
have out of sync projects.

Q2. How do I import moduleA & moduleB ? Those are a simple python
modules that are located in A/. Behavior should be symmetric.

A1.
'from A import moduleA'
'from A.B import moduleB'

A2.
'from A import moduleA'
'from B import moduleB'

A3.
'import moduleA'
'import moduleB'

Basically A1 to A3 are organized in complexity of PYTHONPATH. A1 is
great because importing a moduleD in the future will just works
(PYTHONPATH is unchanged). A2 & A3 make the layout of the project
impact on the PYTHONPATH.

Thanks
-Mathieu
Jun 27 '08 #1
0 1038

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Andrei D. | last post by:
Hello Python newsgroup, In the process of developing a big ssh wrapper for sending commands to multiple hosts over the last few months, I (almost accidentally, considering I'm really just an...
23
by: assaf__ | last post by:
Hello, I am beginning to work on a fairly large project and I'm considering to use python for most of the coding, but I need to make sure first that it is reliable enough. I need to make sure...
9
by: limor | last post by:
Hi, I am considering using Python in a new testing tool application we intend to build for out product. I must get references before starting develope in this language , since although lots of...
36
by: Andrea Griffini | last post by:
I did it. I proposed python as the main language for our next CAD/CAM software because I think that it has all the potential needed for it. I'm not sure yet if the decision will get through, but...
1
by: Edward Stevens | last post by:
The IDE Start Page in .Net 2003 contains a list of the projects you have recently worked on. Clicking on any of these opens that particular project. Fine. Unfortunately, one of my projects has...
21
by: dub | last post by:
Hello web folks... I've been desigining web pages for 13 years using my trusty text editor (UltraEdit) and in depth knowledge of HTML. I'm truly a text editor ninja at this point. I am frequently...
14
by: RL Stevenson | last post by:
What is a reasonable way to manage a complex form with 5 or so tabs with 100 or more controls bound to 5-10 tables in a database? Pasting all those controls, datasets, data adapters directly onto...
8
by: Braky Wacky | last post by:
Hello, I have an ASP.NET webpage that uses an instance of System.Web.UI.HtmlControls.HtmlInputFile for uploading files to our server. I came across the documentation at MSDN for upping the...
0
by: TrtnJohn | last post by:
I have a Windows Application that has been ported from VB6 to VB.NET using VS 2003. The code conversion was painful but almost complete. But, now I am having trouble because the original...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.