Hi! I'm working on my own Python build backend, and I use ninja to build Python extensions configured in pyproject.toml.
Currently I'm vendoring ninja's file writer module, just as you are doing here:
|
install(FILES "${ninja_SOURCE_DIR}/misc/ninja_syntax.py" COMPONENT python DESTINATION ninja) |
It works just as you would expect, but requires a user installation of ninja on the host machine. To improve the UX, I filed nicholasjng/hanzo#4 as a ticket to pick up a PyPI dependency on ninja, to at least have a fallback in place in case the user does not have ninja installed.
uv add ninja works fine, but I get type checker errors because the ninja_syntax.pyi stub does not match ninja's actual writer class at least in a couple of places: In the Writer.__init__, where output is a TextIOWrapper in ninja proper, but is type-hinted as a str by this package, and in Writer.build(), where outputs is hinted as a List[str], but the writer does in fact accept a Union[str, List[str]].
I can supply a fix if that's of interest. Thanks!
Hi! I'm working on my own Python build backend, and I use ninja to build Python extensions configured in
pyproject.toml.Currently I'm vendoring ninja's file writer module, just as you are doing here:
ninja-python-distributions/CMakeLists.txt
Line 37 in b363f69
It works just as you would expect, but requires a user installation of
ninjaon the host machine. To improve the UX, I filed nicholasjng/hanzo#4 as a ticket to pick up a PyPI dependency onninja, to at least have a fallback in place in case the user does not have ninja installed.uv add ninjaworks fine, but I get type checker errors because theninja_syntax.pyistub does not matchninja's actual writer class at least in a couple of places: In theWriter.__init__, whereoutputis aTextIOWrapperin ninja proper, but is type-hinted as astrby this package, and inWriter.build(), whereoutputsis hinted as aList[str], but the writer does in fact accept aUnion[str, List[str]].I can supply a fix if that's of interest. Thanks!