notes/.config/newsboat/reddit_rss/Cython.rss
2023-01-28 05:22:19 -08:00

1 line
No EOL
44 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/"><category term="Cython" label="r/Cython"/><updated>2023-01-28T12:52:28+00:00</updated><icon>https://www.redditstatic.com/icon.png/</icon><id>/r/Cython.rss</id><link rel="self" href="https://www.reddit.com/r/Cython.rss" type="application/atom+xml" /><link rel="alternate" href="https://www.reddit.com/r/Cython" type="text/html" /><title>The Cython Programming Language</title><entry><author><name>/u/monk2413</name><uri>https://www.reddit.com/user/monk2413</uri></author><category term="Cython" label="r/Cython"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;I&amp;#39;m new to Cython extensions but just created my first one that is a wrapper around an already existing C++ library. I&amp;#39;ve got everything working great except when I try to use my package I get no IntelliSense hints. Looking at the installed package files this makes sense because all that is distributed with it are .so and .pyd files and a single &lt;strong&gt;init&lt;/strong&gt; file. I&amp;#39;m hoping one of you Cython experts can help me figure out the proper way to do that or point me to any guides or documentation that might help. Thanks in advance!&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;https://github.com/ruggedscience/sdk-python&quot;&gt;GitHub Repo&lt;/a&gt;&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/monk2413&quot;&gt; /u/monk2413 &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/yqr9kn/cython_extension_intellisense/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/yqr9kn/cython_extension_intellisense/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_yqr9kn</id><link href="https://www.reddit.com/r/Cython/comments/yqr9kn/cython_extension_intellisense/" /><updated>2022-11-09T18:31:35+00:00</updated><published>2022-11-09T18:31:35+00:00</published><title>Cython Extension IntelliSense</title></entry><entry><author><name>/u/YoannB__</name><uri>https://www.reddit.com/user/YoannB__</uri></author><category term="Cython" label="r/Cython"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;example : &lt;/p&gt; &lt;p&gt;warning: HomingMissile\Sprites.pyx:566:4: Overriding cdef method with def method.&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/YoannB__&quot;&gt; /u/YoannB__ &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/yj7mft/is_it_possible_to_suppress_cython_warning_in_that/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/yj7mft/is_it_possible_to_suppress_cython_warning_in_that/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_yj7mft</id><link href="https://www.reddit.com/r/Cython/comments/yj7mft/is_it_possible_to_suppress_cython_warning_in_that/" /><updated>2022-11-01T12:38:25+00:00</updated><published>2022-11-01T12:38:25+00:00</published><title>Is it possible to suppress cython warning ? In that case Overriding cdef warning</title></entry><entry><author><name>/u/Fun_Signature_9812</name><uri>https://www.reddit.com/user/Fun_Signature_9812</uri></author><category term="Cython" label="r/Cython"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;I&amp;#39;m new to Cython, so I&amp;#39;m trying to test basic functionalities. I&amp;#39;m currently trying to create a function to read integer arrays from Python and display their elements. I&amp;#39;m trying to use c syntax for this, and I have made a function, but getting errors when I&amp;#39;m trying to build the extension.&lt;/p&gt; &lt;p&gt;Code of pyx file:&lt;/p&gt; &lt;pre&gt;&lt;code&gt;from libc.stdio import printf cpdef void read_array(int num[]): cdef int size = (int) (sizeof(num)/sizeof(num[0])); cdef int loop = 0; while(loop&amp;lt;size): printf(&amp;quot;%d&amp;quot;,num[loop]) &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;Error Message:&lt;/p&gt; &lt;pre&gt;&lt;code&gt;Compiling hello.pyx because it changed. [1/1] Cythonizing hello.pyx Error compiling Cython file: ------------------------------------------------------------ ... from libc.stdio import printf cpdef void read_array(int num[]): ^ ------------------------------------------------------------ hello.pyx:3:22: Cannot convert Python object argument to type &amp;#39;int *&amp;#39; Traceback (most recent call last): File &amp;quot;D:\Cython Demo\setup.py&amp;quot;, line 5, in &amp;lt;module&amp;gt; ext_modules=cythonize( File &amp;quot;D:\HTTP Requests\.venv\lib\site-packages\Cython\Build\Dependencies.py&amp;quot;, line 1127, in cythonize cythonize_one(*args) File &amp;quot;D:\HTTP Requests\.venv\lib\site-packages\Cython\Build\Dependencies.py&amp;quot;, line 1250, in cythonize_one raise CompileError(None, pyx_file) Cython.Compiler.Errors.CompileError: hello.pyx &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;Can anyone please let me know, how I should change my code to read integer arrays and display the elements?&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/Fun_Signature_9812&quot;&gt; /u/Fun_Signature_9812 &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/wh2lb8/cython_read_integer_array_from_python_script/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/wh2lb8/cython_read_integer_array_from_python_script/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_wh2lb8</id><link href="https://www.reddit.com/r/Cython/comments/wh2lb8/cython_read_integer_array_from_python_script/" /><updated>2022-08-05T18:24:20+00:00</updated><published>2022-08-05T18:24:20+00:00</published><title>Cython read integer array from python script</title></entry><entry><author><name>/u/patrickbrianmooney</name><uri>https://www.reddit.com/user/patrickbrianmooney</uri></author><category term="Cython" label="r/Cython"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;Still relatively new to Cython, and I only partly understand what&amp;#39;s going on here. I&amp;#39;d appreciate your help.&lt;/p&gt; &lt;p&gt;In converting an application to partially use Cython, I&amp;#39;m discovering that passing instances of the Python &lt;code&gt;bytearray&lt;/code&gt; back and forth between Python and Cython isn&amp;#39;t working the way that I expect it to. It seems like the Cython code is interpreting the numeric values of the bytearrays differently than the Python code?&lt;/p&gt; &lt;p&gt;Here&amp;#39;s a minimal reproducable example:&lt;/p&gt; &lt;h1&gt;bytes_test.pyx:&lt;/h1&gt; &lt;pre&gt;&lt;code&gt;#!/usr/bin/env python3 # -*- coding: utf-8 -*- # cython: language_level=3 &amp;quot;&amp;quot;&amp;quot;Quick test for how Cython handles bytearrays. &amp;quot;&amp;quot;&amp;quot; def test() -&amp;gt; bytearray: b = bytearray(range(33, 65)) print(b) print([w for w in b], f&amp;#39;\tlength: {len(b)}&amp;#39;) print() return b &lt;/code&gt;&lt;/pre&gt; &lt;h1&gt;bytes_harness.py&lt;/h1&gt; &lt;pre&gt;&lt;code&gt;#!/usr/bin/env python3 # -*- coding: utf-8 -*- &amp;quot;&amp;quot;&amp;quot;Simple harness for running bytes_test.pyx. &amp;quot;&amp;quot;&amp;quot; import pyximport; pyximport.install() import bytes_test as bt if __name__ == &amp;quot;__main__&amp;quot;: b = bt.test() print([w for w in b], f&amp;#39;\tlength: {len(b)}&amp;#39;) print(b) &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;This produces the incongruous output:&lt;/p&gt; &lt;pre&gt;&lt;code&gt;bytearray(b&amp;#39;!&amp;quot;#$%&amp;amp;\&amp;#39;()*+,-./0123456789:;&amp;lt;=&amp;gt;?@&amp;#39;) [48, 80, 112, 144, 176, 208, 240, 16, 48, 80, 112, 144, 176, 208, 240, 16, 48, 80, 112, 144, 176, 208, 48, 80, 112, 144, 176, 208, 240, 16, 48, 80] length: 32 [33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64] length: 32 bytearray(b&amp;#39;!&amp;quot;#$%&amp;amp;\&amp;#39;()*+,-./0123456789:;&amp;lt;=&amp;gt;?@&amp;#39;) &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;... in which the numeric values in the arrays don&amp;#39;t match up.&lt;/p&gt; &lt;p&gt;This is under x64 Linux, but I&amp;#39;d like to avoid introducing an unnecessary dependency to that system.&lt;/p&gt; &lt;p&gt;Is there something different I should be doing to pass around arrays of unsigned eight-bit integers besides using bytearrays? I&amp;#39;d like to avoid introducing an otherwise unnecessary dependency on Numpy just to get its array type.&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/patrickbrianmooney&quot;&gt; /u/patrickbrianmooney &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/wep60b/trouble_with_bytearrays_during_cython_conversion/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/wep60b/trouble_with_bytearrays_during_cython_conversion/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_wep60b</id><link href="https://www.reddit.com/r/Cython/comments/wep60b/trouble_with_bytearrays_during_cython_conversion/" /><updated>2022-08-02T22:28:52+00:00</updated><published>2022-08-02T22:28:52+00:00</published><title>Trouble with bytearrays during Cython conversion</title></entry><entry><author><name>/u/raghavadhanya</name><uri>https://www.reddit.com/user/raghavadhanya</uri></author><category term="Cython" label="r/Cython"/><content type="html">&amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/raghavadhanya&quot;&gt; /u/raghavadhanya &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://ai.ragv.in/posts/python-with-a-dash-of-cpp-optimizing/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/vvxbi6/python_with_a_dash_of_c_optimizing_recommendation/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_vvxbi6</id><link href="https://www.reddit.com/r/Cython/comments/vvxbi6/python_with_a_dash_of_c_optimizing_recommendation/" /><updated>2022-07-10T18:09:18+00:00</updated><published>2022-07-10T18:09:18+00:00</published><title>Python with a Dash of C++: Optimizing Recommendation Serving</title></entry><entry><author><name>/u/rigrg</name><uri>https://www.reddit.com/user/rigrg</uri></author><category term="Cython" label="r/Cython"/><content type="html">&amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/rigrg&quot;&gt; /u/rigrg &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/vsxftg/how_can_i_create_a_typed_memory_view_of_shape_mn/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/vsxftg/how_can_i_create_a_typed_memory_view_of_shape_mn/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_vsxftg</id><link href="https://www.reddit.com/r/Cython/comments/vsxftg/how_can_i_create_a_typed_memory_view_of_shape_mn/" /><updated>2022-07-06T18:53:26+00:00</updated><published>2022-07-06T18:53:26+00:00</published><title>How can I create a typed memory view of shape (m,n)</title></entry><entry><author><name>/u/Alpharou</name><uri>https://www.reddit.com/user/Alpharou</uri></author><category term="Cython" label="r/Cython"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;I&amp;#39;m learning python and cython at the same time, and found the Pure Python syntax very nice for linting purposes, but in my case it comes with a consistent 15% performance hit against standand cython.&lt;/p&gt; &lt;p&gt;Am I missing something?&lt;/p&gt; &lt;p&gt;Pure Python (compiled): pure_math.py&lt;/p&gt; &lt;pre&gt;&lt;code&gt;# cython: language_level = 3 # cython: cdivision = True import cython as cy @cy.returns(cy.ulonglong) @cy.locals(num=cy.uint, result=cy.ulonglong, i=cy.uint) def factorial(num): result = 1 for i in range(num, 1, -1): result *= i return result &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;Standard Cython: c_math.pyx&lt;/p&gt; &lt;pre&gt;&lt;code&gt;#!python #cython: language_level=3, cdivision = True def factorial(unsigned int num): cdef unsigned long long result = 1 cdef unsigned int i for i in range(num, 1, -1): result *= i return result &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;Using this benchmark in python: example.py&lt;/p&gt; &lt;pre&gt;&lt;code&gt;import c_math #type: ignore import pure_math from timeit import timeit fact_num = 20 #This results in an almost capped ulonglong def c_factorial_wrapper(): c_math.factorial(fact_num) return def pure_factorial_wrapper(): pure_math.factorial(fact_num) return c_factorial_time = timeit(c_factorial_wrapper, number= 2_000_000) print(f&amp;quot;Cython {fact_num} factorial: {c_factorial_time:.2f} s&amp;quot;) pure_factorial_time = timeit(pure_factorial_wrapper, number = 2_000_000) print(f&amp;quot;Pure Python {fact_num} factorial: {pure_factorial_time:.2f} s&amp;quot;) print(f&amp;quot;Pure/C: {pure_factorial_time/c_factorial_time * 100:.2f}%&amp;quot;) print(c_math.factorial(fact_num)) print(pure_math.factorial(fact_num)) &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;And the results:&lt;/p&gt; &lt;pre&gt;&lt;code&gt;Cython 20 factorial: 0.20 s Pure Python 20 factorial: 0.23 s Pure/C: 115.45% 2432902008176640000 2432902008176640000 &lt;/code&gt;&lt;/pre&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/Alpharou&quot;&gt; /u/Alpharou &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/ur2end/huge_performance_hit_by_using_pure_python/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/ur2end/huge_performance_hit_by_using_pure_python/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_ur2end</id><link href="https://www.reddit.com/r/Cython/comments/ur2end/huge_performance_hit_by_using_pure_python/" /><updated>2022-05-16T18:20:33+00:00</updated><published>2022-05-16T18:20:33+00:00</published><title>Huge performance hit by using Pure Python</title></entry><entry><author><name>/u/apfejes</name><uri>https://www.reddit.com/user/apfejes</uri></author><category term="Cython" label="r/Cython"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;Hi all, &lt;/p&gt; &lt;p&gt;I have a question that my group has been struggling with for a bit of time, and thought I could count on some expert advice.&lt;/p&gt; &lt;p&gt;We&amp;#39;ve moved a bunch of python functions into cython, by creating them with cdef instead of def. However, in doing so, we have left the constructor with specific parameters.&lt;/p&gt; &lt;p&gt;eg. &lt;/p&gt; &lt;p&gt;in the .pxd file:&lt;/p&gt; &lt;pre&gt;&lt;code&gt;cdef class Quaternion: &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;cdef public double w cdef public double x cdef public double y cdef public double z&lt;/p&gt; &lt;p&gt;and in the .pyx:&lt;/p&gt; &lt;pre&gt;&lt;code&gt;cdef class Quaternion: &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;def &lt;strong&gt;init&lt;/strong&gt;(self, w=-0.0, x=0.0, y=0.0, z=0.0): self.w = w self.x = x self.y = y self.z = z&lt;/p&gt; &lt;p&gt;However, if we create the object elsewhere in the code, and then run cythonize, we always get a LOT of cruft created in the .html, and the line is shown in solid yellow because of all of the python operations in the back.&lt;/p&gt; &lt;p&gt;The only work around we&amp;#39;ve found for this is to create the object on a separate line and then pass in the values one by one. It looks terrible, and can&amp;#39;t possibly the the only solution. &lt;/p&gt; &lt;p&gt;eg:&lt;/p&gt; &lt;pre&gt;&lt;code&gt;cdef qu = Quaternion() qu.q = value1 qu.x = value2 qu.y = value3 qu.z = value4 &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;What are we missing? Can anyone shed light on what&amp;#39;s going on?&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/apfejes&quot;&gt; /u/apfejes &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/sjyxa5/question_about_cython_cdef_objects_and_ugly_code/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/sjyxa5/question_about_cython_cdef_objects_and_ugly_code/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_sjyxa5</id><link href="https://www.reddit.com/r/Cython/comments/sjyxa5/question_about_cython_cdef_objects_and_ugly_code/" /><updated>2022-02-04T00:18:22+00:00</updated><published>2022-02-04T00:18:22+00:00</published><title>Question about cython (cdef) objects and ugly code generated</title></entry><entry><author><name>/u/unix21311</name><uri>https://www.reddit.com/user/unix21311</uri></author><category term="Cython" label="r/Cython"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;Hi I have some questions in regards to Cython:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Is it a systems programming language?&lt;/li&gt; &lt;li&gt;How does it do memory management? Does it use CG/Reference counting by default?&lt;/li&gt; &lt;li&gt;Can I convert a normal python program into cython instead?&lt;/li&gt; &lt;li&gt;Does it work with Android, especially if I used &lt;a href=&quot;https://github.com/hoffstadt/DearPyGui&quot;&gt;DearPythonGui&lt;/a&gt;?&lt;/li&gt; &lt;li&gt;Are there any great complete game engines I can use with Cython?&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/unix21311&quot;&gt; /u/unix21311 &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/r6cvq9/is_cython_a_systems_programming_language/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/r6cvq9/is_cython_a_systems_programming_language/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_r6cvq9</id><link href="https://www.reddit.com/r/Cython/comments/r6cvq9/is_cython_a_systems_programming_language/" /><updated>2021-12-01T11:41:19+00:00</updated><published>2021-12-01T11:41:19+00:00</published><title>Is Cython a systems programming language?</title></entry><entry><author><name>/u/iCurlmyster</name><uri>https://www.reddit.com/user/iCurlmyster</uri></author><category term="Cython" label="r/Cython"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;Anyone have any recommendations on plugins for cython syntax highlighting and maybe also formatting? I mainly use nvim, but there doesnt seem to be a good cython grammar for tree-sitter.&lt;/p&gt; &lt;p&gt;Im not allowed to use Pycharm on my project, btw.&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/iCurlmyster&quot;&gt; /u/iCurlmyster &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/qx3k47/syntax_pluginhighlighters/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/qx3k47/syntax_pluginhighlighters/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_qx3k47</id><link href="https://www.reddit.com/r/Cython/comments/qx3k47/syntax_pluginhighlighters/" /><updated>2021-11-19T00:17:29+00:00</updated><published>2021-11-19T00:17:29+00:00</published><title>Syntax plugin/highlighters</title></entry><entry><author><name>/u/ApeOfGod</name><uri>https://www.reddit.com/user/ApeOfGod</uri></author><category term="Cython" label="r/Cython"/><content type="html">&amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/ApeOfGod&quot;&gt; /u/ApeOfGod &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://i.redd.it/crixsnqquc081.png&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/qwpmen/pandas_struggling_to_see_what_these_lines_achieve/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_qwpmen</id><link href="https://www.reddit.com/r/Cython/comments/qwpmen/pandas_struggling_to_see_what_these_lines_achieve/" /><updated>2021-11-18T13:22:58+00:00</updated><published>2021-11-18T13:22:58+00:00</published><title>[Pandas] Struggling to see what these lines achieve, any help appreciated.</title></entry><entry><author><name>/u/usrlgn</name><uri>https://www.reddit.com/user/usrlgn</uri></author><category term="Cython" label="r/Cython"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;Is there any CLI tool that can do static code analysis on cython codes/files (.pyx) files? I have a requirement of doing static code analysis on home grown codes mainly written in python - for which I am using sonarqube and it natively does that. There are however a few cython codes/files (.pyx) and sonarqube does not support it yet. Looking for tips on how do folks run static code analysis on cython codes/files.&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/usrlgn&quot;&gt; /u/usrlgn &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/px8b60/cli_tool_for_doing_static_code_analysis_on_cython/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/px8b60/cli_tool_for_doing_static_code_analysis_on_cython/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_px8b60</id><link href="https://www.reddit.com/r/Cython/comments/px8b60/cli_tool_for_doing_static_code_analysis_on_cython/" /><updated>2021-09-28T15:03:07+00:00</updated><published>2021-09-28T15:03:07+00:00</published><title>CLI tool for doing static code analysis on cython codes/files</title></entry><entry><author><name>/u/programmerProbs</name><uri>https://www.reddit.com/user/programmerProbs</uri></author><category term="Cython" label="r/Cython"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;I&amp;#39;m getting a strange bug, when running a .pyx program in spyder, I&amp;#39;m often getting &amp;#39;Restarting kernel...&amp;#39; and the ipython console restarts.&lt;/p&gt; &lt;p&gt;I deleted my changes to the code and still this error persists.&lt;/p&gt; &lt;p&gt;I imagine this started due to bad code that wouldnt compile, but now it wont go away. I&amp;#39;m a bit mind boggled. Any idea why this is happening?&lt;/p&gt; &lt;p&gt;EDIT: It might have been due to the line # distutils: include_dirs = C:\Users\ initally using forward slash rather than backslash.&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/programmerProbs&quot;&gt; /u/programmerProbs &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/phcarn/cython_restarting_kernel_bug_any_idea_why_its/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/phcarn/cython_restarting_kernel_bug_any_idea_why_its/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_phcarn</id><link href="https://www.reddit.com/r/Cython/comments/phcarn/cython_restarting_kernel_bug_any_idea_why_its/" /><updated>2021-09-03T19:40:54+00:00</updated><published>2021-09-03T19:40:54+00:00</published><title>Cython &quot;restarting kernel...&quot; bug, any idea why its happening?</title></entry><entry><author><name>/u/liquidmetalrob</name><uri>https://www.reddit.com/user/liquidmetalrob</uri></author><category term="Cython" label="r/Cython"/><content type="html">&amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/liquidmetalrob&quot;&gt; /u/liquidmetalrob &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/pfaij7/im_working_on_an_atom_package_that_automatically/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/pfaij7/im_working_on_an_atom_package_that_automatically/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_pfaij7</id><link href="https://www.reddit.com/r/Cython/comments/pfaij7/im_working_on_an_atom_package_that_automatically/" /><updated>2021-08-31T17:25:44+00:00</updated><published>2021-08-31T17:25:44+00:00</published><title>I'm working on an Atom package that automatically deduces variable types from a .py file and then generates a .pyx and .pyd. Is there such a thing already?</title></entry><entry><category term="Cython" label="r/Cython"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;I need to speed up the following code. I have tried to assign several variables and functions with cdef, but most of the code still seems to be running mostly from pure python. What other changes can I make to use cython and make this run faster? The main culprit is in the update function which gets called inside the two for loops. I don&amp;#39;t usually post on here, but I&amp;#39;ve been at this for hours now. Any help will be greatly appreciated. Thanks. &lt;/p&gt; &lt;pre&gt;&lt;code&gt;%%cython -a import matplotlib.pyplot as plt from autograd import grad import autograd.numpy as np from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split from sklearn.preprocessing import OneHotEncoder import time from datetime import datetime import os import numpy cimport numpy today = datetime.now() tic = time.perf_counter() cdef numpy.ndarray relu(numpy.ndarray x): #return x * (x &amp;gt; 0) return np.tanh(x) cdef numpy.ndarray softmax(numpy.ndarray x): exp = np.exp(x) return exp / exp.sum(0) cdef double Error(W_hh, W_oh, b_h, b_o, x, y): h = relu(np.dot(W_hh,x.T) + b_h) y_hat = softmax(np.dot(W_oh,h) + b_o) return np.sum(np.diag(np.dot(y, -np.log(y_hat))))/len(x) cdef forward(x, y, W_hh, W_oh, b_h, b_o): h = relu(np.dot(W_hh,x.T) + b_h) y_hat = softmax(np.dot(W_oh,h) + b_o) pred = np.expand_dims(np.argmax(y_hat, axis=0), axis=0).T num_wrong = np.count_nonzero(encoder.inverse_transform(y) - pred) acc = (len(x) - num_wrong)/len(x) err = Error(W_hh, W_oh, b_h, b_o, x, y) return acc, err cdef update(W_hh, W_oh, b_h, b_o, x, y): dE_dWhh = grad(Error, argnum=0)(W_hh, W_oh, b_h, b_o, x, y) dE_dWoh = grad(Error, argnum=1)(W_hh, W_oh, b_h, b_o, x, y) W_hh = W_hh - learning_rate*dE_dWhh W_oh = W_oh - learning_rate*dE_dWoh dE_dbh = grad(Error, argnum=2)(W_hh, W_oh, b_h, b_o, x, y) dE_dbo = grad(Error, argnum=3)(W_hh, W_oh, b_h, b_o, x, y) b_h = b_h - learning_rate*dE_dbh b_o = b_o - learning_rate*dE_dbo W_oh[0:3] = 10 * W_oh/np.linalg.norm(W_oh[0:3]) W_oh[1] = 0 return W_hh, W_oh, b_h, b_o cdef float learning_rate = .5 cdef int lessons = 0 #10 cdef int students = 7776 cdef int random_state = 2 iris_data = load_iris() # load the iris dataset x = iris_data.data y_ = iris_data.target.reshape(-1, 1) # Convert data to a single column # One Hot encode the class labels encoder = OneHotEncoder(sparse=False) y = encoder.fit_transform(y_) cdef numpy.ndarray train_x cdef numpy.ndarray test_x cdef numpy.ndarray train_y cdef numpy.ndarray test_y # # Split the data for training and testing train_x, test_x, train_y, test_y = train_test_split(x, y, test_size=0.20, random_state=random_state) #Standardization train_x[:,0] = (train_x[:,0] - np.mean(train_x[:,0]))/np.std(train_x[:,0]) train_x[:,1] = (train_x[:,1] - np.mean(train_x[:,1]))/np.std(train_x[:,1]) train_x[:,2] = (train_x[:,2] - np.mean(train_x[:,2]))/np.std(train_x[:,2]) train_x[:,3] = (train_x[:,3] - np.mean(train_x[:,3]))/np.std(train_x[:,3]) test_x[:,0] = (test_x[:,0] - np.mean(test_x[:,0]))/np.std(test_x[:,0]) test_x[:,1] = (test_x[:,1] - np.mean(test_x[:,1]))/np.std(test_x[:,1]) test_x[:,2] = (test_x[:,2] - np.mean(test_x[:,2]))/np.std(test_x[:,2]) test_x[:,3] = (test_x[:,3] - np.mean(test_x[:,3]))/np.std(test_x[:,3]) cdef numpy.ndarray weights cdef numpy.ndarray initial_weights initial_weights = np.ones([students,7]) cdef numpy.ndarray acc cdef numpy.ndarray err cdef numpy.ndarray b_o cdef numpy.ndarray b_h cdef numpy.ndarray W_hh cdef numpy.ndarray W_oh final_hidden_weights = np.array([]) final_output_weights = np.array([]) for student in range(students): ## Initialization of parameters b_h = np.zeros([1,1]) b_o = np.zeros([3,1]) W_hh = np.expand_dims(initial_weights[student,0:4], axis=1).T W_oh = np.expand_dims(initial_weights[student,4:7], axis=1) W_oh[0:3] = 10 * W_oh/np.linalg.norm(W_oh[0:3]) W_oh[1] = 0 for lesson in range(lessons): W_hh, W_oh, b_h, b_o = update(W_hh, W_oh, b_h, b_o, train_x, train_y) test_acc, test_err = forward(test_x, test_y, W_hh, W_oh, b_h, b_o) acc = np.append(acc, test_acc) err = np.append(err, test_err) final_hidden_weights = np.append(final_hidden_weights, W_hh) final_hidden_weights = np.append(final_hidden_weights, b_h) ##append bias final_output_weights = np.append(final_output_weights, W_oh) final_output_weights = np.append(final_output_weights, b_o) ##append bias final_hidden_weights = final_hidden_weights.reshape(students,5) final_output_weights = final_output_weights.reshape(students,6) toc = time.perf_counter() time = toc - tic print(time) &lt;/code&gt;&lt;/pre&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/pf95vu/need_help_optimizing_this_code_any_suggestions/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/pf95vu/need_help_optimizing_this_code_any_suggestions/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_pf95vu</id><link href="https://www.reddit.com/r/Cython/comments/pf95vu/need_help_optimizing_this_code_any_suggestions/" /><updated>2021-08-31T16:19:01+00:00</updated><published>2021-08-31T16:19:01+00:00</published><title>Need help optimizing this code. Any suggestions?</title></entry><entry><author><name>/u/programmerProbs</name><uri>https://www.reddit.com/user/programmerProbs</uri></author><category term="Cython" label="r/Cython"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;First time adding a C library and I&amp;#39;m not sure the cause of this error. I am following this tutorial &lt;a href=&quot;https://cython.readthedocs.io/en/latest/src/tutorial/clibraries.html&quot;&gt;https://cython.readthedocs.io/en/latest/src/tutorial/clibraries.html&lt;/a&gt;&lt;/p&gt; &lt;p&gt;I&amp;#39;m not sure if I&amp;#39;m missing some unspoken words like I need to run python setup.py build_ext --inplace&lt;/p&gt; &lt;p&gt;I followed the tutorial, so I&amp;#39;m not sure what could cause a simple cimport not to be found. I have in the .pxy file-&lt;/p&gt; &lt;pre&gt;&lt;code&gt; # distutils: sources = resources/yxml.c # distutils: include_dirs = resources/ &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;I have the setup file like shown in the tutorial (sorry if this sounds repetitive). I have checked my spelling at least 10 times. &lt;/p&gt; &lt;p&gt;How would I go about root causing this?&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/programmerProbs&quot;&gt; /u/programmerProbs &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/pc3bla/how_can_i_root_cause_modulenotfounderror_no/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/pc3bla/how_can_i_root_cause_modulenotfounderror_no/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_pc3bla</id><link href="https://www.reddit.com/r/Cython/comments/pc3bla/how_can_i_root_cause_modulenotfounderror_no/" /><updated>2021-08-26T16:43:03+00:00</updated><published>2021-08-26T16:43:03+00:00</published><title>How can I root cause &quot;ModuleNotFoundError: No module named myModule&quot;</title></entry><entry><author><name>/u/UnreadyDog</name><uri>https://www.reddit.com/user/UnreadyDog</uri></author><category term="Cython" label="r/Cython"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;I have a function that I have written in c++ that I want to use in python. In the documentation, the examples were a part of a class and there weren&amp;#39;t any instruction with functions not belonging to a class. The function I want to call has one parameter which is a 9x9 int array. Can someone give me an idea as to what my pyx or pxd files should look like?&lt;/p&gt; &lt;p&gt;EDIT: I think i have most of it figured out, im just not sure how to implement the 2d int array parameter. When i try to build the setup file it says &amp;quot;cannot convert python object to int(*)[9]&amp;quot;&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/UnreadyDog&quot;&gt; /u/UnreadyDog &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/ow33qu/calling_a_simple_c_function_in_python/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/ow33qu/calling_a_simple_c_function_in_python/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_ow33qu</id><link href="https://www.reddit.com/r/Cython/comments/ow33qu/calling_a_simple_c_function_in_python/" /><updated>2021-08-01T23:43:13+00:00</updated><published>2021-08-01T23:43:13+00:00</published><title>Calling a simple c++ function in python</title></entry><entry><author><name>/u/sidhu97ss</name><uri>https://www.reddit.com/user/sidhu97ss</uri></author><category term="Cython" label="r/Cython"/><content type="html">&amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/sidhu97ss&quot;&gt; /u/sidhu97ss &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://stackoverflow.com/questions/68300384/linking-error-for-compiling-cython-on-aarch64?noredirect=1#comment120710762_68300384&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/og5b9r/linking_error_in_making_cython_executable_on/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_og5b9r</id><link href="https://www.reddit.com/r/Cython/comments/og5b9r/linking_error_in_making_cython_executable_on/" /><updated>2021-07-08T11:30:24+00:00</updated><published>2021-07-08T11:30:24+00:00</published><title>Linking error in making cython executable on aarch64</title></entry><entry><author><name>/u/johnnylychenus</name><uri>https://www.reddit.com/user/johnnylychenus</uri></author><category term="Cython" label="r/Cython"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;Followed the steps, and it ends up being &lt;code&gt;running build_ext error: don&amp;#39;t know how to compile C/C++ code on platform &amp;#39;nt&amp;#39; with &amp;#39;mingw32.exe&amp;#39; compiler&lt;/code&gt;&lt;/p&gt; &lt;p&gt;too bad. i guess it is a &lt;code&gt;else&lt;/code&gt; error catcher so i dunno what is actually wrong. hope it is better in the future&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/johnnylychenus&quot;&gt; /u/johnnylychenus &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/o1mv15/modern_way_to_install_cython_on_windows_10/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/o1mv15/modern_way_to_install_cython_on_windows_10/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_o1mv15</id><link href="https://www.reddit.com/r/Cython/comments/o1mv15/modern_way_to_install_cython_on_windows_10/" /><updated>2021-06-17T03:04:31+00:00</updated><published>2021-06-17T03:04:31+00:00</published><title>modern way to install cython on windows 10</title></entry><entry><author><name>/u/drzowie</name><uri>https://www.reddit.com/user/drzowie</uri></author><category term="Cython" label="r/Cython"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;When traversing a numpy array with a for-loop, it&amp;#39;s great to get the faster speed that Cython compiled for-loops offer (even compared to vector operations in numpy). But that&amp;#39;s still not fast enough. When traversing (say) a 2D array and doing an operation on each element, I&amp;#39;m writing Cython loops like this:&lt;/p&gt; &lt;pre&gt;&lt;code&gt;for yi in range(ysize): for xi in range(xsize): im[yi,xi] += 1 # just a f&amp;#39;rinstance -- actual op is more complex &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;I believe this does an explicit offset calculation of the value relative to the numpy array for each loop.&lt;/p&gt; &lt;p&gt;I&amp;#39;d like to do C operations along the lines of:&lt;/p&gt; &lt;pre&gt;&lt;code&gt;valptr += xstride &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;in the hottest loop, instead of &lt;/p&gt; &lt;pre&gt;&lt;code&gt;valptr = &amp;amp;dataptr[ yi * ystride + xi * xstride] &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;which is implied by doing explicit indexing.&lt;/p&gt; &lt;p&gt;The latter saves two multiplies and two adds per loop in this example; several more in the 6-D data sets I&amp;#39;m manipulating. &lt;/p&gt; &lt;p&gt;Is there a way to do that within Cython? Or do I have to drop all the way down into C? (Of course I&amp;#39;m properly cdeffing all the variables :-)&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/drzowie&quot;&gt; /u/drzowie &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/nehj46/using_increments_instead_of_index_calculation_on/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/nehj46/using_increments_instead_of_index_calculation_on/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_nehj46</id><link href="https://www.reddit.com/r/Cython/comments/nehj46/using_increments_instead_of_index_calculation_on/" /><updated>2021-05-17T14:20:31+00:00</updated><published>2021-05-17T14:20:31+00:00</published><title>Using increments instead of index calculation on numpy arrays</title></entry><entry><author><name>/u/Vanhard_Shaw</name><uri>https://www.reddit.com/user/Vanhard_Shaw</uri></author><category term="Cython" label="r/Cython"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;Hey I am trying to create a cythonize a function which takes in 5 float values and generates a matrix of size 10x10. But I am met with this Compiler crash frequently. I tried to obtain a partial set of values by first extracting a 5x5 matrix and it works but once I move to a 7x7 matrix the compilation fails. I am currently attempting to do this on my macbook air M1.&lt;br/&gt; TO give you some context, each term of the matrix is an equation comprising the 5 input variables ( x,y,L,W,theta). The size of these equations are some small and some extremely huge. They have been simplified as much as possible. Can someone help me with this ?&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/Vanhard_Shaw&quot;&gt; /u/Vanhard_Shaw &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/mrzjwq/compiler_crash_in_normalizetree/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/mrzjwq/compiler_crash_in_normalizetree/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_mrzjwq</id><link href="https://www.reddit.com/r/Cython/comments/mrzjwq/compiler_crash_in_normalizetree/" /><updated>2021-04-16T09:23:59+00:00</updated><published>2021-04-16T09:23:59+00:00</published><title>Compiler crash in NormalizeTree</title></entry><entry><author><name>/u/jdcaballero</name><uri>https://www.reddit.com/user/jdcaballero</uri></author><category term="Cython" label="r/Cython"/><content type="html">&amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/jdcaballero&quot;&gt; /u/jdcaballero &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://monadical.com/posts/virtual-classes-in-cython.html&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/lbne83/two_strategies_for_implementing_c_virtual/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_lbne83</id><link href="https://www.reddit.com/r/Cython/comments/lbne83/two_strategies_for_implementing_c_virtual/" /><updated>2021-02-03T13:22:30+00:00</updated><published>2021-02-03T13:22:30+00:00</published><title>Two strategies for implementing C++ virtual functions in Cython</title></entry><entry><author><name>/u/Raniconduh</name><uri>https://www.reddit.com/user/Raniconduh</uri></author><category term="Cython" label="r/Cython"/><content type="html">&amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/Raniconduh&quot;&gt; /u/Raniconduh &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://github.com/Raniconduh/py2c&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/kbjjg4/a_script_to_automatically_compile_python_files_to/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_kbjjg4</id><link href="https://www.reddit.com/r/Cython/comments/kbjjg4/a_script_to_automatically_compile_python_files_to/" /><updated>2020-12-12T05:29:12+00:00</updated><published>2020-12-12T05:29:12+00:00</published><title>A script to automatically compile python files to binaries using Cython</title></entry><entry><author><name>/u/sfermigier</name><uri>https://www.reddit.com/user/sfermigier</uri></author><category term="Cython" label="r/Cython"/><content type="html">&amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/sfermigier&quot;&gt; /u/sfermigier &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://github.com/sfermigier/awesome-cython&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/k7bhlv/awesome_cython_a_curated_list_of_awesome_cython/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_k7bhlv</id><link href="https://www.reddit.com/r/Cython/comments/k7bhlv/awesome_cython_a_curated_list_of_awesome_cython/" /><updated>2020-12-05T17:23:05+00:00</updated><published>2020-12-05T17:23:05+00:00</published><title>Awesome Cython - A curated list of awesome Cython resources (contributions welcomed)</title></entry><entry><author><name>/u/dslfdslj</name><uri>https://www.reddit.com/user/dslfdslj</uri></author><category term="Cython" label="r/Cython"/><content type="html">&lt;!-- SC_OFF --&gt;&lt;div class=&quot;md&quot;&gt;&lt;p&gt;Hello everybody,&lt;/p&gt; &lt;p&gt;I&amp;#39;m trying to create a Python binding to a C++ library. This library has a typedef which looks like this:&lt;/p&gt; &lt;pre&gt;&lt;code&gt;enum class ColType {INT = 1, STRING = 2, DOUBLE = 3}; typedef std::unordered_map&amp;lt;std::string, std::pair&amp;lt;ColType, Any&amp;gt;&amp;gt; df; &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;where Any is the Any type from the boost library. Is it possible to expose this typedef to Cython? In the end I just want to use some functions (within the library) which expect this df type as input.&lt;/p&gt; &lt;/div&gt;&lt;!-- SC_ON --&gt; &amp;#32; submitted by &amp;#32; &lt;a href=&quot;https://www.reddit.com/user/dslfdslj&quot;&gt; /u/dslfdslj &lt;/a&gt; &lt;br/&gt; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/ih1ivw/using_boosts_any_type_in_cython/&quot;&gt;[link]&lt;/a&gt;&lt;/span&gt; &amp;#32; &lt;span&gt;&lt;a href=&quot;https://www.reddit.com/r/Cython/comments/ih1ivw/using_boosts_any_type_in_cython/&quot;&gt;[comments]&lt;/a&gt;&lt;/span&gt;</content><id>t3_ih1ivw</id><link href="https://www.reddit.com/r/Cython/comments/ih1ivw/using_boosts_any_type_in_cython/" /><updated>2020-08-26T16:00:24+00:00</updated><published>2020-08-26T16:00:24+00:00</published><title>Using Boost's any type in Cython</title></entry></feed>