Skip to main content

Edits your requirements.txt by hashing them in

Project description

https://travis-ci.org/peterbe/hashin.svg?branch=master

Helps you write your requirements.txt with hashes so you can install with pip install --require-hashes -r ...

If you want to add a package or edit the version of one you’re currently using you have to do the following steps:

  1. Go to pypi for that package

  2. Download the .tgz file

  3. Possibly download the .whl file

  4. Run pip hash downloadedpackage-1.2.3.tgz

  5. Run pip hash downloadedpackage-1.2.3.whl

  6. Edit requirements.txt

This script does all those things. Hackishly wonderfully so.

A Word of Warning!

The whole point of hashing is that you vet the packages that you use on your laptop and that they haven’t been tampered with. Then you can confidently install them on a server.

This tool downloads from PyPI (over HTTPS) and runs pip hash on the downloaded files.

You still need to check that the packages that are downloaded are sane.

You might not have time to go through the lines one by one but you should be aware that the vetting process is your responsibility.

Installation

This is something you only do or ever need in a development environment. Ie. your laptop:

pip install hashin

How to use it

Suppose you want to install futures. You can either do this:

hashin futures

Which will download the latest version tarball (and wheel) and calculate their pip hash and edit your requirements.txt file.

Or you can be specific about exactly which version you want:

hashin "futures==2.1.3"

Suppose you don’t have a requirements.txt right there in the same directory you can do this:

hashin "futures==2.1.3" stuff/requirementst/prod.txt

If there’s not output. It worked. Check how it edited your requirements files.

Runnings tests

Simply run:

python setup.py test

Debugging

To avoid having to install hashin just to test it or debug a feature you can simply just run it like this:

touch /tmp/whatever.txt
python hashin.py --verbose Django /tmp/whatever.txt

History

This program is a “fork” of https://pypi.python.org/pypi/peepin peepin was a companion to the program peep https://pypi.python.org/pypi/peep/ but the functionality of peep has been put directly into pip as of version 8.

Version History

0.1
  • First, hopefully, working version.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hashin-0.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

hashin-0.1-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

hashin-0.1-py2-none-any.whl (6.7 kB view details)

Uploaded Python 2

File details

Details for the file hashin-0.1.tar.gz.

File metadata

  • Download URL: hashin-0.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for hashin-0.1.tar.gz
Algorithm Hash digest
SHA256 e3308fb80af7759f4199f7067100192f642d83326434f575365f669f38985e77
MD5 8ae2fe42abada386fc999486d75d995c
BLAKE2b-256 7434b9dd26d5609e1661ab5cd89fb48de06e0ad66a500becd8395abe0d9bc347

See more details on using hashes here.

File details

Details for the file hashin-0.1-py3-none-any.whl.

File metadata

  • Download URL: hashin-0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for hashin-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2908438137550f11b3e9bce534a53e64f8ea7629dfd7c4de8efa50757759ba42
MD5 1939638e6769019dc4eeee2cd175906d
BLAKE2b-256 44777ce0a2ef710253232c88e403667f77a7f117bedf3c15de6c372d45298ccf

See more details on using hashes here.

File details

Details for the file hashin-0.1-py2-none-any.whl.

File metadata

  • Download URL: hashin-0.1-py2-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for hashin-0.1-py2-none-any.whl
Algorithm Hash digest
SHA256 206173cbc989ee5c2ae55982156c6752b0b5387c75aaf5a6b4535be082a3ea86
MD5 f08161aef8b19ae05c86fa653a44a425
BLAKE2b-256 e80a38e513154ffd32001cdcc84e2e6f0d67f1ad851595333a94958066de6aa4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page