Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I write most of my codes as Fortran extension to Python, using fantastic f2py tool.
However, it is sometimes difficult to catch the memory leaks, and profile the program (where the most time it is spent).
The question is:
Is there some simple way to debug and/or profile extensions (especially, f2py-generated) for Python?
Using valgrind seems to be complicated (I use MacOsX, and do not want to recompile the interpreter).
The only options that I have now is print - debugging + print - profile, which is time-consuming.
In case any others have the same problem but on Linux platforms (sorry, OS/X is not supported so I know this is not "the Answer" for you) - the Allinea tools can profile and debug the Fortran extensions called in Python, and see any memory leaks.
Compared to callgrind/kcachegrind, the profiler runs much faster (having max 5% slowdown typically) and it's much deeper as to why the code runs slow as it understands vectorization and running in real time means I/O profiling is accurate.
There's a blog exploring f2py extension debugging and profiling that introduces it.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
How to step into running a python program (in my case code which is already deployed to production), this issue is as follows, we are facing a specific functional issue, where one particular flow(lets call it Update to database flow) is resulting in an undesirable outcome.
We have 2 weeks deployment scheduled, only on critical cases, we have different schedules to be maintained.
i was looking for any specific modules(which could be handled through code) that cann be used for both python 2.x and python 3.x versions.
NOTE
This question was asked keeping in mind that the solution would/can be used in any running python code keeping 2.x and 3.x in mind, hence, was not very specific on one aspect of the code, as debugging is a common approach.
You can debug by adding breakpoints in the code.
for python3.7+:
breakpoint()
for python3.6 and below:
import pdb; pdb.set_trace()
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I have been using IDLE to program in python for the time being, and it is starting to get tedious to launch it from terminal. I have looked online to try to find a solution for this but haven't found out how to launch it in a typical Mac like way from spotlight (I have already tried putting it into the applications folder).
I am also open to any other suggestions for any better IDE's that work the same way as IDLE, with its own built in compiler.
Try Visual Studio Code, it comes with everything you need for Python development, including a feature to launch and test your program from the application.
It's free and open source, you can pick it up here :)
I prefer Pycharm IDE. It is a JetBrain Product
https://www.jetbrains.com/pycharm/
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
Could anyone point me an already available python snippet/script which can parse C/C++ code?
Basically I wanted to create an Class-to-Function() and Object-used-file-location-mapping etc., of a C/C++ source code using python, so that I can create a new level of abstraction of code in a script readable format, which can be used for Artificial Intelligence in the Code parsing..!
LLVM built with Clang will produce libclang for you which, luckily, happens to have great Python bindings right out of the box. Get the latest LLVM and Clang from the releases page, the current stable one being LLVM 6.0.0. Make sure you have the appropriate Python development dependencies and build all of it. Then you can use Clang's Tooling to do all sorts of things to transform or modify your source code, here's a good page to get you started.
I would suggest using Tooling instead of a hand rolled or generated parser especially for C++ due to its complexity. The library however handles it for you and allows you to transform or introspect the produced AST, letting you build on top of that.
No one will generally provide a fully working solution to a complex problem like you've presented, you will have to do the bulk of the work yourself, but those resources are great if you want to get started.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I am looking for open source implementations of python compilers written purely in Java, preferably those that support Python 3. I started with jython but it only supports Python 2.7. Thanks!
I don't believe such a thing exists yet. If it does its in pre-alpha and probably isn't stable or well documented. Jython is probably still your best bet, and apparently support for Python 3 is coming to Jython but the timetable is still unclear. See this stack overflow question for more on the subject.
However one advantage of Jython is that you can use any Java classes as if they were Python modules. What features were you planning on using that are only supported by Python 3? Because it is entirely possible (and actually very likely) that you can reproduce those features using Python 2.7, Java or a combo of the two.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
In Python 2 there's a couple of tools but everything seems to be old and out-of-dated.
I've found PySizer and Heapy but everything seems to be Python2 oriented and would take a lot of effort to port.
objgraph is interesting but still not a fully working profiler
Which tool are using ?
Pympler is a Python memory profiler that is compatible with both Python 2.x and Python3.x.
objgraph is compatible with Python 3
memprof works for Python3:
http://jmdana.github.io/memprof/
It will log and plot the memory footprint of all your variables.