Skip to content
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

Reuse/copy pip code for VCS and download #1

Open
pombredanne opened this issue Oct 7, 2019 · 13 comments
Open

Reuse/copy pip code for VCS and download #1

pombredanne opened this issue Oct 7, 2019 · 13 comments

Comments

@pombredanne
Copy link
Member

pip is a good starting point as https://github.com/pypa/pip/blob/master/src/pip/_internal/download.py is a solid and reliable download utility tested with billions of downloads.

There are a few ways to handle this:

  1. use https://github.com/sarugaku/pip-shims and reuse pip code
  2. copy and fork pip code
  3. vendor pip code

Note pip also handles VCS URLs
See https://github.com/pypa/pip/tree/master/src/pip/_internal/vcs
The download location specified in SPDX is mostly derived from the pip URLs https://github.com/spdx/spdx-spec/blob/db06dc81e525e08035af34117127742337e1f1b6/chapters/3-package-information.md#37-package-download-location-

pip does not handle ftp AFAIK

@TG1999
Copy link
Collaborator

TG1999 commented Oct 8, 2019

Hi, can you tell me some steps that I should follow to solve this issue.

@TG1999
Copy link
Collaborator

TG1999 commented Oct 8, 2019

From your description I understand that I should make a download.py file that should be like https://github.com/pypa/pip/blob/master/src/pip/_internal/download.py inside fetchcode. Are the steps correct?

@pombredanne
Copy link
Member Author

Now that we have an API the next step is this ticket.

@TG1999
Copy link
Collaborator

TG1999 commented Nov 12, 2019

https://github.com/pypa/pip/blob/master/src/pip/_internal/download.py this is missing now, I am not able to open it

@pombredanne
Copy link
Member Author

It was there https://github.com/pypa/pip/blob/13ab7a2bce8fcde72b722cfc803d34671f1cd855/src/pip/_internal/download.py
but has now been exploded in this https://github.com/pypa/pip/tree/master/src/pip/_internal/network

This parts that deal with VCS is more stable
https://github.com/pypa/pip/tree/master/src/pip/_internal/vcs

In anycase we will have to fork as there is no stable code API in pip

@TG1999
Copy link
Collaborator

TG1999 commented Nov 13, 2019

A little doubt, do we expect user to have installed git, mercurial or whichever VCS repo user wants to download.

@pombredanne
Copy link
Member Author

@TG1999 yes. It would be nice if we cant use some library for Git, but reusing the command line should be simpler and this is how pip works and since this can be tricky code, best to reuse it

@pombredanne
Copy link
Member Author

pombredanne commented Nov 19, 2019

@pombredanne wrote

hey :) let me check in details what pip bit we could reuse
IMHO the vcs module is really worth it. It it a well tested command line wrapper for git/hg/svn etc... See https://github.com/pypa/pip/blob/e79fa0e8a249c3b3c6711e2ad85b0235a8a5d70a/src/pip/_internal/vcs/versioncontrol.py#L506 which is the entry point IMHO

@TG1999 replied

Okay I am getting you. So please correct my steps
First I should fork this pip repo
Then copy the code inside repo as it is in root directory
Then What should I do after that ?
Because the entry point versioncontrol.py needs some inner modules present inside pip so I have to copy the whole code then
Or only from the src/pip

@TG1999
Copy link
Collaborator

TG1999 commented Nov 19, 2019

Hi, please can you explain me the steps :)

@pombredanne
Copy link
Member Author

@TG1999 the things to do could be on of these:

  1. reuse @techalchemy https://github.com/sarugaku/pip-shims
  2. create a wrapper (likely reusing pip-shims) that would also vendor pip so we have this really reusable as a library
  3. carefully extract the subset we care for (mostly the vcs module and its tests and deps) and just fork it

@pombredanne
Copy link
Member Author

An alternative could be to look at https://github.com/juju/charm-helpers/tree/master/charmhelpers/fetch that has Git, bzr, http (and claims FTP support)

@TG1999
Copy link
Collaborator

TG1999 commented Nov 21, 2019

Agreed @pombredanne I will send a PR by this weekend

@TG1999
Copy link
Collaborator

TG1999 commented Jul 28, 2020

@pombredanne I think we can close this now :)

JonoYang pushed a commit that referenced this issue Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants