emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how to org-babel-detangle with nested noweb?


From: edgar
Subject: how to org-babel-detangle with nested noweb?
Date: Sun, 17 Oct 2021 02:17:07 +0000
User-agent: Horde Application Framework 5

Hi,

I am tangling Python files with =:comments link=. I don't know if a way already exits, but I would like to detangle (=org-babel-detangle=) /noweb/ blocks. For instance:

#+name: binary_metrics.py
#+begin_src python
  import numpy as np

  np.random.seed(42)
  true_vals = np.random.randint(0, 2, size=5)
  pred_vals = np.ones(5)
#+end_src

#+name: binary_metrics2.py
#+begin_src python :tangle ../Code/Sandbox/tmp.py :dir ../Code/Sandbox/ :comments noweb :noweb yes :padline yes
  <<binary_metrics.py>>
#+end_src

Then, if I modify tmp.py and do an =org-babel-detangle=, the changes would go back to =binary_metrics.py=. As it is not working for me at the moment, I would like to know if
1. I am doing something wrong (it should be working),
2. there is a package which can handle this, or
3. this can be a feature request
The reason for which I would like to have this is to take advantage of Org to have reproducible and maintainable documents when programming in Python.

The reason behind this is that I am unaware of any package which allows =org-edit-special= to integrate with other blocks in the document in such a way that modules are imported, e.g:

#+name: code1.py
#+begin_src python
  import numpy as np
#+end_src

#+caption: Try to =org-edit-special= and get the documentation for =np= (with eldoc for instance).
#+begin_src python :noweb yes
  <<code1.py>>
  np
#+end_src

#+begin_src emacs-lisp
  (format "%s\n%s"
   (emacs-version)
   (org-version))
#+end_src

#+RESULTS:
: GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.17.4)
:  of 2021-03-26
: 9.4.6


Thank you!


-------------------------------------------------
This free account was provided by VFEmail.net - report spam to abuse@vfemail.net

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the 
NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features! 15GB disk! No bandwidth quotas! Commercial and Bulk Mail Options!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]