zc.buildout recipe to parse pip config files ang use parsed info in a buildout.
Project description
.. contents::
Overview
========
This recipe allows to parse pip configuration files (usually named requirements.txt) into just list of the eggs to use
in other parts of the buildout.
The recipe mirrors the parsed eggs list into its section, so that e.g.
``${pip:eggs}`` will give the list of parsed eggs.
For now single option of the recipe is ``configs`` - list of config files to parse.
The config files are parsed during the initialization of the ``Recipe`` instance,
i.e. after ``buildout.cfg`` is read but before any recipe is installed or updated.
Example usage: Use an environment variable
==========================================
Let's create test config files
>>> write('requirements.txt',
... """
... some.egg
... -e http://some.package.git.url#egg=develop.egg
... fabric>=0.9b1
... # some comment
... xlrd # reading excel worksheets
... html5lib==0.95
... """)
>>> write('requirements2.txt',
... """
... some2.egg
... django>=1.3,<1.4
... django-extensions #django extension requirements (not mandatory, but useful on dev)
... -e http://some2.package.git.url#egg=develop2.egg
... --extra-index-url=http://some.index.url
... -f http://git.fabfile.org
... """)
We'll start by creating a buildout that uses the recipe::
>>> write('buildout.cfg',
... r"""
... [buildout]
... parts = pip print
...
... [some-section]
... eggs = ${pip:eggs}
...
... [pip]
... recipe = collective.recipe.pip
... configs = requirements.txt
... requirements2.txt
... versions = versions
...
... [versions]
...
... [print]
... recipe = mr.scripty
... install =
... ... print self.buildout['some-section']['eggs']
... ... print '\n[versions]'
... ... print '\n'.join(map(lambda (i, k): (i + ' = ' + k), self.buildout['versions'].items()))
... ... return []
... """)
The `mr.scripty`_ recipe is used to print out the value of the ${some-section:some-option}
option.
Running the buildout gives us::
>>> print 'start', system(buildout)
start...
some.egg
fabric>=0.9b1
xlrd
html5lib==0.95
some2.egg
django>=1.3,<1.4
django-extensions
<BLANKLINE>
[versions]
django = >=1.3,<1.4
fabric = >=0.9b1
html5lib = 0.95
<BLANKLINE>
Contributors
============
Anatoly Bubenkov <bubenkoff@gmail.com>, Author
Changelog
=========
0.1.2 (2013-01-05)
------------------
- Added filling versions part with parsed versions
0.1.1 (2012-12-22)
------------------
- Improved version parsing
0.1.0 (2012-12-22)
------------------
- First release.
Overview
========
This recipe allows to parse pip configuration files (usually named requirements.txt) into just list of the eggs to use
in other parts of the buildout.
The recipe mirrors the parsed eggs list into its section, so that e.g.
``${pip:eggs}`` will give the list of parsed eggs.
For now single option of the recipe is ``configs`` - list of config files to parse.
The config files are parsed during the initialization of the ``Recipe`` instance,
i.e. after ``buildout.cfg`` is read but before any recipe is installed or updated.
Example usage: Use an environment variable
==========================================
Let's create test config files
>>> write('requirements.txt',
... """
... some.egg
... -e http://some.package.git.url#egg=develop.egg
... fabric>=0.9b1
... # some comment
... xlrd # reading excel worksheets
... html5lib==0.95
... """)
>>> write('requirements2.txt',
... """
... some2.egg
... django>=1.3,<1.4
... django-extensions #django extension requirements (not mandatory, but useful on dev)
... -e http://some2.package.git.url#egg=develop2.egg
... --extra-index-url=http://some.index.url
... -f http://git.fabfile.org
... """)
We'll start by creating a buildout that uses the recipe::
>>> write('buildout.cfg',
... r"""
... [buildout]
... parts = pip print
...
... [some-section]
... eggs = ${pip:eggs}
...
... [pip]
... recipe = collective.recipe.pip
... configs = requirements.txt
... requirements2.txt
... versions = versions
...
... [versions]
...
... [print]
... recipe = mr.scripty
... install =
... ... print self.buildout['some-section']['eggs']
... ... print '\n[versions]'
... ... print '\n'.join(map(lambda (i, k): (i + ' = ' + k), self.buildout['versions'].items()))
... ... return []
... """)
The `mr.scripty`_ recipe is used to print out the value of the ${some-section:some-option}
option.
Running the buildout gives us::
>>> print 'start', system(buildout)
start...
some.egg
fabric>=0.9b1
xlrd
html5lib==0.95
some2.egg
django>=1.3,<1.4
django-extensions
<BLANKLINE>
[versions]
django = >=1.3,<1.4
fabric = >=0.9b1
html5lib = 0.95
<BLANKLINE>
Contributors
============
Anatoly Bubenkov <bubenkoff@gmail.com>, Author
Changelog
=========
0.1.2 (2013-01-05)
------------------
- Added filling versions part with parsed versions
0.1.1 (2012-12-22)
------------------
- Improved version parsing
0.1.0 (2012-12-22)
------------------
- First release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for collective.recipe.pip-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc96ffe0d6f190284dfbcbebe622bfdda4c1db5315e8869a8b9a7e95da57e89e |
|
MD5 | 142ea8300ebf526482afabe7ca89febc |
|
BLAKE2b-256 | dc0ac4c6c9491e3993db09ce67a3632b50aafce844279a92ffe3fe7eabf2a74b |