Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80743

Re: Python: package root, root-node, __init__.py in the package root

From dieter <dieter@handshake.de>
Subject Re: Python: package root, root-node, __init__.py in the package root
Date 2014-11-14 08:09 +0100
References <m41ok6$re3$1@dont-email.me>
Newsgroups comp.lang.python
Message-ID <mailman.15811.1415948988.18130.python-list@python.org> (permalink)

Show all headers | View raw


Veek M <vek.m1234@gmail.com> 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", ...).

Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Python: package root, root-node, __init__.py in the package root Veek M <vek.m1234@gmail.com> - 2014-11-13 13:33 +0630
  Re: Python: package root, root-node, __init__.py in the package root dieter <dieter@handshake.de> - 2014-11-14 08:09 +0100

csiph-web