-
-
Notifications
You must be signed in to change notification settings - Fork 593
Allow controlling the prefix added to repos/packages #459
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
Conversation
a8c8fdf
to
e4c8663
Compare
python/pip.bzl
Outdated
**kwargs | ||
) | ||
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Buildifier got unhappy that there was no docstring here.
python/pip.bzl
Outdated
# Just in case our dependencies weren't already fetched | ||
pip_install_dependencies() | ||
|
||
if repo_prefix == None: | ||
repo_prefix = "{name}_pypi__".format(name = name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks @person142
PR Checklist
Please check if your PR fulfills the following requirements:
.par
files. 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_parse
is hard-coded to<pip-parse-name>_pypi__
and the prefix added to the generated packages forpip_install
is 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_parse
in particular you can make the external repository names more memorable:Does this PR introduce a breaking change?
Other information
None