Re: how to create a pip package

2009-11-11 Thread Wolodja Wentland
On Tue, Nov 10, 2009 at 20:25 -0800, Phlip wrote:
 On Nov 10, 3:11 pm, Wolodja Wentland wentl...@cl.uni-heidelberg.de
 wrote:
 
  The pip requirement file would contain the following line:

  -e git+git://example.com/repo.git#egg=rep

 Let me ask it like this. What happens when a user types..?

sudo pip install repo

pip will check for 'repo' on pypi, find nothing and stop processing.

 Is github one of the default sites pip scans?

No.

 If so, will it rip a requirements file in the root of repo.git? 

No.

If so, what file name should that have?

You can choose any name you like. I think I have to explain a bit
more.

The requirement file is basically a list of *all installed
distributions* in a Python environment and is usually created by 'pip
freeze'. It is merely a way to tell pip later which distributions it
should try to install.

The basic way of working with requirement files if this:

1. Create virtual environment [1]

2. Install *your* package and all of its dependencies within the virtual
   environment

3. Run 'pip freeze' to get the list of installed distributions and write
   it to a file. This file is the requirement file.

4. Give the requirement file to someone else

5. Create a virtual environment

6. Run 'pip install -r requirement_file.txt' to install all
   distributions 'frozen' in the requirements file

7. PROFIT!!!

A requirements file is not really meant to state the dependencies of a
single distribution, but rather describe the complete state an
environment is in *so it can be reconstructed later* exactly like is has
been before. This is quite important if you want to deploy application
and you want to make sure that only tested versions of you dependency
get installed.

I think of it rather in the terms of:

pip freeze  -- dpkg --get-selections
pip install -r r.txt-- dpkg --set-selections
aptitude install

AFAIK you can also host the distribution on another site than pypi, but
I am not sure how to tell pip to check there for distributions as well.
You might want to ask this on the virtualenv list.

--
  .''`. Wolodja Wentlandwentl...@cl.uni-heidelberg.de 
 : :'  :
 `. `'` 4096R/CAF14EFC 
   `-   081C B7CD FF04 2BA9 94EA  36B2 8B7F 7D30 CAF1 4EFC


signature.asc
Description: Digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to create a pip package

2009-11-11 Thread srid
On Nov 10, 8:25 pm, Phlip phlip2...@gmail.com wrote:
 On Nov 10, 3:11 pm, Wolodja Wentland wentl...@cl.uni-heidelberg.de
 wrote:

  The pip requirement file would contain the following line:

  -e git+git://example.com/repo.git#egg=rep

  I hope this answers your questions :-D

 Let me ask it like this. What happens when a user types..?

    sudo pip install repo

Hey Phlip,

If you run pip install repo, it will try to find a package in
http://pypi.python.org/ named repo.

Run the following commands:

$ pip install pastescript
$ paster create myapp
$ cd myapp/
$ python setup.py sdist register upload

That's all you need to do .. to have your myapp project uploaded to
PyPI. From now onwards, anyone connected to the internet will be able
to run pip install myapp to get your package.

For more details, may I suggest you to read the official distutils
tutorial: http://wiki.python.org/moin/Distutils/Tutorial

-srid

PS: Another advantage of using distutils (or setuptools/distribute)
and uploading your package to PyPI is that you would automatically
enable other package managers (such as PyPM - http://pypm.activestate.com/
) to support your package.



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to create a pip package

2009-11-10 Thread Wolodja Wentland
On Mon, Nov 09, 2009 at 19:48 -0800, Phlip wrote:
 I have a single file that I need my crew to pip install.

Where do you plan to host this file? Will it be available on PiPy?

 When I Google for how to create a pip package I don't hit anything.
 Of course that info is out there; I can't seem to pick up the trail of
 breadcrumbs to it.

As has already been noted in this thread you do not create a file
specifically for pip, but rather use the standard (or soon to be) way of
distributing Python distributions outlined in:

http://docs.python.org/library/distutils.html#module-distutils
http://packages.python.org/distribute/

If you do not plan to host your file on pypi you can easily create a
pip requirements file that references a VCS of your choice. Read how to
do this in the pip documentation on editable packages:

http://pypi.python.org/pypi/pip/

kind regards

Wolodja


signature.asc
Description: Digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to create a pip package

2009-11-10 Thread Phlip
On Nov 10, 1:54 am, Wolodja Wentland wentl...@cl.uni-heidelberg.de
wrote:

 http://docs.python.org/library/distutils.html#module-distutils
 http://packages.python.org/distribute/

ktx... now some utterly retarded questions to prevent false starts.

the distutils page starts with from distutils.core import setup.

but a sample project on github, presumably a pippable project, starts
with:

from setuptools import setup, find_packages

(and it also has ez_setup())

I don't foresee my project growing larger than one* file any time
soon. 'pip freeze' prob'ly won't write a setup.py. What is the
absolute simplest setup.py to stick my project on the PYTHONPATH, and
be done with it?

[*but rest assured it has a developer test suite and a customer test
script!]

--
  Phlip
  http://c2.com/cgi/wiki?ZeekLand
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to create a pip package

2009-11-10 Thread Floris Bruynooghe
On Nov 10, 2:30 pm, Phlip phlip2...@gmail.com wrote:
 On Nov 10, 1:54 am, Wolodja Wentland wentl...@cl.uni-heidelberg.de
 wrote:

 http://docs.python.org/library/distutils.html#module-distutils
 http://packages.python.org/distribute/

 ktx... now some utterly retarded questions to prevent false starts.

 the distutils page starts with from distutils.core import setup.

 but a sample project on github, presumably a pippable project, starts
 with:

     from setuptools import setup, find_packages

 (and it also has ez_setup())

 I don't foresee my project growing larger than one* file any time
 soon. 'pip freeze' prob'ly won't write a setup.py. What is the
 absolute simplest setup.py to stick my project on the PYTHONPATH, and
 be done with it?

Do what the distutils page says, setuptools tries to extend distutils
with many fancy things but if you don't need those (and that's what it
sounds like) then sticking to distutils is better as you only require
the python stdlib.

Regards
Floris
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to create a pip package

2009-11-10 Thread Wolodja Wentland
On Tue, Nov 10, 2009 at 06:30 -0800, Phlip wrote:
 On Nov 10, 1:54 am, Wolodja Wentland wentl...@cl.uni-heidelberg.de
 wrote:
 
  http://docs.python.org/library/distutils.html#module-distutils
  http://packages.python.org/distribute/
 
 ktx... now some utterly retarded questions to prevent false starts.

 the distutils page starts with from distutils.core import setup.

[..]

 from setuptools import setup, find_packages

It will be enough to use the method outlined in the distutils
documentation. Setuptools is a third-party library that used to be the
de-facto standard for Python packaging. I don't want to go into detail
why setuptools might not be the best choice for a project and leave that
to [1] and [2].

The Distribute project was started in order to fix several bugs in
setuptools which was essentially unmaintained for a year and provides a
backward compatible fork in the 0.6 branch.

kind regards

Wolodja

[1] http://www.b-list.org/weblog/2008/dec/14/packaging/
[2] http://blog.ianbicking.org/2008/12/14/a-few-corrections-to-on-packaging/


signature.asc
Description: Digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to create a pip package

2009-11-10 Thread Phlip
      from setuptools import setup, find_packages

 It will be enough to use the method outlined in the distutils
 documentation. Setuptools is a third-party library that used to be the
 de-facto standard for Python packaging. I don't want to go into detail
 why setuptools might not be the best choice for a project...

Good - thanks, all! Those were the exact details I sought to avoid...

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to create a pip package

2009-11-10 Thread Phlip
except...

will pip pull from a simple GitHub repo? or do I need to package
something up and put it in a pythonic repository somewhere?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to create a pip package

2009-11-10 Thread Wolodja Wentland
On Tue, Nov 10, 2009 at 13:09 -0800, Phlip wrote:
 will pip pull from a simple GitHub repo? or do I need to package
 something up and put it in a pythonic repository somewhere?

I don't quite understand, but would say: both ;-)

You can't tell pip to pull from arbitrary git repositories, but only
from those that contain the packaging code as outlined in the distutils
documentation.

These git repositories do *not* have to be hosted on pypi. You should
however be able to do the following:

$ git clone git://example.com/repo.git
$ cd repo
$ python setup.py install

The pip requirement file would contain the following line:

-e git+git://example.com/repo.git#egg=rep

I hope this answers your questions :-D

--
  .''`. Wolodja Wentlandwentl...@cl.uni-heidelberg.de 
 : :'  :
 `. `'` 4096R/CAF14EFC 
   `-   081C B7CD FF04 2BA9 94EA  36B2 8B7F 7D30 CAF1 4EFC


signature.asc
Description: Digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to create a pip package

2009-11-10 Thread Phlip
On Nov 10, 3:11 pm, Wolodja Wentland wentl...@cl.uni-heidelberg.de
wrote:

 The pip requirement file would contain the following line:

 -e git+git://example.com/repo.git#egg=rep

I thought pip didn't do eggs. did I read a stale blog?

 I hope this answers your questions :-D

 we are so close! Pages like this...

  http://blog.ianbicking.org/2008/12/16/using-pip-requirements/

...are answering the question what if I have ten billion
requirements?

I have one, Python. What's the simplest pip requirement file?

I will post here if I figure it out first.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to create a pip package

2009-11-10 Thread Phlip
On Nov 10, 3:11 pm, Wolodja Wentland wentl...@cl.uni-heidelberg.de
wrote:

 The pip requirement file would contain the following line:

 -e git+git://example.com/repo.git#egg=rep

 I hope this answers your questions :-D

Let me ask it like this. What happens when a user types..?

   sudo pip install repo

Is github one of the default sites pip scans?

If so, will it rip a requirements file in the root of repo.git? If so,
what file name should that have?

All the pages I'm reading start at the complex end of the requirements
file concept. They don't seem to mention simple things like the name
of the file, or how to lead pip to the file.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to create a pip package

2009-11-10 Thread Phlip
  -e git+git://example.com/repo.git#egg=rep

Okay. -e is an argument to pip install. If anyone said that, I
overlooked it.

So, yes I can rip from github, just with a longer command line, for
now. Tx!
-- 
http://mail.python.org/mailman/listinfo/python-list


how to create a pip package

2009-11-09 Thread Phlip
Py hont:

I have a single file that I need my crew to pip install.

When I Google for how to create a pip package I don't hit anything.
Of course that info is out there; I can't seem to pick up the trail of
breadcrumbs to it.

While I'm looking, could someone push the link in here? Purely for
posterity? Thanks!

--
  Phlip
  http://c2.com/cgi/wiki?ZeekLand
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to create a pip package

2009-11-09 Thread Gabriel Genellina

En Tue, 10 Nov 2009 00:48:26 -0300, Phlip phlip2...@gmail.com escribió:


I have a single file that I need my crew to pip install.

When I Google for how to create a pip package I don't hit anything.
Of course that info is out there; I can't seem to pick up the trail of
breadcrumbs to it.


See http://pip.openplans.org/
You're looking for the freeze command.

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list