git checkout could/should be done with --depth=1
See original GitHub issuepip can install directly from git, great!
When pip installs from git, it downloads the entire history of the git branch - when all it wants is the target version. I believe this can be achieved using the --depth=1
flag to various git subcommands. The speedup on projects with a long history can be significant.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:24
- Comments:55 (31 by maintainers)
Top Results From Across the Web
How and when to perform a git clone depth 1 example
How to do a git clone of depth 1 · Copy the clone URL of the remote repository; · Include the –depth 1...
Read more >Using GIT to get another branch when the clone was done with
Because --depth 1 implies --single-branch , you got only one commit for one branch. Use the --no-single-branch option during cloning to get one...
Read more >How to Use Git Shallow Clone to Improve Performance
Provide an argument of -- depth 1 to the git clone command to copy only the latest revision of a repo: git clone...
Read more >Git Shallow Clone and Clone Depth - Linux Hint
Git's solution to the problem is shallow clone where you can use clone depth to define how deep your clone should go. For...
Read more >Git - git-clone Documentation
Employ a sparse-checkout, with only files in the toplevel directory initially being present. The git-sparse-checkout[1] command can be used to grow the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anyone using pip git installs a lot right now, who can’t wait, and who doesn’t care about setuptools_scm, you can just hack this this as a work-around. Just replace line 142 in <python-lib-path>/pip/vcs/git.py:
with
Dodgy, but it saves me 20 minutes on a statsmodel install…
@dstufft caching entire repos does not solve the underlying motivation for this, at least for me. I use Docker a lot these days, and build a lot of projects in Docker images that often pip install editable requirements (because for example, you must make a requirement editable to include in a
requirements.in
file for use withpip-tools
(which admittedly is not reallypip
’s problem, but we need to use it to work around some other pip limitations e.g. “first-found” nested dependency conflict resolution).I don’t want or need to download let alone bake into the image, the entire 25,000 commit, 220 MB Django repository, for example.