Use blaze with pypi (pip) package

12 Apr 2017

We can utilize new_http_archive. In WORKSPACE, we have:

new_http_archive( name='yaml', url='', sha256='592766c6303207a20efc445587778322d7f73b161bd994f227adaa341ba212ab', build_file_content=""" py_library( name='yaml', srcs=glob(['yaml/**/*.py']), visibility = ['//visibility:public'], ) """, strip_prefix='PyYAML-3.12/lib' )

Then, in our BUILD, we can refer to the yaml with:

par_binary( ... deps=['@yaml//:yaml'] )

If we have a large number of packages, this can be really tedious…