Stubgen during packaging #490
Replies: 2 comments
-
There is also |
Beta Was this translation helpful? Give feedback.
-
Running from bindir with cd'ing into src and running I'd argue that this is an issue because of the disparity between the source tree and the later package layout, i.e. src being mapped to root ("") in the This however is not stubgen's fault, since Python technically allows any source tree layout, but setuptools supports only two or so natively. I'm not sure if fixing up the paths with what is in the pyproject.toml is a good solution here, since it creates a data dependency to the package it's building. I'll see what I can do, sounds like the ball is in my court here. |
Beta Was this translation helpful? Give feedback.
-
I have a question (relevant to nanobind-bazel in a way) about stubgen.py.
Bazel puts the built .so extensions into a "bindir" (i.e. a bin/ folder under the output dir + symlink prefix), keeping the directory structure of where the BUILD files defined the extensions.
So in the case of the nanobind_example, the built extension will be in
$BINDIR/src/nanobind_example_ext.so
, which is one level above where it will eventually go (which isnanobind_example/nanobind_example_ext.so
, with the stub filenanobind_example/__init__.pyi
).If I do the following (pseudocode):
I get a single stub named "src.pyi" written directly to the BINDIR. How can I fix up the path mapping so that I
end up with files relative to the installed package's hierarchy? I can of course use the
-o
switch for a single file, but I'm not sure how to do this for multiple extensions.(I can also probably hack this together in setuptools, I was just wondering if there is a switch in stubgen that I missed that enables this.)
Beta Was this translation helpful? Give feedback.
All reactions