-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Expand environment variables with default/fallback value in requirements.txt #5421
Comments
Some initial thoughts. Those substitutions are not familiar to people with a Windows background. Specifically, I've no idea without hunting out references what the difference is between I'd also be interested in seeing actual use cases. My recollection of the variable expansion feature was that it was motivated by the need to not hard code user credentials in |
Thanks for your feedback. I totally agree on the "it should be documented in pip doc rather than just saying 'go see POSIX doc'". Regarding a pip-specific syntax : I get your point, but I think defining a specific syntax would be an unneeded source of issues. For instance, the Regarding the use case for this: my case is quite specific, I want to use variable expansion to use a different Git remote for some developers. My broader point is "do not change developers habits if it does not add value for them". |
I'd consider that too specialised - the code needed to parse and handle the syntax you're suggesting is not trivial, and while the requirements format is technically pip-specific, other tools do try to parse it, so we would be making things harder for them, too.
I don't agree with that. Pip shouldn't cater for every single variation of user behaviour. Users need to work with the tool, not expect it to change to suit them. In this case, why shouldn't the users simply use a standard remote name (or have a script that modifies requirements files to match their needs)? I'd rather say that pip should focus on the common workflows and make them as smooth as possible. Non-standard workflows should be possible, but we shouldn't over-complicate support (or handling of the normal workflows) to cater for them. The other pip developers may disagree, of course - this is just my personal view. |
I agree. I'm also not convinced that the complexity that is being proposed to be added here is justified by the presented use cases. |
Based on the discussion above it looks like we will not be implementing this feature (without additional justification). For that reason I will close this issue. Please let us know if there are additional use cases or someone is interested in spending time implementing and reviewing this! |
What's the problem this feature will solve?
If I want to use the POSIX variable expansion feature in a
requirements.txt
file, every developer has to change its habits and export variables in its shell settings. I want existing developers to be able to continue developing on my project without changing anything in their settings.Describe the solution you'd like
Use POSIX defined variable substitions with default value,
${parameter:-word}
or/and${parameter-word}
.Alternative Solutions
Nothing coming to my mind
Additional context
POSIX reference : http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02
I can help implementing this, but I'd like to get some feedback from maintainers before putting some work on it and submitting a PR :)
The text was updated successfully, but these errors were encountered: