rules_pip icon indicating copy to clipboard operation
rules_pip copied to clipboard

add py_binary rule for console_scripts

Open chaoran opened this issue 7 years ago • 4 comments

Add py_binary rule if there is console_scripts entry_point defined for the package.

chaoran avatar Mar 22 '19 13:03 chaoran

ping @apt-itude would be a nice one to have

Globegitter avatar May 10 '19 08:05 Globegitter

@chaoran not sure if you also ran into the issues but it seems py_binary targets are causing issues, see: https://github.com/bazelbuild/bazel/issues/7091#issuecomment-492947750

Globegitter avatar May 16 '19 07:05 Globegitter

@Globegitter Yes, I just tried to run bazel run @pip_deps//pytest:bin-pytest. It gave me an error ImportError: module 'pytest' has no attribute 'main'. I was using a python library that happen to not use the same name for the library and binary file, which didn't cause me any trouble. But, anyway, I gradually start to realize that using python with bazel is lost hope. I'm waiting for Google to support python in bazel natively before I do something serious with it.

BTW I guess adding a genrule to rename the binary xxx.py file to bin-xxx.py would workaround the issue? I haven't tried it yet.

chaoran avatar May 16 '19 20:05 chaoran

@chaoran - the way I got around this is by providing a patch functionality to a forked version of rules_pip. See https://github.com/ecosia/rules_pip/commit/adce162d080a09452369b5d24aa3a797b6b6ec21

Yeah hopefully it keeps on improving over the coming weeks/months. Now with the toolchain support there is not much missing anymore from getting it to work nicely in an OSS environment.

Globegitter avatar Jun 18 '19 06:06 Globegitter