Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

peep crashes when deps are already in the virtual env #22

Closed
lonnen opened this issue Dec 5, 2013 · 4 comments
Closed

peep crashes when deps are already in the virtual env #22

lonnen opened this issue Dec 5, 2013 · 4 comments

Comments

@lonnen
Copy link

lonnen commented Dec 5, 2013

I had a requirements file with a single requirement. The package was already installed in my virtual environment, but I wanted peep to give me the sha to put in the file.

It appears that peep errors when the package is already installed into the virtual env because it never downloads files to hash.

console log of the problem with description:
https://gist.github.com/lonnen/c5dc13deb12589f6de04

@gsathya
Copy link

gsathya commented Feb 6, 2014

Thoughts on gsathya@859430e ?

(env)peep git:(master) : cat ../env/requirements.txt 
peep                                                                                                                                                                                          �
(env)peep git:(master) : python peep.py install -r ../env/requirements.txt

The following packages had no hashes specified in the requirements file, which
leaves them open to tampering. Vet these packages to your satisfaction, then
add these "sha256" lines like so:

Traceback (most recent call last):
  File "peep.py", line 379, in <module>
    exit(main())
  File "peep.py", line 371, in main
    return commands[argv[1]](argv[2:])
  File "peep.py", line 344, in peep_install
    print '# sha256: %s' % downloaded_hashes[package_name]
KeyError: 'peep'

becomes

(env)peep git:(bug22) : python peep.py install -r ../env/requirements.txt
These packages were already installed, so we didn't need to download or build
them again. If you installed them with peep in the first place, you should be
safe. If not, uninstall them, then re-attempt your install with peep.
    peep

erikrose added a commit that referenced this issue Feb 28, 2014
…already installed. Fix #22. Bump version to 0.9.1.

Thanks to gsathya for an initial patch toward this. I just tweaked his to maintain the package order from the requirements file, so you can paste into it without disturbing any organizational scheme you had going on there.
@gsathya
Copy link

gsathya commented Mar 1, 2014

Sort of nitpick, but it makes more sense to make satisfied_req_names a dict, rather than a set if you're just doing lookup. The running time is O(n) and not O(n*n)

@gsathya
Copy link

gsathya commented Mar 1, 2014

Oh wow. Disregard my earlier comment. TIL python sets are implemented using dictionaries[0]

[0] - http://svn.python.org/projects/python/trunk/Objects/setobject.c

@erikrose
Copy link
Owner

erikrose commented Mar 2, 2014

Yep, they're dicts without values, iirc.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants