Re: [Distutils] problems bundling data with setuptools

2008-04-30 Thread Michael Hearne
Oh, ok.  So is there a way to include data (in a package or not) in my  
binary distribution?


--Mike
On Apr 30, 2008, at 9:27 AM, Phillip J. Eby wrote:


At 09:15 AM 4/30/2008 -0600, Michael Hearne wrote:
I'm having trouble bundling any kind of data (non-Python code) in  
my egg.


Here are the file contents of my source directory:
hello.py (cheesy script)
README.txt
MANIFEST.in (has one line, include *.txt)
setup.py, which looks like:

from setuptools import setup, find_packages

setup(
   name = HelloWorld,
   version = 0.1,
   scripts=['hello.py'],
   include_package_data = True
)

I'm creating the egg with python setup.py bdist_egg.

I would expect that README.txt should appear in the egg somewhere,  
but it doesn't.


What am I missing?


README.txt isn't in a package, so it's not package data.  And  
MANIFEST.in determines what goes in your *source* distribution, not  
your binary distribution.





--
Michael Hearne
[EMAIL PROTECTED]
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
--


___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] problems bundling data with setuptools

2008-04-30 Thread Phillip J. Eby

At 09:33 AM 4/30/2008 -0600, Michael Hearne wrote:
Oh, ok.  So is there a way to include data (in a package or not) in 
my binary distribution?


See the distutils docs on that.  There has been some discussion 
around creating a standard for including docs and other things in egg 
metadata, but no concrete proposals have emerged yet.


In the meantime, it's important to understand that eggs are to 
Python as jars are to Java -- As far as I know, nobody includes 
README files, documentation, or any other kind of data in a .jar 
file, unless it will be used by the code at runtime.


In other words, the source distribution is the canonical method of 
distributing anything that's not used at execution time.  And 
easy_install --editable will fetch and unpack source for you, 
assuming that a source distribution is available.  (Unfortunately, 
many people are only uploading eggs to PyPI, when they should be 
uploading source distributions, and optionally including eggs if relevant.)


Truth be told, there's little reason to upload an .egg to PyPI unless:

1. it contains C code built for OS X or Windows
2. you want it to be able to work with a bootstrapper that lets you 
import from URLs on sys.path,
3. it's a plugin for a system that allows you to upload or drop in 
eggs to use as plugins.


If your project doesn't match these descriptions, there's not really 
a need for an .egg to be uploaded; easy_install will build one just 
fine from a source distribution.


___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig


[Distutils] shal we redefine module and package?

2008-04-30 Thread zooko

Folks:

Here's an experiment you can perform.  Round up a Python programmer  
and ask him the following three questions:


Q1.  You type import foo and it works.  What kind of thing is foo?

Q2.  You go to the Python package index and download something named  
bar-1.0.0.tar.gz.  What kind of thing is bar?


Q3.  What is a distribution?

I'm willing to bet that you will get the following answers:

A1.  foo is a module.

A2.  bar is a package.

A3.  A distribution is a version of Linux that comes with a lot of  
Free Software.



Unfortunately these answers aren't quite right.  A package is  
actually a directory containing an __init__.py file, and a  
distribution is actually what you think of when you say package --  
a reusable package of Python code that you can, for example, get from  
the Python package index.


Educational efforts such as the Python tutorial and the distutils  
docs have not succeeded in training Python programmers to understand  
the terminology for these things as used by the Python implementors,  
so perhaps instead the implementors should start using the  
terminology understood by the programmers:


1.  A module shall henceforth be the name for either a foo.py file  
(a single-file module), or a directory with an __init__.py in it (a  
directory module).


2.  A package shall henceforth be the name of the thing that is  
currently called a distribution.



Regards,

Zooko

who doesn't mind stirring up trouble on occasion...

___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] [Python-Dev] shal we redefine module and package?

2008-04-30 Thread Nick Coghlan

zooko wrote:

Folks:

Here's an experiment you can perform.  Round up a Python programmer and 
ask him the following three questions:


Q1.  You type import foo and it works.  What kind of thing is foo?


foo is a package or a module. Not enough information is provide here to 
say which.


Q2.  You go to the Python package index and download something named 
bar-1.0.0.tar.gz.  What kind of thing is bar?


bar is a package, a module, or a collection of a number of these things. 
Again, not enough information is provided in the question to say which 
is actually the case.


Cheers,
Nick.

P.S. People, including programmers, are often sloppy with terminology. 
This is not a new problem.


--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
http://www.boredomandlaziness.org
___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] [Python-Dev] shal we redefine module and package?

2008-04-30 Thread glyph


On 10:53 pm, [EMAIL PROTECTED] wrote:

zooko wrote:


Unfortunately these answers aren't quite right.  A package is 
actually a directory containing an __init__.py file, and a 
distribution is actually what you think of when you say package -- a 
reusable package of Python code that you can, for example, get from 
the Python package index.


The fact that the Python package index is a place where you get 
distributions does seem a bit weird to me, but this is not necessarily 
a problem that can be fixed.  Ambiguity is part of human language. 
Perhaps suggest transliterations of these terms for talking about python 
in lojban? :)
1.  A module shall henceforth be the name for either a foo.py file 
(a single-file module), or a directory with an __init__.py in it (a 
directory module).


I have a less disruptive counterproposal.  How about just starting to 
refer to directories (or folders, or zip entries) with '__init__.py' 
in them as package modules?  A package is-a module anyway.
2.  A package shall henceforth be the name of the thing that is 
currently called a distribution.


I belive a multi-word term here would be similarly more memorable and 
precise.  A package distribution would include the more familiar term 
while still being specific, consistent with the old terminology, and 
correct.  Using a qualifying word is probably a good idea in this 
context anyway.  I usually say debian package, RPM, MSI, or 
tarball unless I'm specifically talking about packages for your 
platform, almost always in the phrase, please do not use distutils to 
do a system install of Twisted, use the specific package for your 
platform.

-1


I do, however, agree with Steve emphatically on your original proposal. 
Changing the terminology now will make billions upon billions of Python 
web pages, modules (c.f. 
twisted.python.modules.PythonModule.isPackage()) documents, and 
searchable message archives obsolete, not to mention that 90% of the 
community will probably ignore you and use the old terminology anyway, 
creating more confusion than it eliminates.

___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig


Re: [Distutils] [Python-Dev] shal we redefine module and package?

2008-04-30 Thread Greg Ewing

Nick Coghlan wrote:

zooko wrote:


Q1.  You type import foo and it works.  What kind of thing is foo?


foo is a package or a module. Not enough information is provide here to 
say which.


Actually, it could be anything! But it's *probably* a module
(or package, but a package is also a module, if we're being
fussy about terminology).

--
Greg
___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig



Re: [Distutils] shal we redefine module and package?

2008-04-30 Thread Ben Finney
zooko [EMAIL PROTECTED] writes:

 I'm willing to bet that you will get the following answers:
 
 A1.  foo [from 'import foo'] is a module.
 
 A2.  bar [of 'bar-1.2.3.tar.gz'] is a package.
 
 A3.  A distribution is a version of Linux that comes with a lot of
 Free Software.
 
 
 Unfortunately these answers aren't quite right.

More accurately, they're right in the context from which the speaker
learned them.

 A package is actually a directory containing an __init__.py file,
 and a distribution is actually what you think of when you say
 package -- a reusable package of Python code that you can, for
 example, get from the Python package index.

Only within Python's terminology. This, of course, conflicts with the
meanings that adhere to those words just about everywhere else on the
user's operating system.

 Educational efforts such as the Python tutorial and the distutils
 docs have not succeeded in training Python programmers to understand
 the terminology for these things as used by the Python implementors,

More accurately, the meanings you list in the hypothetical responses
above are entrenched and more useful for general use.

 so perhaps instead the implementors should start using the
 terminology understood by the programmers:

In principle this would be good. However:

 1.  A module shall henceforth be the name for either a foo.py file
 (a single-file module), or a directory with an __init__.py in it (a
 directory module).

How then to distinguish between these? They're clearly separate
concepts, and I think they need distinct terms.

 2.  A package shall henceforth be the name of the thing that is
 currently [in Python terminology] called a distribution.

That one would be good.

You then have the converse problem of changing the use of terminology
that is currently entrenched in existing Python documentation and
minds :-)

-- 
 \Always code as if the guy who ends up maintaining your code |
  `\ will be a violent psychopath who knows where you live. —John |
_o__) F. Woods |
Ben Finney

___
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig