scele / rules_python

Experimental Bazel Python Rules
Apache License 2.0
2 stars 8 forks source link

FR: install requirements.txt wheels in a site-packages directory #24

Open therc opened 5 years ago

therc commented 5 years ago

Right now, each wheel is extracted directly in the runfiles directory, e.g. foo.runfiles/pip__nvidia_ml_py_375_53/. If you use a tool like isort, it checks paths for the presence of e.g. "site-packages" to figure whether it's a first party or third party module. Everything will appear as being first-party code.

If e.g. the wheel would be extracted under foo.runfiles/site-packages/pip__nvidia_ml_py_375_53/, isort would get things right (and there would be less clutter at the top level). Is it feasible to add such an option? The cost of this, of course, is an extra directory and longer file paths. Perhaps it could be activated only when you run an isort rule, i.e. not for every single py target.

therc commented 5 years ago

This is the isort code, for the record: https://github.com/timothycrosley/isort/blob/develop/isort/finders.py#L151