cython

When would the python tracemalloc module allocations statistics not match what's shown in ps or pmap?

﹥>﹥吖頭↗ 提交于 2020-06-14 04:56:30
问题 I'm trying to track down a memory leak, so I've done import tracemalloc tracemalloc.start() <function call> # copy pasted this from documentation snapshot = tracemalloc.take_snapshot() top_stats = snapshot.statistics('lineno') print("[ Top 10 ]") for stat in top_stats[:10]: print(stat) This shows no major allocations, all memory allocations are pretty small, while I'm seeing 8+ GB memory allocated in ps and pmap (checking before and after running the command, and after running garbage

How to include .pyx file in python package

巧了我就是萌 提交于 2020-06-12 02:04:02
问题 I used cython in my packages pyirt, but when I published it to the pypi, the .pyx file is not included in the tar.gz I think it must has something to do with the setup file. However, I cannot find a solution to this problem. 回答1: You may want to add a MANIFEST.in file to the top level of your project and add following line: global-include *.pyx global-include *.pxd You can find valid commands for the MANIFEST.in file here. 来源: https://stackoverflow.com/questions/29227836/how-to-include-pyx

How to host cython web app on heroku?

我是研究僧i 提交于 2020-06-10 04:07:11
问题 At the current moment I'm playing with Cython and trying to figure out how I can host a Cython Flask app (for example) on heroku. Let's say my project looks like this (after cython compile): _/cythonheroku |-- requirements.txt |-- run.py |-- Procfile |__/app |-- __init__.py |-- app.c |-- app.cpython-36m-darwin.so |-- app.pyx Now, app.pyx has a standard Flask app in it with some cython adjustments, like so: #cython: infer_types=True from flask import Flask app = Flask(__name__) @app.route('/',

How to host cython web app on heroku?

两盒软妹~` 提交于 2020-06-10 04:07:04
问题 At the current moment I'm playing with Cython and trying to figure out how I can host a Cython Flask app (for example) on heroku. Let's say my project looks like this (after cython compile): _/cythonheroku |-- requirements.txt |-- run.py |-- Procfile |__/app |-- __init__.py |-- app.c |-- app.cpython-36m-darwin.so |-- app.pyx Now, app.pyx has a standard Flask app in it with some cython adjustments, like so: #cython: infer_types=True from flask import Flask app = Flask(__name__) @app.route('/',

How to remove -pthread compiler flag from cython setup file

此生再无相见时 提交于 2020-06-07 06:44:56
问题 In linux environment, when I run the setup script for cython, I get gcc -pthread -B /apps/.../compiler_compat -Wl,-sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/ap...... for my case, I want to remove the pthread option. How do I do that thru the cython setup file? I see there are options to add compiler flags but none to remove. My setup file: from distutils.core import setup from Cython.Build import cythonize from distutils.extension import Extension

How to remove -pthread compiler flag from cython setup file

与世无争的帅哥 提交于 2020-06-07 06:42:57
问题 In linux environment, when I run the setup script for cython, I get gcc -pthread -B /apps/.../compiler_compat -Wl,-sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/ap...... for my case, I want to remove the pthread option. How do I do that thru the cython setup file? I see there are options to add compiler flags but none to remove. My setup file: from distutils.core import setup from Cython.Build import cythonize from distutils.extension import Extension

Is it possible to use a Cython Extension Type in a nogil section?

﹥>﹥吖頭↗ 提交于 2020-06-01 05:06:47
问题 I have created a Cython Extension Type and I would like to use it in a nogil context. But the compiler always throws an error. Here is a simple example of what I'm trying to do: 1 # cython: language_level=3 2 3 from cython.parallel import prange 4 5 cdef class C1: 6 7 cdef public: 8 int val 9 10 def __cinit__(self, value): 11 self.val = value 12 13 def iterate_C1(): 14 15 cdef int i 16 cdef int N = 4 17 cdef C1 c1_i 18 19 # This compiles fine 20 c1 = C1(4) 21 print(f'c1.val={c1.val}') 22 23 #

Create package with cython so users can install it without having cython already installed

核能气质少年 提交于 2020-05-25 22:05:47
问题 I have a question. I would like to distribute my cython-powered packages, but I see no easy way to build them in setup.py. I would like setup.py to: most importantly: install my package without cython (from pre-generated C files or by installing cython beforehand) rebuild (run cythonize) package on sdist not need to hard-code list of my cython modules (just use glob or something) be able to work without .c files (should not be stored in git) or .pyx (might not be distributed). at least one of

Create package with cython so users can install it without having cython already installed

与世无争的帅哥 提交于 2020-05-25 22:03:58
问题 I have a question. I would like to distribute my cython-powered packages, but I see no easy way to build them in setup.py. I would like setup.py to: most importantly: install my package without cython (from pre-generated C files or by installing cython beforehand) rebuild (run cythonize) package on sdist not need to hard-code list of my cython modules (just use glob or something) be able to work without .c files (should not be stored in git) or .pyx (might not be distributed). at least one of

Create package with cython so users can install it without having cython already installed

浪子不回头ぞ 提交于 2020-05-25 22:03:55
问题 I have a question. I would like to distribute my cython-powered packages, but I see no easy way to build them in setup.py. I would like setup.py to: most importantly: install my package without cython (from pre-generated C files or by installing cython beforehand) rebuild (run cythonize) package on sdist not need to hard-code list of my cython modules (just use glob or something) be able to work without .c files (should not be stored in git) or .pyx (might not be distributed). at least one of