-
Notifications
You must be signed in to change notification settings - Fork 39
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
Add aeval: Asynchronous Equivalent to eval in aioconsole #120
Conversation
Hi @Akm0d and thanks for taking the time to make this PR. I'm not against introducing an For instance Moreover, As far as I remember, implementing |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #120 +/- ##
==========================================
+ Coverage 94.11% 94.22% +0.10%
==========================================
Files 11 11
Lines 833 848 +15
==========================================
+ Hits 784 799 +15
Misses 49 49 ☔ View full report in Codecov by Sentry. |
thanks for taking a look so quickly! i'll do some fine tuning to resolve what you pointed out |
@vxgmichel I updated the code to ensure that I also modified my tests to compare the results of |
Oh I'm very surprised that The test comparing |
Ok I've added more test cases to achieve full code coverage. Also raising the same |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
I'll have to fix the python 3.12 compatibility though
Merged 🎉 |
Release in v0.8.0 🎉 |
This PR introduces a new
aeval
function to theaioconsole
library, providing an asynchronous equivalent to Python's built-ineval
. Theaeval
function enhancesaioconsole
by enabling users to evaluate expressions asynchronously within an interactive console environment, complementing the existingaexec
function.Key Features of
aeval
:Asynchronous Evaluation:
aeval
function allows for the evaluation of expressions that may involve asynchronous operations. This is particularly useful in environments where asynchronous code is prevalent, such as web servers or other I/O-bound applications.Behavior Consistent with
eval
:aeval
functions in a manner consistent with Python’s built-ineval
. It evaluates single-line expressions and raises the same exceptions aseval
for invalid input.aeval
does not handle multi-line inputs or statements (e.g., function definitions, loops), maintaining strict compatibility with theeval
behavior which is limited to single expressions.Error Handling:
eval
does.Seamless Integration with Existing
aexec
:aeval
builds upon theaexec
function, ensuring consistent behavior and making use of the existing compilation and execution mechanisms withinaioconsole
.Example Usage:
This PR ensures that
aeval
behaves exactly like the built-ineval
, with the added capability of handling asynchronous functions, making it a powerful tool for asynchronous interactive environments.