-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
creating doctest output #37
Comments
Hi @CagtayFabry, thanks for your interest in reprexlite! Can you explain a little bit more about why you want to use reprexlite for doctest outputs? One of the core design ideas behind reprexlite is to be an alternative to doctest. Even if this weren't the case, it's also not clear to me that something like reprexlite is the right tool for this. You could simply open a Python REPL from the command line and copy-paste from there. |
thanks for getting back here @jayqi basically I currently use
I do agree on your assessment of the drawbacks when using doctest format but I need the sphinx/pytest integration etc. |
I guess that makes sense. I think rather than a
Another angle to your use case is maybe open issue #16. I'm not sure how sphinx or pytest handle doctests so I don't know much on top of that it would take to support sphinx or pytest. |
I did poke around at this and made some progress. It does involve a bunch of refactoring as it doesn't quite line up with some of my abstractions. 😅 One annoying thing still to solve is that libcst, which I use to parse the code, attaches whitespace lines to code statements following them, which ends up misformatting the code after empty lines. That will involve some finagling. >>> from itertools import product
>>>
... grid = list(product([1, 2, 3], [8, 16]))
>>> grid
[(1, 8), (1, 16), (2, 8), (2, 16), (3, 8), (3, 16)]
>>> for var in list(zip(*grid)):
... print(var)
(1, 1, 2, 2, 3, 3)
(8, 16, 8, 16, 8, 16) |
Hi @CagtayFabry, I know it's been a while, but I did a major overhaul of reprexlite's internals and this has been merged to the main branch. It's not released yet, but if you want to start using it, you can install from source. reprex --prompt=">>>" --continuation="..." --comment="" >>> from itertools import product
>>>
>>> grid = list(product([1, 2, 3], [8, 16]))
>>> grid
[(1, 8), (1, 16), (2, 8), (2, 16), (3, 8), (3, 16)]
>>> list(zip(*grid))
[(1, 1, 2, 2, 3, 3), (8, 16, 8, 16, 8, 16)] Created at 2023-02-22 19:55:25 EST by reprexlite v1.0.0 |
awesome! 🚀 |
@jayqi Any chance of a release in the near future? |
Hi @richieadler. To be transparent, this project has been a bit of a victim of a big, ambitious overhaul that never fully got finished. With the holidays coming up, I'll try to find some free time to revisit this. I haven't worked on this in nearly two years, so realistically that's a pretty big hurdle to cross. |
@jayqi Maybe not even the doctest generation, but the current main works with the parameters you indicated; maybe that alone may warrant a minor bump to the version and a release in PyPI? |
Hi @richieadler, I have ended up working on this a fair amount over the last month and have made good progress. For now, I've released the version that's been on There are quite a few further improvements coming in #79 (configuration files!) which will be the final 1.0.0 release. Thanks for your patience. |
thank you for creating this handy tool (and the jupyter cell magic!) 💯
it would be very handy to be able to create doctest compatible output from reprexlite (I see there is already an issue for reading doctest format inputs)
so basically going from
to
I tried to get there by using the options but run into a few issues:
--comment
option?>>>
to the code lines)(ultimately having
--venue=doctest
available would really sweet obviously)The text was updated successfully, but these errors were encountered: