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='https://pypi.python.org/packages/4a/85/db5a2df477072b2902b0eb892feb37d88ac635d36245a72a6a69b23b383a/PyYAML-3.12.tar.gz', 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…

Give it a kudos