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

pip editable=true doesn't work with multiple requirement names #77755

Open
1 task done
dehnert opened this issue May 8, 2022 · 2 comments · May be fixed by #78039
Open
1 task done

pip editable=true doesn't work with multiple requirement names #77755

dehnert opened this issue May 8, 2022 · 2 comments · May be fixed by #78039
Labels
affects_2.12 bug This issue/PR relates to a bug. easyfix This issue is considered easy to fix by aspiring contributors. has_pr This issue has an associated PR. module This issue/PR relates to a module. P3 Priority 3 - Approved, No Time Limitation support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@dehnert
Copy link

dehnert commented May 8, 2022

Summary

When I pass editable: true and a list of names, I expect each package to be installed as editable. However, Ansible passes just one -e flag to pip, whereas the pip semantics appear to be "the next package listed is editable". This means that only the first package named is installed editable, whereas the Ansible structure (a single editable flag) suggests they all should be.

Issue Type

Bug Report

Component Name

pip

Ansible Version

$ ansible --version
ansible [core 2.12.2]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/alex/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /mnt/tipasa/home/alex/program/vcs/squaresdb/src/squaresdb/ansible/venv/lib/python3.8/site-packages/ansible
  ansible collection location = /home/alex/.ansible/collections:/usr/share/ansible/collections
  executable location = /mnt/tipasa/home/alex/program/vcs/squaresdb/src/squaresdb/ansible/venv/bin/ansible
  python version = 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0]
  jinja version = 3.0.3
  libyaml = True

Configuration

$ ansible-config dump --only-changed

OS / Environment

Ubuntu 20.04

Steps to Reproduce

Something like this should reproduce:

- name: Install virtualenv
  ansible.builtin.pip:
      name:
          - git+https://foo#egg=foo
          - git+https://bar#egg=bar
      editable: true
      virtualenv: /home/quux/venv

Expected Results

I expect this to run a command like pip3 install -e git+https://foo#egg=foo -e git+https://bar#egg=bar

Actual Results

Instead I get pip3 install -e git+https://foo#egg=foo git+https://bar#egg=bar.

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot
Copy link
Contributor

ansibot commented May 8, 2022

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.12 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels May 8, 2022
@dehnert
Copy link
Author

dehnert commented May 8, 2022

The best workaround is probably something like:

- name: Install virtualenv
  ansible.builtin.pip:
      name:
          - -egit+https://foo#egg=foo
          - -egit+https://bar#egg=bar
      virtualenv: /home/quux/venv

That is, ignore the editable Ansible option entirely and prefix each "package name" with a -e.

dehnert added a commit to tech-squares/squaresdb that referenced this issue May 9, 2022
Apparently Ansible and pip disagree on whether `-e` is a global flag or
a per-package flag (ansible/ansible#77755), so
we need to add a `-e` before each package instead.
@s-hertel s-hertel added P3 Priority 3 - Approved, No Time Limitation easyfix This issue is considered easy to fix by aspiring contributors. and removed needs_triage Needs a first human triage before being processed. labels May 10, 2022
nirmal-j-patel added a commit to nirmal-j-patel/ansible that referenced this issue Jun 12, 2022
When editable is set to true, -e flag should be passed to all packages.
This change passes -e flag before each package name. However, if a
requirements file is used, then editable flag raises errors. Therefore,
editable and requirements are now mutually exclusive.

Fixes ansible#77755

Signed-off-by: Nirmal Patel <nirmal@nirmal.dev>
@ansibot ansibot added the has_pr This issue has an associated PR. label Jun 12, 2022
nirmal-j-patel added a commit to nirmal-j-patel/ansible that referenced this issue Feb 4, 2023
When editable is set to true, -e flag should be passed to all packages.
This change passes -e flag before each package name. However, if a
requirements file is used, then editable flag raises errors. Therefore,
editable and requirements are now mutually exclusive.

Fixes ansible#77755

Signed-off-by: Nirmal Patel <nirmal@nirmal.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects_2.12 bug This issue/PR relates to a bug. easyfix This issue is considered easy to fix by aspiring contributors. has_pr This issue has an associated PR. module This issue/PR relates to a module. P3 Priority 3 - Approved, No Time Limitation support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants