emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: edgar@openmail.cc
To: emacs-orgmode@gnu.org
Subject: how to org-babel-detangle with nested noweb?
Date: Sun, 17 Oct 2021 02:17:07 +0000	[thread overview]
Message-ID: <20211017021707.Horde.p9ib-mMooANjOrUuCbc5EPl@www.vfemail.net> (raw)

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	other threads:[~2021-10-17  2:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-17  2:17 edgar [this message]
2021-10-18 16:31 ` how to org-babel-detangle with nested noweb? Tom Gillespie
2021-10-18 16:57   ` edgar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211017021707.Horde.p9ib-mMooANjOrUuCbc5EPl@www.vfemail.net \
    --to=edgar@openmail.cc \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).