Skip to content

fix setup with extra packages specs using '<' or '>'. Always quote#54

Open
colonesej wants to merge 2 commits intodevelopfrom
fix/quote_packages_specs
Open

fix setup with extra packages specs using '<' or '>'. Always quote#54
colonesej wants to merge 2 commits intodevelopfrom
fix/quote_packages_specs

Conversation

@colonesej
Copy link
Copy Markdown
Collaborator

Description

Allow proper installation of pip or conda packages with < or > specs without bash wrong redirects.

environments:
   myvenv:
      type: venv
      extra_packages: ["setuptools>=77", "wheel", 'numpy==1.*]

now results in something like

pip install 'setuptools>=77' 'wheel' 'numpy==1.*'

previously, the setuptools spec would be passed wrongly to pip

pip install setuptools>=77 wheel numpy==1.*

Contributor Declaration

By opening this pull request, I affirm the following:

  • All authors agree to the Contributor License Agreement.
  • The code follows the project's coding standards.
  • I have performed self-review and added comments where needed.
  • I have added or updated tests to verify that my changes are effective and functional.
  • I have run all existing tests and confirmed they pass.

@oiffrig
Copy link
Copy Markdown
Contributor

oiffrig commented Nov 13, 2025

Just stumbled upon this by chance. You may want to use shlex.quote for something more robust

@colonesej
Copy link
Copy Markdown
Collaborator Author

Thank you for the suggestion @oiffrig , I did not know about that one. Will change the PR

@colonesej colonesej marked this pull request as draft November 13, 2025 10:53
@colonesej colonesej marked this pull request as ready for review November 14, 2025 14:59
@colonesej
Copy link
Copy Markdown
Collaborator Author

colonesej commented Nov 14, 2025

with shlex.quote it only quotes what is needed, so in the example above the output would be

pip install 'setuptools>=77' wheel 'numpy==1.*'

more robust and neater, thanks Olivier for the hint 👍🏼

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

Successfully merging this pull request may close these issues.

2 participants