-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactoring into C library + Python interface? #2296
Comments
I think you are seriously underestimating how big of an effort that would be. :) It's not only about making the C extensions return generic C types instead of Python types (there's a Java lib called cigar which does this), but also providing decent support support for those languages: redesigning APIs, documenting them, writing tests for those languages, add CI, (possibly) distribute binaries etc. Above all: be ready to handle and keep up with the new influx of bug reports and PRs, which considering psutil's numbers are probably gonna be a lot. Another thing to consider is that a rewrite of that size would almost certainly introduce regressions to the existing 15+ years old Python implementation, especially on Linux (which is the major platform), since the parsing of /proc would have to be rewritten from scratch in C. It's not something I never thought about doing (I did), but I know it would end up being a full-time job in the literal sense, which would also probably require a team of people. |
I was thinking of just refactoring psutils to have a C-callable API, and then adding a Julia interface. Other languages would be on their own to add a wrapper.
Ah, I see, I thought everything for Linux was in |
It would be nice to be able to use this from other languages, such as Julia, without requiring a Python dependency. Since the core functionality here is already implemented in C, would you ever consider refactoring it into a Python-independent C library + a Python interface, so that non-Python languages could call the C library directly?
I realize that this is a nontrivial amount of work because currently your C code is intertwined with calls to libpython, but it seems (at first glance) like something that would be doable in a week or two. (Or is there some major obstacle I'm missing?) I'd be willing to help, but only if this is something that would interest you.
The text was updated successfully, but these errors were encountered: