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

Add downloaded state to pip module to call pip download #50275

Closed
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
5 participants
@justinsousa
Copy link

justinsousa commented Dec 23, 2018

SUMMARY

I often use the pip download command to download python libraries that are dependencies for projects. I figure adding a downloaded state which essentially just calls pip download would make sense. It would allow downloading all dependencies for a project using the pip module and then later pointing pip at that directory with extra_args containing -f/--find-links pointing at the directory that the dependencies were downloaded to. This would avoid the need to call pip download with the command/shell module.

Some example uses below

- name: download library by name
  become: no
  pip:
    chdir: /myapp/pylibs
    name: Bottle
    state: downloaded
    executable: /usr/local/bin/pip2.7

- name: download from reqs file
  become: no
  pip:
    chdir: "{{ pylib_cache }}"
    requirements: /myapp/requirements.txt
    state: downloaded

Something to note, the download option was added with version 8.0 (I believe that's the version based on https://pip.pypa.io/en/stable/news/#id18), so this switches to install --download if the download command is not found.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

pip module

ANSIBLE VERSION
ansible 2.8.0.dev0
  config file = None
  configured module search path = ['${HOME}/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = ${HOME}/repos/py3venvs/ans-dev/lib/python3.7/site-packages/ansible-2.8.0.dev0-py3.7.egg/ansible
  executable location = ${HOME}/repos/py3venvs/ans-dev/bin/ansible
  python version = 3.7.0 (default, Jul 23 2018, 20:24:19) [Clang 9.0.0 (clang-900.0.39.2)]

ADDITIONAL INFORMATION
@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Dec 23, 2018

@nitzmahone

This comment has been minimized.

Copy link
Member

nitzmahone commented Jan 8, 2019

Thanks for the contribution. We've discussed this amongst the core team, and since there's not really a sane way to do this idempotently, we feel it's not really a proper value to add to state, so we're going to close this. Probably the best thing to do here is just use command to call pip to download the files.

@nitzmahone nitzmahone closed this Jan 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment