Version 0.15.1
0.15.1 (28 January 2022) - New Year's edition:
New:
- Python 3.10 support. Running on Python 3.10 requires
mcpyrate
3.6.0. - New module
unpythonic.timeutil
, with utilities for converting a number of seconds into human-understood formats (seconds_to_human
,format_human_time
), and a simple running-averageETAEstimator
that takes advantage of these. As usual, these are available at the top level ofunpythonic
. - Add function
unpythonic.syntax.get_cc
, the less antisocial little sister ofcall_cc
from an alternate timeline, to make programming with continuations slightly more convenient. (Alternate timelines happen a lot when one uses multi-shot continuations.) The two work together. See docstring. - Tag continuation closures (generated by the
with continuations
macro), for introspection.- To detect at run time whether a given object is a continuation function, use the function
unpythonic.syntax.iscontinuation
. - This is purely an introspection feature;
unpythonic
itself does not use this information. For why you might want to query this, seeget_cc
, particularly the examples in unit tests. - The information is stored as an attribute on the function object; keep this in mind if you intend to wrap the continuation function with another function. (Strictly, this is the correct behavior, since a custom wrapper is not a continuation function generated by the
with continuations
macro.)
- To detect at run time whether a given object is a continuation function, use the function
Fixed:
- The test framework
unpythonic.test.fixtures
is now correctly installed when installingunpythonic
. See #81. - The subpackage for live REPL functionality,
unpythonic.net
, is now correctly installed when installingunpythonic
. - Fix a broken import that prevented the REPL server
unpythonic.net.server
from starting. This was broken by the move ofasync_raise
intounpythonic.excutil
in 0.15.0. unpythonic.syntax.prefix
: Fix wrong macro name in error message ofunpythonic.syntax.prefix.u
. Document in the docstring that the magic operatorsq
,u
, andkw
(of theprefix
macro) cannot be renamed by as-importing.- Preserve the source location info of the dialect-import statement in the example dialects in
unpythonic.dialects
. In the output, the lines of expanded source code that originate in a particular dialect template are marked as coming from the unexpanded source line that contains the corresponding dialect-import.- If you want to see the line numbers before and after dialect expansion, use the
StepExpansion
dialect frommcpyrate.debug
. - This fix requires
mcpyrate
3.6.0 or later. The code will run also on earlier versions ofmcpyrate
; then, just like before, it will look as if all lines that originate in any dialect template came from the beginning of the user source code.
- If you want to see the line numbers before and after dialect expansion, use the