-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pip freeze
fails to properly return hg
URL if virtualenv is under Git controlled project
#3988
Comments
Using the
In the
In a
|
Unfortunately, I don't see why Maybe pip should try all its supported VCS and if it found several repository, select the one with the smallest subdirectory path ? |
Agreed, this seems like it would be pretty complex code for a rare situation. I'm inclined to just say "don't put your virtualenv directory under your project folder", tbh. |
This is what worked for me though. The Since the command is being run in the cloned project's directory,
Given that pip officially supports doing a
It might be that the "edge case" here is the location of the |
My bad, I scanned the code too quickly.
I agree that having a venv in your project folder (and hence in a vcs repository) is a common usecase. So maybe changing |
I could take a stab at it when I have some free time from my primary project =) Would this be the preferred way about it? |
I don't think of any other way (as |
Description:
I've got my virtulenv directory (
venv
) under my project folderOne of my requirements is installed via
-e hg+https://
, which ends up getting cloned tovenv/src
.I'd like to automatically update my
requirements.txt
viapip freeze
, butpip
keeps returning myhg
repo as a git URL instead.I'd expect
but I keep getting this instead
which isn't very helpful for my
requirements.txt
.What I've run:
I dug into
pip
's source, and narrowed it down tocontrols_location()
inpip/vcs/git.py
.Turns out, running
git rev-parse
in thehg
-cloned copy ofsome_project
does not raise an error, becausegit
traverses the tree upwards, eventually reaching the top level of my own project and finding the.git
there instead. That would seem why<my_projects_hash>
appears in thepip freeze
output.In
pip/vcs::VcsSupport.get_backend_name()
, it would appear the the git module is running first, and becausegit rev-parse
is not raising an error from within thehg
-cloned directory undervenv/src
, is claiming thehg
-cloned project as a git repo instead (even before thehg
module has a chance to run).The text was updated successfully, but these errors were encountered: