https://pantsbuild.org/ logo
#general
Title
# general
p

plain-carpet-73994

05/10/2021, 11:43 PM
Hey - I'm trying to add some type stubs to my build and having issues. I've added a
type_stubs
directory to the root of my repo and added the following to my `pants.toml`:
Copy code
[source]
root_patterns = ['/', 'type_stubs']
I added a
BUILD
file in `type_stubs`:
Copy code
$ cat type_stubs/BUILD 
python_requirement_library(
   name = 'numpy_stubs',
   requirements=[
      'numpy-stubs@ git+<https://github.com/numpy/numpy-stubs@c49d2d6875971a669a166ea93ef998911af283a1>'
   ]
)
That didn't cause any errors but mypy didn't pick up the stubs for numpy so I also added this to my
BUILD
target that uses `numpy`:
Copy code
python_library(
   dependencies=[
      '//type_stubs/:numpy_stubs'
   ]
)
which causes the following error:
Copy code
Exception message: 1 Exception encountered:

  InvalidSpecPath: Address spec has un-normalized path part 'type_stubs/'
Removing the leading
//
didn't help either. What am I doing wrong? And, is there an easier way to add stubs for things like numpy?
4 Views