Too big is better than incomplete. The main point is to make sure that we can take the exact code you used and compile it.
The trouble with leaving stuff out is that there's a good chance that a) the error is in what's left out and b) the answerer will get bored of "filling in the gaps" before they get to the answer.
What follows is specifically Cython related so doesn't apply too much to making an MRE in other languages:
You can usually cut a lot of it out.
C/C++ code can be included directly in your Cython file using
cdef extern from *:
"""
C/C++ code here is included directly in the source
"""
This can often eliminate both the C/C++ header and source file (remember that you don't have to have a separate declaration and definition - just include the definition). It also makes the compilation simpler. Even if you don't do this, it's often worth putting code inline in the header to save having to compile+link a separate C file.
.pxd files are used similarly to C/C++ headers - to share definitions between multiple source .pyx files. If you only have one .pyx file then you aren't sharing definitions so the contents of the .pxd file can go in the .pyx. (This is really the same as with .h and .c files)
If you can get it down to one source file then it can be compiled on the command-line cythonize -i name_of_sourcefile.pyx
. This saves reproducing a setup.py
. Do mention that you've done it this way.
The other things you mention are generally a good idea to include, especially the error message.
The final point worth making is that Cython has a three step process: 1) Use Cython to generate C code; 2) Compile the C code to a Python module; 3) Run that Python module. If the error is happening in step 1 then you don't necessarily need to include any C headers you use, or the Python file that you've eventually use to test it. (This information may be useful for context though).
Other people have it harder though: for writing graphics shaders there's a huge amount of boring setup code needed - I'm sure I've seen a meta question about this issue but I can't find it right now. Cython is "not that bad" in terms of code length for an MRE.