Allow controlling the prefix added to repos/packages - #459
Conversation
a8c8fdf to
e4c8663
Compare
|
|
||
| def pip_parse(requirements_lock, name = "pip_parsed_deps", **kwargs): | ||
| def pip_parse(requirements_lock, name = "pip_parsed_deps", repo_prefix = None, **kwargs): | ||
| """Generate external repositories for each entry in a requirements lockfile. |
There was a problem hiding this comment.
Buildifier got unhappy that there was no docstring here.
| pip_install_dependencies() | ||
|
|
||
| if repo_prefix == None: | ||
| repo_prefix = "{name}_pypi__".format(name = name) |
There was a problem hiding this comment.
Without the parent repo name in the repo_prefix these repositories won't be unique, and if users have multiple instances of pip_parse with the same repo_prefix they could collide. I'm not sure I'm in favor of allowing that.
There was a problem hiding this comment.
We could move to a pattern like <repo-name>_<pkg-name>-my biggest objective is to have short, memorable names that are easy to refer to by label.
There was a problem hiding this comment.
i.e. most of all I want to solve #414, which just so happens to be easier in the pip_parse case than the pip_install case...
There was a problem hiding this comment.
@person142 if we can make these repo names unique using <repo-name>_<pkg-name> Where is the PEP503 canonical package name I think thats a good soln.
There was a problem hiding this comment.
👍 Should have some time to make the change today.
|
What's the status of this PR? In monorepos with a lot of packages controlling that prefix can be a life saver. |
|
@thundergolfer would you be willing to review this if I updated the PR? We currently have a bad alternative to this as a patch in our repo so I'd prefer to have it clean from mainstream. |
|
I can update this if desired/needed-just don't have the bandwidth right now to rally support for a particular solution. |
|
@thekyz @person142 taking another look at this today. If we can resolve the naming collision issue I'll be happy to ship. |
e4c8663 to
d296da6
Compare
d296da6 to
b855757
Compare
|
@hrfuller refactored so that the repos for |
PR Checklist
Please check if your PR fulfills the following requirements:
.parfiles. See CONTRIBUTING.md for infoPR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number:
Currently the prefix added to the generated repos for
pip_parseis hard-coded to<pip-parse-name>_pypi__and the prefix added to the generated packages forpip_installis hard-coded topypi__.What is the new behavior?
Allow the user to control the prefix. You still need some prefix to avoid #414 (comment), but for
pip_parsein particular you can make the external repository names more memorable:Does this PR introduce a breaking change?
Other information
None