Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!newsreader4.netcologne.de!news.netcologne.de!bcyclone05.am1.xlned.com!bcyclone05.am1.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'package,': 0.03; 'root': 0.05; 'subject:Python': 0.06; 'dependency': 0.09; 'imported': 0.09; 'page)': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'setup.py': 0.09; 'skip:/ 10': 0.09; 'url:blog': 0.10; 'python': 0.11; 'stored': 0.12; 'itself.': 0.14; '"your': 0.16; '__init__.py': 0.16; 'bit.': 0.16; 'of)': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subfolder': 0.16; 'saying': 0.22; 'installation': 0.23; 'header:User-Agent:1': 0.23; 'simpler': 0.24; '(or': 0.24; 'header:X-Complaints-To:1': 0.27; 'installed': 0.27; 'directory,': 0.31; 'writes:': 0.31; 'file': 0.32; 'run': 0.32; '(e.g.': 0.33; '(most': 0.33; 'blog:': 0.33; 'sources': 0.33; 'subject:the': 0.34; 'charset:us-ascii': 0.36; 'should': 0.36; 'project': 0.37; 'to:addr:python-list': 0.38; 'skip:- 10': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'guy': 0.60; 'referred': 0.60; 'url:it': 0.60; 'here:': 0.62; 'received:217': 0.63; 'between': 0.67; 'confusing': 0.84; 'package?': 0.84; 'url:2013': 0.84; 'do:': 0.91; 'system:': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: dieter Subject: Re: Python: package root, root-node, __init__.py in the package root Date: Fri, 14 Nov 2014 08:09:36 +0100 References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gmane-NNTP-Posting-Host: pd9e0a649.dip0.t-ipconnect.de User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux) Cancel-Lock: sha1:npulr9Is6rvFMS5Bz6OdD17yuqU= X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1415948988 news.xs4all.nl 2853 [2001:888:2000:d::a6]:45158 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 4514 X-Received-Body-CRC: 2309929661 Xref: csiph.com comp.lang.python:80743 Veek M writes: > I have a package structured like so on the file system: > PKG LIBS are stored here: /usr/lib/python3.2/ > Pkg-name: foo-1.0.0 > > 1. What is the root directory, or root-node or 'root' of my package? My > understanding is that it's: /usr/lib/python3.2/foo-1.0.0/ on the file-system > and this is referred to the root of the pkg. > > 2. Can, foo-1.0.0 contain __init__.py or do i have to do: > foo-1.0.0/foo/__init__.py ? > > > Take a look at what this guy is saying on his blog: > http://blog.habnab.it/blog/2013/07/21/python-packages-and-you/ > > ------------------- > (bottom of the page) > "Your project root should contain a python package, not be a package itself. > If you do this, your setup.py will be very confusing (or not work at all) > and it will be very difficult to run your code." The blog author distinguishes between a project and a package and *recommends* that the package is in a subfolder of its project -- in order to get a simpler "setup.py". Let me clarify the terms "package" and "project" a bit. The "package" is what is used in a Python installation - what is imported into your application. In order to get the "package" installed, other resources are typically required (e.g. installation documentation, dependency specification, "setup.py", ...). The "project" contains the package sources and (most of) the required resources to get the package installed by standard means (e.g. "pip", "easy_install", ...).