Accept third alternative for --index command line option for name and url #5573
Labels
Contributor Candidate
The issue has been identified/triaged and contributions are welcomed/encouraged.
Type: Enhancement 💡
This is a feature or enhancement request.
Is your feature request related to a problem?
Again, this is related to solving the larger problem that pipenv-generated Pipfiles consistently have to be edited for private indices.
Specifically, the current method to generate a name for a source index based on the URL passed by --index produces some unfavorable results. The current method merely removes periods and squishes the various parts of the URL into one blob word.
Describe the solution you'd like
While I'm okay with the alternative I mention below, I think the better solution would be to give users the ability to specify the name at the command line, e.g.
--index="myorg-pypi=https://internal.myorg.com/pypi/simple"
or
--index=myorg-pypi:https://internal.myorg.com/pypi/simple
The current logic for exclusively index name or index URL could remain.
When both are provided, the name and URL could be checked against the existing sources as in the current logic and, if either exists but the source differs in the other element, the current source info could be updated; if both elements match, it would be considered an existing source; otherwise, the new source with user-specified name is added.
Describe alternatives you've considered
An alternative to adding another input type for --index could be to truncate the URL at the first "." before appending, when duplicate, the unique identifier. This would require changing the appropriate line (project.py: 956) from .replace(".", "") to .split(".")[0].
Additional context
Again, I am happy to implement these changes, based on which one is desired, and create a pull request. I have tested the alternative locally already since it's the easiest to implement and was happy with the results. However, other users may wish to have the option to select the name when creating Pipfile from pipenv with --index.
The text was updated successfully, but these errors were encountered: