olaf

Helps to manage multiple requirements files.


License
MIT
Install
pip install olaf==0.1.6

Documentation

Codacy Badge

Olaf

Manage multiple requirements files. This is useful if you like to keep requirements.txt and requirements_dev.txt seperate, but then discover that you can no longer run pip freeze > requirements.txt to pin your project's version requirments.

Installation

pip install olaf

Usage

The basic usage is non-destructive, which means you can safely run...

olaf freeze

...just to see what it does. Olaf will then compare the output from pip freeze to the contents of your requirements files to look for mismatched versions or installed packages that don't appear in your requirements files.

It'll then give you some options so you can tell Olaf what to do with any issues it finds...

whichcraft is installed but not in any requirements file
[0] Ignore
[1] Add to requirements.txt
[2] Add to requirements_dev.txt

requirements.txt specifies version 0.0.9 of olaf, the installed version is 0.1.0
[1] Update requirements.txt
[2] Keep existing value

As of version 0.1.2 Olaf also checks for packages mentioned in multiple reqs files and gives you options on which to keep. This happens automatically at the end of olaf freeze but can also be called separately using olaf dupes

Options

You can optionally have Olaf rewrite your requirements files for you by passing --write or -w flag.

olaf freeze -w

The default behaviour is to not write to your requirements files, but to print the results to stdout.

You can specify a different prefix for your requirements files using --prefix or -p...

olaf freeze --prefix req

...which will look for all files matching the glob pattern req*.txt. The prefix can also be used to specify the path to your requirements files if they live somewhere other than the location you're running Olaf from.

olaf freeze -p tests/dummy_reqs -w

Python versions

Python 2 and 3 compatible, tested with 2.7.10 and 3.5.1 (though I think it should work with >= 3.3)

Dependencies

Olaf is built on top of the totally amazing Click, which makes building things like Olaf a breeze.

Todo

  • add support for a .olafignore file
  • add better support for -e eggs
  • add 'do this for everything' options
  • find packages mentioned in more than one reqs file
  • optimisation
  • write more tests

Tests

py.test tests 

Contributing

Pull requests more than welcome. There's plenty of optimisation that could be done.