ali5h / rules_pip

pip package rules for bazel that are fast (incremental fetch), support different python versions and work with all kinds of packages (i.e. packages with namespaces)
MIT License
60 stars 23 forks source link

Pull in importlib_resources 3.2.0 for py3.5 and 3.6 #75

Closed fahhem closed 2 years ago

fahhem commented 2 years ago

importlib.resources is added in py3.7, but py3.5 and 3.6 don't have it. Technically, they are EoL'd, so if you don't want to support this that's fine, but we'll have to support it internally via this patch.

This PR also does a few things that I can split out if you prefer:

fahhem commented 2 years ago

ready for review

ali5h commented 2 years ago

I don't think we need to add the support for EOL pythons

ali5h commented 2 years ago

@fahhem can we find a way to access the entrypoint like @pkg//bin/:script? would there be any shadowing issue in that case?

fahhem commented 2 years ago

I tried, but the filename is already bin/x and I can't call it bin/x.py otherwise it will import itself. @pkg//:bin-script is the best I could do

ali5h commented 2 years ago

looks good, do we use importlib_resources anywhere?

ali5h commented 2 years ago

looks like all the changes to third_party can be reverted?

fahhem commented 2 years ago

I need 3.6 support at work, we have a customer that won't upgrade :/

ali5h commented 2 years ago

but i don't see it imported anywhere. is that ok?

fahhem commented 2 years ago

It's used in third_party/py/installer/scripts.py: https://github.com/ali5h/rules_pip/pull/75/files#diff-5df66d4ca225891ccf85b4ac26e40045a6724ad3eaca8ed511bc1a8867b72f00

ali5h commented 2 years ago

so you manually edited that file? Everything in third_party/py must exactly match the upstream. and also added to src/requirements.txt, basically pip install -t third_party/py -r "src/requirements.txt" --no-deps -U should result in no change to the repo.

ali5h commented 2 years ago

i took the liberty and rebased this branch on master, which i added a test for checking the integrity of third_party/py

fahhem commented 2 years ago

oh, thanks!

fahhem commented 2 years ago

okay, I found a way to support python 3.5+ by using an older installer instead