Skip to content

Version 0.15.1

Latest
Compare
Choose a tag to compare
@Technologicat Technologicat released this 28 Jan 11:27
· 39 commits to master since this release

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-average ETAEstimator that takes advantage of these. As usual, these are available at the top level of unpythonic.
  • Add function unpythonic.syntax.get_cc, the less antisocial little sister of call_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, see get_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.)

Fixed:

  • The test framework unpythonic.test.fixtures is now correctly installed when installing unpythonic. See #81.
  • The subpackage for live REPL functionality, unpythonic.net, is now correctly installed when installing unpythonic.
  • Fix a broken import that prevented the REPL server unpythonic.net.server from starting. This was broken by the move of async_raise into unpythonic.excutil in 0.15.0.
  • unpythonic.syntax.prefix: Fix wrong macro name in error message of unpythonic.syntax.prefix.u. Document in the docstring that the magic operators q, u, and kw (of the prefix 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 from mcpyrate.debug.
    • This fix requires mcpyrate 3.6.0 or later. The code will run also on earlier versions of mcpyrate; 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.