Open hugetim opened 1 year ago
The 'noecho' mode is off by default, and stripping it out completely seems a bit excessive. Perhaps I can just add a note saying that this feature is incomplete?
Right, definitely. Maybe "experimental" is what I should have called it all along.
Sorry, rereading my post, it sounds more demanding than I was intending. My intention is just to be helpful in an informative way. It's no big deal either way. :)
Continuing the discussion from #16:
Preface
Using
nbstata
for my normal work a few times has turned up a few further quirks ofpystata.stata.run
.By the way, nbstata's getting pretty complicated due to my stubborn insistence on the "noecho" mode, so it's really nice that
pystata_kernel
also exists, as a simpler kernel that passes each code cell pretty directly topystata.stata.run
. (Actually, if I were you, I would remove theecho=None
config option to better keep things simple.) That way, if something unexpected happens, the user can at least trace the issue directly back to the behavior ofpystata.stata.run
.Single- vs. multi-line code cells
Single-line input (to pystata.stata.run, and thus to
pystata_kernel
) is processed like Stata's interactive mode, whereas multi-line code is processed via running a do-file. This has a number of implications (beyond echo) that may be surprising to the unsuspecting user ofpystata_kernel
unless they read the fine print in thepystata
docs linked above://
or/* ... */
) work in multi-line code but trigger an error in single-line code.#delimit ;
works in a multi-line code cell (only for that one cell--and I'd now suggest keeping it that way forpystata_kernel
) but placing `#delimit ;' in a single-line cell will cause an error.pystata
docs for the %stata magic.)edit: Contrary to my original assertions, there are no single- vs. multi-line issues with locals or the
version
command (and maybe no issues not already flagged somewhere in thepystata
docs). The issues I was having with those turned out to only apply to the "noecho" mode which runs multi-line code as a program. (If you maintain that mode inpystata-kernel
(contrary to my recommendation above), you may want to address those issues, though, perhaps just by acknowledging them in the README, for starters.)