473,394 Members | 2,090 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,394 software developers and data experts.

distutils question: different projects under same namespace

To avoid namespace confliction with other Python packages, I want all
my projects to be put into a specific namespace, e.g. 'hongqn' package,
so that I can use "from hongqn.proj1 import module1", "from
hongqn.proj2.subpack1 import module2", etc.

These projects are developed and maintained and distributed seperately,
so I should not make a whole 'hongqn' package with one setup.py. I
must write setup.py scripts for each project. I meet a problem here.

For instance, I am writing setup.py script for proj1. I use the
following parameters when calling distutils.core.setup:

setup(
...
package_dir = {'hongqn.proj1': 'proj1'},
packages = ['hongqn.proj1'],
...
)

"python setup.py install" will create /usr/lib/python2.3/hongqn/proj1
directory and copy proj1/*.py there. But this is UNUSABLE! There is
NO __init__.py file under /usr/lib/python2.3/hongqn/ so that import
hongqn.proj1 will fail!

I am considering manually create this __init__.py by hacking the
install_lib command. But before making my hands dirty, I want to know
if there is an "official" solution exists or others have already
success stories on this matter.

As a note, I wish the solution can handle setup.py bdist and
bdist_wininst well.

Jul 19 '05 #1
1 1452
Le 16 Apr 2005 01:20:34 -0700, Qiangning Hong a écrit :
To avoid namespace confliction with other Python packages, I want all
my projects to be put into a specific namespace, e.g. 'hongqn' package,
so that I can use "from hongqn.proj1 import module1", "from
hongqn.proj2.subpack1 import module2", etc. That makes sense
These projects are developed and maintained and distributed seperately,
so I should not make a whole 'hongqn' package with one setup.py. I
must write setup.py scripts for each project. I meet a problem here.

For instance, I am writing setup.py script for proj1. I use the
following parameters when calling distutils.core.setup:

setup(
...
package_dir = {'hongqn.proj1': 'proj1'},
packages = ['hongqn.proj1'],
...
)

"python setup.py install" will create /usr/lib/python2.3/hongqn/proj1
directory and copy proj1/*.py there. But this is UNUSABLE! There is
NO __init__.py file under /usr/lib/python2.3/hongqn/ so that import
hongqn.proj1 will fail! You can detect if there is __init__.py in the hongqn directory.
I am considering manually create this __init__.py by hacking the
install_lib command. But before making my hands dirty, I want to know
if there is an "official" solution exists or others have already
success stories on this matter. It seems that this problem is tackled in the logilab packages : for
example, you install first the logilab common libraries and then pylint.
So the problem is to define the dependencies of your projects and hence
the order of installation.
As a note, I wish the solution can handle setup.py bdist and
bdist_wininst well.

Jul 19 '05 #2

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

Similar topics

3
by: Isaac Jones | last post by:
Hello Python Community. I bring greetings from the Haskell community (http://www.haskell.org) ;) There has been a lot of discussion of late about creating a grand-unified build & distribution...
1
by: Sridhar R | last post by:
I learnt that distutils can be used to package python modules and packages. Fine it does that well. Suppose I am writing an python application (not package or module), and suppose that I am...
11
by: Random | last post by:
I'm confused about the proper use and usefulness of namespaces. I beleive I understand the purpose is so the developer can put classes within namespaces to essentially organize your code. And I...
6
by: Leon | last post by:
Is it a good idea to use visual studios .net code default solution and compile business object (business rules and logic) together? or is code behind sufficient enough? I know about modules, but I...
7
by: vedrandekovic | last post by:
Hello again, Is there any patch for python "distutils", for this ImportError: cannot import name log Regards, Vedran
4
by: =?Utf-8?B?SmFtZXMgUGFnZQ==?= | last post by:
Am i missing somthing simple? I can't access any of the profile names in my code behind i.e; textBox1.text = Profile.test = "some text" here's the web.config: <?xml version="1.0"?> ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
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...

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.