benley / bazel_rules_pex

Python PEX rules for Bazel
Apache License 2.0
39 stars 36 forks source link

add support for no-index, requirements files, and repo paths #40

Closed georgeliaw closed 7 years ago

georgeliaw commented 7 years ago

Needed to update the pex_binary rules to keep the clutter down in the BUILD files and make them easier to maintain. Figured I should open a PR in case you would like to pull this into master.

georgeliaw commented 7 years ago

@benley gave the URL --repo some thought. I think there's more complexity to that task than would fit into the scope of this PR. For the time being, users should be able to pull packages in via http_file in their workspace (possibly wrap it up into a filegroup) and load it into either the eggs or repos params. Have not tried that out myself, but this way they would be able to benefit from checksum enforcement.

Anything nicer would probably require writing new workspace rules for like pypi_server to set the url and pypi_package to set package name/checksum. Not sure that work is worth doing at the moment if we can use the workaround above.

For the time being, we can consider the PR ready to merge unless there are any changes you would like me to make.

EDIT: I see we both seem to agree on new workspace rules being the nicer option to implement from looking at https://github.com/benley/bazel_rules_pex/pull/20. We can probably look at that at a later point in time.

georgeliaw commented 7 years ago

@benley I just recalled that requirements files themselves can be used to point to other repo urls, so technically this is already supported. Again, obviously not the greatest practice when it comes to Bazel, but the use-case is available. https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format

Pip since version 8.0 also supports hash checking, which we could try enforcing to improve the build determinism: https://pip.pypa.io/en/stable/reference/pip_install/#hash-checking-mode

This technically means we wouldn't have to go down the workspace rule route.

What are your thoughts on this?

benley commented 7 years ago

Oh cool, that is a good point. I completely forgot about this PR, sorry about that!