I'd like to customize certain classes in the sklearn library. Just looking through the sklearn GitHub, I don't see anything having to do with compilation steps. Do I only need to create new .pyx and .pxd files and reference those files instead of the sklearn files to make it work?
great video! can you please kindly give an update regarding the recent Cython 3.0 ? especially the pure python mode which looks very interesting! i am obsessed with speed, but I can only write Python (non-programming background). cheers!
Thank you for the tutorial. It is brief (sadly) and it is very useful. Especially for stubborn people like me, who needs fast scientific code but does not want to learn c++ .
Thank you for the tutorial. It has answered a few questions I've been looking at for optimization. By extension, the next two questions are: A) What considerations do I need to take in, when trying to compile a series of progs/libs so that the end result is an executable with minimal fuss, and B) What are your suggestions to apply multi-threading, or multi-processing to address problems that can be broken down into parallel runs? Thanks in advance.
(A): For compiling your code you should consider various things as: 1): Your code tends to be much mathematical 2): Has lots of loops that repeat the same operations many times 3): Make sure you have provided the Type information (B): For Multiprocessing, I will create a detailed video for that. So, be tuned!
8:34 If you're doing this on windows heres what you need to write: python setup.py build_ext -i --compiler= I tried doing it with MinGw but I couldn't figure out how to set it up properly and ended up downloading and installing Visual Studio(the visual studio IDE), when using visual studio as your compiler you should write python setup.py build_ext -i --compiler=msvc When installing visual studio, remember to include C++ compatability, otherwise I dont think it will work. Also, on windows you will get et .pyd file, not .so
good pacing, never got bored during the video! I would maybe focus a little on your pronunciation, i don't mean to be insensitive to your accent but with a little training you could make it easier for your audience to understand you. You can see where the automatically generated subtitles get confused. best of luck mate! (also, i know this might have been part of the aim of this video, but calculating the stdev using linear algebra would have been a fairer comparison to many data scientists, i would never code the calculation using for loops, instead statisticians would be using numpy matrix products. So now i wonder if what improvement you would have yielded if you used a more optimal formulation to begin with)
@HugoCool First of all, thanks for your kind words. You are right mate regarding the accent, I realized it at early stages and try my best to improve this thing, can you take a look at this latest video and provide your valuable feedback? Here’s the video link: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-jx5SlRi28DE.html
can you plz make a detailed video series on cython were you take some python examples & optimize it using cython. It would be a great serious to watch :)
I never understood why can't we save our code in binary and run it like that after we finished developing ? . The computer compiles our code to make binary any way . Right ? So why can't we save our projects like that after we finished developing it ?
not sure what you meant but the file that holds your code, main.py for example contains binary data for the text in your code. a compiled executable contains binary sequences that your processor interpretes as instructions instead
I think it depends on the project. I made a somewhat simple web scraper yesterday, and since the web requests slow me down more than optimization, I find no point in cythoning it. On the other hand, I have a project that looks through the machine code of files and tries to analyze what they do, and it is SLOW to the point you might as well just use virustotal and abandon the project
What is the best option to compile to C++ to make it faster and better obfuscate the C++ code at the end? Python obfuscation won't work and Pyarmor is only working with small filesizes
@Christian Weissmuller nah I now have bought Pyarmor full version then I made it Clientside obfuscated it and compiled it to a executable then I have customers the exefile that only has the code in it that acess my server and take the right code
Hi, thanks for the video. I wrote a simple hello world program in python and using your steps I compiled to get a .c and .so file. Now how can I directly compile and run this .c file to print hello world which is written in python def.Please advice, Thanks in advance.
To run this you can sue any C compiler like gcc and use the command as: gcc helloWorld.c But in this specific situation this build file will be utilized by python as an extension module.
@@Pythonist i tried the same but i am getting multiple errors. Maybe because the generated C file does not have a main method. Please suggest how can i run the generated .c file. Do i need write a separate .c file and call the generated .c file from there. Thanks in advance
Thank you for the tutorial. I try your codes on my system but the results were not the same. My runtime was 9 second for limit=1000 utilizing cython. Could you please let me know your system information like RAM, SSD, HDD, number of cores and etc.?
Firstly, Just add import "setuptools" as "import setuptools" at the very top, that will help Python and "C++ Compiler " work together. Secondly, If you are on windows, you many need to Install Microsoft Visual C++ Compiler for Python.
@@Pythonist This method worked, Thanks for your help... I have two more query, setup has created multiple files, how many of them are useful to import script. Can someone decrypt /decode my source code out of the file this process generates?
Setup has created the following files. C source file Exp file LIB file 3D object Python extension module How many of these are useful to run the script successfully?
This can be decoded but if security is your concern then you can make the process of decryption near to impossible by some tweaks, also you the extension model file .so can be utilized in this case.
If i try to import the numpy module inside the file.pyx I get an error. Without importing numpy the script works. Unfortunately I need to import several modules like scipy and so on and using them as simple python modules. How can I do?
If you are using Numpy's array then you have to import in this way: import numpy as np cimport numpy as np and must call this method: np.import_array()