jkitchin / scimax

An emacs starterkit for scientists and engineers
Other
1.04k stars 123 forks source link

just a question about Cython and org-babel code blocks #480

Closed OrionRandD closed 1 year ago

OrionRandD commented 1 year ago

I saw this video about Cython C Programming for Machine Learning (LIVE) https://iv.nboeck.de/watch?v=giF8XoPTMFg And I wonder if I can reproduce it using org-babel code block for cython, like so:

hash_begin_src cython :results blah code here hash_end_src

How could I go about this? Which ob-cython and packages do I have to get in scimax to accomplish it? Thx a lot

jkitchin commented 1 year ago

It looks like you can do this in emacs-jupyter already:

#+BEGIN_SRC sh :results silent
pip install Cython
#+END_SRC

#+BEGIN_SRC jupyter-python
%load_ext Cython
#+END_SRC

#+RESULTS:

#+BEGIN_SRC jupyter-python  
%%cython

a: cython.int = 0
for i in range(10):
    a += i
print(a)
#+END_SRC

#+RESULTS:
:RESULTS:
45
:END:
OrionRandD commented 1 year ago

This, I think, would be a good add to the org-babel official web site... https://orgmode.org/worg/org-contrib/babel/languages/index.html

Perhaps, they would accept this entry there...

Anyway, brilliant Thx again...

On Thu, 27 Jul 2023 at 11:32, John Kitchin @.***> wrote:

It looks like you can do this in emacs-jupyter already:

+BEGIN_SRC sh :results silent

pip install Cython

+END_SRC

+BEGIN_SRC jupyter-python

%load_ext Cython

+END_SRC

+RESULTS:

+BEGIN_SRC jupyter-python

%%cython

a: cython.int = 0 for i in range(10): a += i print(a)

+END_SRC

+RESULTS:

:RESULTS: 45 :END:

— Reply to this email directly, view it on GitHub https://github.com/jkitchin/scimax/issues/480#issuecomment-1653744215, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKLPRKKK5KUN52XDGDK3BDLXSJ3XVANCNFSM6AAAAAA2YVXTTQ . You are receiving this because you authored the thread.Message ID: @.***>