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

Added an example to README.md for installing from git #2702

Merged
merged 4 commits into from
Aug 17, 2018

Conversation

patchwork-systems
Copy link
Contributor

Thank you for contributing to Pipenv!

The issue

There was a request for additional documentation on installing from git

The fix

I updated the README.md with an example to install requests, this could also be added to the official docs as well, but I figured this was a good start. I didn't add any additional information to the news/ directory because I wasn't sure what the naming method was

The checklist
  • [ x ] Associated issue
  • [ x ] A news fragment in the news/ directory to describe this fix with the extension .bugfix, .feature, .behavior, .doc. .vendor. or .trivial (this will appear in the release changelog). Use semantic line breaks and name the file after the issue number or the PR #.

Copy link
Member

@techalchemy techalchemy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a bunch for putting this together! You inspired me to write a bunch more of this section, but I didn't want to steal your thunder :) I don't normally write documentation, so even if you copy and paste my rework of your information I'd be highly appreciative!

Thanks a bunch for getting this moving, we never really have the focus to tackle these types of things but it's a lot easier to build on a PR

README.md Outdated
...
Adding -e git+https://github.com/requests/requests.git@v2.19.1#egg=requests to Pipfile's [packages]...

You can also change the tag/ref (or exclude to get the latest version) by adding @version-or-tag before #egg=project_name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind doing a touch of cleanup here and adding a section that describes the syntax including the sections of the url? Suggestion below:

Can you add some syntax highlighting here at the bottom? Then you can end the line with a period.

Installing from git:

You can install packages with pipenv from git and other version control systems using URLs formatted according to the following rule:

```
    <vcs_type>+<scheme>://<location>/<user_or_organizatoin>/<repository>@<branch_or_tag>#<package_name>
```

The only optional section is the `@<branch_or_tag>` section.  When using git over SSH, you may use the shorthand vcs and scheme alias `git+git@<location>:<user_or_organization>/<repository>@<branch_or_tag>#<package_name>`. Note that this is translated to `git+ssh://git@<location>` when parsed.

Valid values for `<vcs_type>` include `git`, `bzr`, `svn`, and `hg`.  Valid values for `<scheme>` include `http,`, `https`, `ssh`, and `file`.  In specific cases you also have access to other schemes: `svn` may be combined with `svn` as a scheme, and `bzr` can be combined with `sftp` and `lp`.

Note that it is **strongly recommended** that you install any version-controlled dependencies in editable mode in order to ensure that dependency resolution can be performed with an up to date copy of the repository each time it is performed, and that it includes all known dependencies.

Below is an example usage which installs the git repository located at `https://github.com/requests/requests.git` from tag `v2.19.1` as package name `requests`:

```console
    $ pipenv install -e git+https://github.com/requests/requests.git@v2.19#egg=requests
    Creating a Pipfile for this project...
    Installing -e git+https://github.com/requests/requests.git@v2.19.1#egg=requests...
    [...snipped...]
    Adding -e git+https://github.com/requests/requests.git@v2.19.1#egg=requests to Pipfile's [packages]...
    [...]
```

@patchwork-systems
Copy link
Contributor Author

I went ahead and updated the README with your excellent explaination, although I'm unsure what you meant here:

Can you add some syntax highlighting here at the bottom? Then you can end the line with a period.

I'm still fairly new to markdown, but it seems that important console section is already syntax highlighted.

@uranusjr
Copy link
Member

Would it be a good idea to add a link to pip’s documentation on this as well?

https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support

@slhck
Copy link
Contributor

slhck commented Aug 13, 2018

@jeremytiki Just a minor nitpick: when you add console syntax, it should be formatted with either fenced code (with three backslashes) or 4-space indent, not both. If you look at the other code sections in the README, you'll notice that it only uses 4-space indents.

@slhck
Copy link
Contributor

slhck commented Aug 13, 2018

Also, coming here from #2714, the proposed README says,

Note that it is strongly recommended that you install any version-controlled dependencies in editable mode in order to ensure that dependency resolution can be performed with an up to date copy of the repository each time it is performed, and that it includes all known dependencies.

It would be best to directly explain to the user how that would work, i.e. write “in editable mode, using pipenv install -e …, in order to ensure …”.

…p documentation on vcs support and @slhck request for more consistent formatting of code blocks and more explict instructions for editable mode when installing from vcs
@patchwork-systems
Copy link
Contributor Author

@uranusjr I'll add a link to the pip documentation as well!

@slhck By all means! Please critique anything that looks out of place! Like I said I'm still trying to learn how a lot of this stuff works so if I am doing something incorrectly or even less than ideal let me know so I can fix it! I went ahead and removed the back-ticks, using only 4 space indent for the code blocks as well as adding in the additional explanation for the -e flag.

@techalchemy
Copy link
Member

Sorry for the delays on this, it looks really good to me :D thanks a ton for putting this together, this is going to be incredibly helpful

@techalchemy techalchemy added Type: Documentation 📖 This issue relates to documentation of pipenv. PR: awaiting-merge The PR related to this issue has been reviewed and is awaiting merge. PR: awaiting-news The PR related to this issue is missing a news fragment and cannot be merged. labels Aug 17, 2018
@techalchemy techalchemy merged commit 2574434 into pypa:master Aug 17, 2018
@coltonbh
Copy link

coltonbh commented Mar 21, 2020

After spending multiple hours not knowing why my installation of a private GitHub repo via ssh was failing I came across this unassuming StackOverflow answer. I'd recommend adding something like this to the pipenv docs so that people can avoid this pain--it's a tough issue to track down!

If you want to install via ssh (say, for a private repo), you'll need to modify the GitHub ssh url as follows:

git@github.com:coltonbh/my-package.git (fetch)
              ^ change this to a '/' character

Correct:
git@github.com/coltonbh/my-package.git

Incorrect:
git@github.com:coltonbh/my-package.git (This is the URL GitHub provides on a repo's main page)

And the install looks like:

pipenv install -e "git+ssh://git@github.com/coltonbh/my-package.git@branch123#egg=mypgk"

Otherwise you'll get a very long install process followed by the cryptic error:

pipenv.patched.notpip._internal.exceptions.InstallationError: Command "git clone -q ssh://git@github.com:coltonbh/my-package.git /var/folders/w2/rkn1bm3d3ndclys0f81clbfw0000gn/T/requirementslib5mkvyj4m/mypgk" failed with error code 128 in None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: awaiting-merge The PR related to this issue has been reviewed and is awaiting merge. PR: awaiting-news The PR related to this issue is missing a news fragment and cannot be merged. Type: Documentation 📖 This issue relates to documentation of pipenv.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants