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

namespace for released packages?

What is the python convention for namespaces of released packages? In
Java you'd write your domain name (if you have one) backwards, this:

uk.org.ohmslaw.myPackage

.... thus ensuring uniqueness. Is it the same for Python?

thanks
alex
Jul 18 '05 #1
15 1244
Alex Hunsley wrote:
What is the python convention for namespaces of released packages? In
Java you'd write your domain name (if you have one) backwards, this:

uk.org.ohmslaw.myPackage

... thus ensuring uniqueness. Is it the same for Python?

thanks
alex


I presume the lack of replies and what I've seen on code on the net
means that the modus operandi is to just have your python at the top
level, and not in a package that makes it unique... I find this quite
strange! Do problems not arise due to module name clashes?

alex
Jul 18 '05 #2

"Alex Hunsley" <la**@tardis.ed.ac.molar.uk> wrote in message
news:iU******************@fe1.news.blueyonder.co.u k...
Alex Hunsley wrote:
What is the python convention for namespaces of released packages? In
Java you'd write your domain name (if you have one) backwards, this:

uk.org.ohmslaw.myPackage

... thus ensuring uniqueness. Is it the same for Python?

I presume the lack of replies and what I've seen on code on the net
means that the modus operandi is to just have your python at the top
level, and not in a package that makes it unique... I find this quite
strange! Do problems not arise due to module name clashes?


Third party packages are generally put in the site-packages directory. So
far, there has not be much problem with name clashes.

tjr

Jul 18 '05 #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 18/07/2004, at 8:07 PM, Alex Hunsley wrote:
Alex Hunsley wrote:
What is the python convention for namespaces of released packages? In
Java you'd write your domain name (if you have one) backwards, this:
uk.org.ohmslaw.myPackage
... thus ensuring uniqueness. Is it the same for Python?
thanks
alex


I presume the lack of replies and what I've seen on code on the net
means that the modus operandi is to just have your python at the top
level, and not in a package that makes it unique... I find this quite
strange! Do problems not arise due to module name clashes?


It is pretty rare to get clashes - module authors are generally
nice enough to make sure nobody else is using their package name
before releasing things and generally package everything into
a single top-level module.

- --
Stuart Bishop <st****@stuartbishop.net>
http://www.stuartbishop.net/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)

iD8DBQFA+tXEAfqZj7rGN0oRAgSOAJ96UwUBXtJ8WMUd2hAUt+ jqX7l90QCePqKr
TQ6ISW/8pMvvHZoY2PH4nEo=
=Fo/D
-----END PGP SIGNATURE-----

Jul 18 '05 #4
Alex Hunsley wrote:
What is the python convention for namespaces of released packages? In
Java you'd write your domain name (if you have one) backwards, this:

uk.org.ohmslaw.myPackage

... thus ensuring uniqueness. Is it the same for Python?


No. If a Python library is released as a package, the author choses
a package name that is unlikely to collide. Typically, such a name
is readily available, as the project team developing the package has
found a "product name" already. That product name stays with the package
even if the affiliation of the authors changes.

I find the Java convention evil - it brings into source code affiliation
information which really doesn't belong there. Instead, package authors
should come up with names that uniquely identify their software in the
first place.

Regards,
Martin

Jul 18 '05 #5
Terry Reedy wrote:
Third party packages are generally put in the site-packages directory. So
far, there has not be much problem with name clashes.


I experienced only one problem so far:
you probably know Pyro (Python Remote Objects), which I wrote.
Much later there was somebody else who did some stuff with
Python and Robotics, and also called his project "pyro"...
http://pyro.sourceforge.net
http://pyrorobotics.org

Now, if you only use one or the other, you're safe, but
there was this person that needed to use *both* at the same
time. What would be the best solution in this case?

I was (and still am) not prepared to change my project's name
or package name because it has been around much longer and is by now
commonly recognised...
--Irmen de Jong.
Jul 18 '05 #6
Stuart Bishop wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 18/07/2004, at 8:07 PM, Alex Hunsley wrote:
Alex Hunsley wrote:
What is the python convention for namespaces of released packages? In
Java you'd write your domain name (if you have one) backwards, this:
uk.org.ohmslaw.myPackage
... thus ensuring uniqueness. Is it the same for Python?
thanks
alex

I presume the lack of replies and what I've seen on code on the net
means that the modus operandi is to just have your python at the top
level, and not in a package that makes it unique... I find this quite
strange! Do problems not arise due to module name clashes?

It is pretty rare to get clashes - module authors are generally
nice enough to make sure nobody else is using their package name
before releasing things and generally package everything into
a single top-level module.


Doesn't a single top level module translate into all the source being in
one file? (please correct if I'm wrong about this!)

alex

Jul 18 '05 #7
Martin v. Löwis wrote:
Alex Hunsley wrote:
What is the python convention for namespaces of released packages? In
Java you'd write your domain name (if you have one) backwards, this:

uk.org.ohmslaw.myPackage

... thus ensuring uniqueness. Is it the same for Python?

No. If a Python library is released as a package, the author choses
a package name that is unlikely to collide. Typically, such a name
is readily available, as the project team developing the package has
found a "product name" already. That product name stays with the package
even if the affiliation of the authors changes.


So in my case, it would be sufficient to place all my code in a package
named after the product? (in my case, 'Pypreweb', which hasn't been
taken, I've checked.)

I find the Java convention evil - it brings into source code affiliation
information which really doesn't belong there. Instead, package authors
should come up with names that uniquely identify their software in the
first place.

Regards,
Martin


I suppose the affiliation information could be a tripping point - e.g.
if someone else takes ownership of the product, the package name (if
derived from a doman name etc) would no longer be appropriate!

alex

Jul 18 '05 #8
Alex Hunsley wrote:
So in my case, it would be sufficient to place all my code in a package
named after the product? (in my case, 'Pypreweb', which hasn't been
taken, I've checked.)
Yes, although "preweb" might be a better alternative, given that it is
clear you are talking about Python.
I suppose the affiliation information could be a tripping point - e.g.
if someone else takes ownership of the product, the package name (if
derived from a doman name etc) would no longer be appropriate!


Indeed. Then, all applications using the package need to be changed.

Regards,
Martin

Jul 18 '05 #9
Martin v. Löwis wrote:
Alex Hunsley wrote:
So in my case, it would be sufficient to place all my code in a
package named after the product? (in my case, 'Pypreweb', which hasn't
been taken, I've checked.)

Yes, although "preweb" might be a better alternative, given that it is
clear you are talking about Python.


I quite like 'pypreweb', pronounced 'piper-web'. :) Sounds a bit more
interesting sounding than 'preweb' IMHO. The other idea was papyrus, which I
quite like (and is also not taken).

And it seems quite common to prepend py to the start of python projects.... not
unusual, anyway.
I suppose the affiliation information could be a tripping point - e.g.
if someone else takes ownership of the product, the package name (if
derived from a doman name etc) would no longer be appropriate!

Indeed. Then, all applications using the package need to be changed.

Regards,
Martin


I hadn't thought of it that way before, but it's a good point.

alex

Jul 18 '05 #10
Alex Hunsley wrote:
It is pretty rare to get clashes - module authors are generally
nice enough to make sure nobody else is using their package name
before releasing things and generally package everything into
a single top-level module.


Doesn't a single top level module translate into all the source being in
one file? (please correct if I'm wrong about this!)


Yes, but when the module grows you can transparently turn it into a package,
as package.py and package/__init__.py are freely interchangeable.

Peter

Jul 18 '05 #11
Peter Otten wrote:
Alex Hunsley wrote:

It is pretty rare to get clashes - module authors are generally
nice enough to make sure nobody else is using their package name
before releasing things and generally package everything into
a single top-level module.


Doesn't a single top level module translate into all the source being in
one file? (please correct if I'm wrong about this!)

Yes, but when the module grows you can transparently turn it into a package,
as package.py and package/__init__.py are freely interchangeable.

Peter


ah gotcha, I know what you mean...

alex

Jul 18 '05 #12
On Mon, 19 Jul 2004 11:28:50 +0100, Alex Hunsley
<la**@tardis.ed.ac.molar.uk> declaimed the following in
comp.lang.python:

And it seems quite common to prepend py to the start of python projects.... not
unusual, anyway.
Without making a detailed study, most of the packages with "py*"
names I've seen seem to be those that 1) are Python rewrites of stuff
from other languages, or 2) Python interface modules for use with some
other well-known application.
-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Jul 18 '05 #13
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 19/07/2004, at 1:17 AM, Alex Hunsley wrote:
It is pretty rare to get clashes - module authors are generally
nice enough to make sure nobody else is using their package name
before releasing things and generally package everything into
a single top-level module.


Doesn't a single top level module translate into all the source being
in one file? (please correct if I'm wrong about this!)


My bad - I should have said single top-level package (containing
as many modules and subpackages as you like).

- --
Stuart Bishop <st****@stuartbishop.net>
http://www.stuartbishop.net/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)

iD8DBQFA/Aq2AfqZj7rGN0oRAuhmAJ99d2uLrfyGwAxqB3wt7dlf6V9DPAC bBtJ+
r9Ya1WK7jDbSOoBjQjYui1s=
=LuRr
-----END PGP SIGNATURE-----

Jul 18 '05 #14
Dennis Lee Bieber wrote:
On Mon, 19 Jul 2004 11:28:50 +0100, Alex Hunsley
<la**@tardis.ed.ac.molar.uk> declaimed the following in
comp.lang.python:

And it seems quite common to prepend py to the start of python projects.... not
unusual, anyway.


Without making a detailed study, most of the packages with "py*"
names I've seen seem to be those that 1) are Python rewrites of stuff
from other languages, or 2) Python interface modules for use with some
other well-known application.
--


I think you're right on this one!
I'm going to go with the name papyrus.

alex
Jul 18 '05 #15
Irmen de Jong wrote:
Terry Reedy wrote:
Third party packages are generally put in the site-packages
directory. So
far, there has not be much problem with name clashes.

I experienced only one problem so far:
you probably know Pyro (Python Remote Objects), which I wrote.
Much later there was somebody else who did some stuff with
Python and Robotics, and also called his project "pyro"...
http://pyro.sourceforge.net
http://pyrorobotics.org

Now, if you only use one or the other, you're safe, but
there was this person that needed to use *both* at the same
time. What would be the best solution in this case?

I was (and still am) not prepared to change my project's name
or package name because it has been around much longer and is by now
commonly recognised...


Would one or the other of those two packages fail completely
if one simply changed the name of its main directory? Presumably
no one would have a serious complaint in such an application
with importing one or the other as "robopyro" or "remotepyro"
or some such, to avoid a conflict in the namespace of the
importing module...

-Peter
Jul 18 '05 #16

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

Similar topics

10
by: Thomas Heller | last post by:
**py2exe 0.5.0** (finally) released =================================== py2exe is a Python distutils extension which converts python scripts into executable windows programs, able to run without...
15
by: Anthony Baxter | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.3.4 (release candidate 1). ...
7
by: Kevin Newman | last post by:
I've been toying with a namespace manager, and wanted to get some input. So what do you think? if (typeof com == 'undefined') var com = {}; if (!com.unFocus) com.unFocus = {}; ...
0
by: Jimmy Retzlaff | last post by:
py2exe 0.6.3 released ===================== py2exe is a Python distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python...
9
by: Divick | last post by:
Hi all, does any one know what is the right way to forward declare classes within namespaces. Though I have been using the syntax as follows but it doesn't sound good to me. namespace...
22
by: Marc G. Fournier | last post by:
After almost 12 months of intense development, and testing, we are proud to announce the availability of PostgreSQL v7.4. An overview of the major changes in v7.4 include: IN/NOT IN subqueries...
1
by: Jimmy Retzlaff | last post by:
py2exe 0.6.8 released ===================== py2exe is a Python distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python...
0
by: Larry Bates | last post by:
Jimmy Retzlaff wrote: Everyone, Thanks for all your hard work on py2exe, it is greatly appreciated. -Larry Bates
0
by: Jimmy Retzlaff | last post by:
py2exe 0.6.9 released ===================== py2exe is a Python distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.