Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a9871db

Browse files
committed
Add a note about how to install from a URI.
Maybe this will stop the questions. [ci skip]
1 parent 07e5cb6 commit a9871db

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,30 @@ end
2727
pip_requirements '/opt/myapp/requirements.txt'
2828
```
2929

30+
## Installing a Package From a URI
31+
32+
While using `python_package 'git+https://github.com/example/mypackage.git'` will
33+
sometimes work, this approach is not recommended. Unfortunately pip's support
34+
for installing directly from URI sources is limited and cannot support the API
35+
used for the `python_package` resource. You can run the install either directly
36+
from the URI or through an intermediary `git` resource:
37+
38+
```ruby
39+
# Will re-install on every converge unless you add a not_if/only_if.
40+
python_execute '-m pip install git+https://github.com/example/mypackage.git'
41+
42+
# Will only re-install when the git repository updates.
43+
python_execute 'install mypackage' do
44+
action :nothing
45+
command '-m pip install .'
46+
cwd '/opt/mypackage'
47+
end
48+
git '/opt/mypackage' do
49+
repository 'https://github.com/example/mypackage.git'
50+
notifies :run, 'python_execute[install mypackage]', :immediately
51+
end
52+
```
53+
3054
## Supported Python Versions
3155

3256
This cookbook can install at least Python 2.7, Python 3, and PyPy on all

0 commit comments

Comments
 (0)