emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* how to org-babel-detangle with nested noweb?
@ 2021-10-17  2:17 edgar
  2021-10-18 16:31 ` Tom Gillespie
  0 siblings, 1 reply; 3+ messages in thread
From: edgar @ 2021-10-17  2:17 UTC (permalink / raw)
  To: emacs-orgmode

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!  


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-18 16:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-17  2:17 how to org-babel-detangle with nested noweb? edgar
2021-10-18 16:31 ` Tom Gillespie
2021-10-18 16:57   ` edgar

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).