tl;dr: How ought one fix file tracing paths for Cython coverage? Hello y'all,
I'm currently trying to integrate C code into the GRPC Python project wherein said code is outside of my control, and belonging to the umbrella GRPC project. The Python+Cython code exists in a subdirectory (i.e. the package_dirs for setup.py includes an entry '': 'src/python/grpcio'). Everything works great, *except* for the Cython coverage plugin. For some strange reason, when the _c_files_map of the Plugin object is created, it appears to assume that the files it's reading are coming directly off of the invocation site of coverage.py as opposed to where the files actually are. Going a bit deeper: in the generated .c file for the .pyx, the package directory stem 'src/python/grpcio' is missing from comments on __Pyx_TraceLine(...): /* "grpc/_cython/cygrpc.pyx":53 * grpc_shutdown() * * _module_state = _ModuleState() # <<<<<<<<<<<<<< * */ This doesn't appear to be a problem for .pxi files, however: /* "src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi":32 * cimport cpython * * import time # <<<<<<<<<<<<<< * * */ We cannot simply move the Cython files around to being relative to umbrella root, as that would involve changing the umbrella project structure beyond the parameters of our current desiderata. I'm currently working around this problem by just ignoring the .pyx file (it contains little code anyway), and keeping only the .pxi files. I'd like to fix this (it doesn't seem difficult), but haven't looked into where one ought to start yet. An aside: we're using .pxi files instead of .pxds now due to some inexplicable behavior wherein a .pxd induces an expectation that a module exists when it doesn't. We're not splitting the extension out into multiple modules because there must now be only one copy of the statically linked gRPC core (wherein static linkage is among recent desiderata for distribution purposes). Context: https://github.com/grpc/grpc/tree/350345ffc70c93295ad5b78b306f9668a6332589 (steps to see what's happening: make; CONFIG=opt ./tools/run_tests/run_python.sh. The relevant C file may be examined under src/python/grpcio/grpc/_cython following the build). Thanks for reading!
_______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel