Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Understanding Cython Code Implementation#29899

Unanswered
shashank3009 asked this question inQ&A
Discussion options

I have started going through the codebase for Random Forest Implementation (RandomForestClassifier). I usually use the debugger in py files, add the breakpoints, and go through line by line printing the variables simultaneously to understand the code logic and code flow. Since the core logic part is written in Cython, The code (running Random Forest Classifier from a .py file) is unable to step into the Cython code. The only option that I have is to manually go through the Cython code (without debugger) or use print() statements which will be lengthier. I want help with two things (Any additional pointers are also welcome).

  1. Is there a better way to understand the code base?
  2. What all methods do the contributors use to test/debug the code implementation in Cython given that the main call happens from .py files?
You must be logged in to vote

Replies: 3 comments

Comment options

I have never done it myself, but I think there are ways to setup a debugger for mixed Python/Cython debugging for example see thisblog post.

TheCython documentation may have some useful info although part of it is out-of-date for example the part where it says Python 2 is needed, seecython/cython#4911.

There are also some reports of people managing to do it insideVSCode.

If you manage to do it, I think it would be great if you post how to do it because I am guessing this would be useful for others 🙏.

You must be logged in to vote
0 replies
Comment options

@lesteve thanks for your response. I will try out these. (On a high level it looks we need to run the py debugger and the gdg (or cygdb) independently). But since you have mentioned that you haven't tried or did this, I will keep this thread open.

You must be logged in to vote
0 replies
Comment options

I am in a similar boat debugging the K-D trees function calls from my user program. Unfortunately I did not get very far with PDB, all I saw was a step into a utility file and a function named checkarray. I also had no idea what was Cython and/or Python code

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
3 participants
@shashank3009@lesteve@antonskal

[8]ページ先頭

©2009-2025 Movatter.jp