Skip to main content

collective.recipe.pip

Buildout recipe which parses pip config files allowing to use both pip and buildout for same project independently

https://travis-ci.org/collective/collective.recipe.pip.png https://pypip.in/v/collective.recipe.pip/badge.png https://coveralls.io/repos/collective/collective.recipe.pip/badge.png?branch=master

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.

The list of eggs which come from urls (eg from github) are also exported to the urls param: ${pip:urls} will give the list of parsed egg urls.

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
... --use-wheel
... http://sourceforge.net/projects/pychecker/files/latest/download?source=files#egg=pychecker==0.8.19
... fabric>=0.9b1
... # some comment
... xlrd # reading excel worksheets
... html5lib==0.95
... """)
>>> write('requirements-included.txt',
... """
... some.included.egg
... """)
>>> write('requirements-included2.txt',
... """
... some.included.egg2
... """)
>>> mkdir('file.package')
>>> write('file.package/setup.py',
... """
... from setuptools import setup
... setup(name='file.package')
... """)
>>> write('requirements2.txt',
... """
... -r requirements-included.txt
... --requirement requirements-included2.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
... -e file.package
... --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(i + ' = ' + k for i, k in sorted(self.buildout['versions'].items())))
...     ... print('\n[urls]')
...     ... print(self.buildout['pip']['urls'])
...     ... print('# done')
...     ... return []
... """)

The mr.scripty recipe is used to print out the value of the ${some-section:some-option} option.

Running the buildout gives us:

>>> import sys
>>> sys.stdout.write('start\n' + system(buildout))
start...
Installing pip.
Installing print.
develop.egg
develop2.egg
django-extensions
django>=1.3,<1.4
fabric>=0.9b1
html5lib==0.95
pychecker==0.8.19
some.egg
some.included.egg
some.included.egg2
some2.egg
xlrd
[versions]
django = >=1.3,<1.4
fabric = >=0.9b1
html5lib = 0.95
pychecker = 0.8.19
zc.buildout = ...
zc.recipe.egg = ...
[urls]
/sample-buildout/file.package
git+http://some.package.git.url#egg=develop.egg
git+http://some2.package.git.url#egg=develop2.egg
http://sourceforge.net/projects/pychecker/files/latest/download?source=files#egg=pychecker==0.8.19
...

Contact

If you have questions, bug reports, suggestions, etc. please create an issue on the GitHub project page.

License

This software is licensed under the MIT license

See License file

© 2013 Anatoly Bubenkov and others.

Contributors

Changelog

0.3.4 (2016-05-25)

  • Support recent pip 8.1.2 (ridha)

0.3.2 (2015-07-19)

  • Backward compatibility for older pip (ccomb)

0.3.1 (2015-05-27)

  • Support recent pip (7.x.x) (ridha)

0.3.0 (2015-03-17)

  • Support recent pip (6.x.x) (ridha)

0.2.0 (2014-02-06)

  • Correctly parse –use-wheel

0.1.9 (2013-12-05)

  • Support local editable eggs

0.1.7 (2013-06-27)

  • Support custom url-eggs to be seen in the urls param

0.1.6 (2013-03-11)

  • Unpredictable requirements parse case fixed

0.1.5 (2013-02-18)

  • Buildout 2.0.1 support added

0.1.4 (2013-01-29)

  • Fixed the home URL, remove unnecessary README.txt

0.1.3 (2013-01-25)

  • Refactored parsing to use native pip config parser, so now it’s possible to nest configs via -r just like using pip

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.

Release files for collective.recipe.pip 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for collective.recipe.pip 0.3.4
File Size Uploaded
collective.recipe.pip-0.3.4.tar.gz 7.0 kB Details

Release files / collective.recipe.pip-0.3.4.tar.gz

Download URL collective.recipe.pip-0.3.4.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4fc4b429eb55c04265df524c5d02056d4a08f364ddfef28093986a3f441e0ba2
BLAKE2b-256 checksum
How to use checksums
404c45fa5168c58f74839fad9b42c149b256ffc8a76ba91d24c41bcf3094d3d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3.4 This release

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page