Releases: evhub/coconut
Coconut v3.1.2
See Coconut's documentation for more information on all of the features listed below.
Bugfixes:
Language features:
- #846:
reduce,takewhile, anddropwhilenow support keyword arguments. - #848: Class and data patterns now support keyword argument name elision.
- #847: New pattern-matching syntax for matching anonymous named tuples.
Compiler features:
- #843: Added compiler warnings for (some cases of) undefined variables.
Coconut v3.1.1
See Coconut's documentation for more information on all of the features listed below.
Language features:
- #833: New
case defsyntax for more easily defining pattern-matching functions with many patterns. - #811: New
f(name=)syntax as a shorthand forf(name=name), replacing the now deprecatedf(...=name)syntax. - #836: New
CoconutWarningbuilt-in used for Coconut runtime warnings.
Compiler features:
- #837: Coconut will now warn about implicit string concatenation and disable it completely with
--strict. - #718: Coconut will now warn about use of
addpattern defwithout a priormatch def. This was a previously-supported feature to make pattern-matching functions with many patterns easier to write, but the new recommended way to do that is now viacase def. - #785: Initial pyright support via the
--pyrightflag.
Bugfixes:
Coconut v3.1.0
See Coconut's documentation for more information on all of the features listed below.
Language features:
- #814: Changes to statement lambda scoping rules, including capturing names introduced in the surrounding expression.
- #618: Changes to handling of pattern-matching function defaults including support for e.g.
match def f(x, y=x) = (x, y). - #809: New array concatenation implicit partials (e.g.
[. ; a]). - #823: New
(x := .)implicit partial syntax (only available in pipes). - #807: New
lift_apartbuilt-in combinator. - #813: New
(if)operator function. - #826 (thanks @JayXon!): Better universalization and
fmapsupport forbytesandbytearray. - #816: Support for
xarrayto match existingnumpy/pandassupport. - #817: New
toargument toall_equal. - #821 (thanks @GolfingSuccess!): Expanded implicit function application syntax to support string literal methods.
Compiler features:
- #799:
coconut-runandcoconut --runnow work on packages rather than just files. - #812: Better formatting of Coconut exceptions.
Bugfixes:
- #810: Fixed an issue compiling certain syntax constructs in the Coconut Jupyter kernel.
- #818, #825 (thanks @kg583, @dokutan!): Fixed parsing of different Unicode line break characters.
- #822 (thanks @JayXon!): Fixed parsing of Unicode backward pipe operators.
- #819, #820 (thanks @kg583!): Fixed some incompatibilities between Python and Coconut syntax.
Coconut v3.0.4
This is primarily a bugfix release to resolve #804. See Coconut's documentation for more information on all of the features listed below.
Language changes:
- #784:
wherestatements now use temporary variable names to limit the scope of contained assignments. - #795: New
async_mapfunction utilizinganyioto work withasyncioortrio. - #793: New
mapreduce,collectby.using_threads,collectby.using_processes,mapreduce.using_threads, andmapreduce.using_processesbuilt-ins. - #787: Support for
.method[index]implicit partials. - #749, #792: Some built-ins have been renamed for clarity (the old names will still work unless
--strictis passed). Specifically:recursive_iterator->recursive_generatorparallel_map->process_mapconcurrent_map->thread_map
- #797: Partial application objects now preserve the original function's
__name__attribute. - #789: Coconut will automatically backport
ExceptionGroupusing theexceptiongroupmodule.
Compiler changes:
- #772: Substantial improvements to recompilation speed for most files.
- #798: New
api.find_packagesandapi.find_and_compile_packagesutilities for working with Coconut packages. - #803: New
--fail-fastoption to fail upon the first error when compiling multiple files. - #778: The
--history-filecommand-line option has been removed; useCOCONUT_HISTORY_FILEenvironment variable if you really need it.
Bugfixes:
Coconut v3.0.3
See Coconut's documentation for more information on all of the features listed below.
New features:
- #738: New
and_thenandand_then_awaitbuilt-ins for async function composition.
Language changes:
- #763: Lambdas now support fat arrows (
x => x) as an alternative to skinny arrows (x -> x) to better distinguish them from type annotations. Skinny arrow lambdas will be deprecated at some later date. - #756: Coconut now fully supports Python 3.12's enhanced
f-string syntax on all targets. - #773:
f-strings with no expressions in them (e.g.f"why does this have an f"will now show a warning by default and an error on--strict.
Compiler changes:
- #761:
--line-numbersare now on by default. Pass--no-line-numbersto turn them off. - #768 (thanks @kxmh42!): Automatic compilation now uses a cache directory rather than compiling files in-place; additionally, automatic compilation options can now be set via
coconut-run. - #767: New
--target psfsupport for targeting all versions not considered end-of-life. - #765 (thanks @rtbs-dev!): New
coconut --jupyter installcommand for easily installing all Jupyter kernels added as an alternative to the existingcoconut --jupytersyntax. - #766: Coconut now internally supports an incremental parsing mode that is used in some situations (e.g. in the Jupyter kernel) to substantially improve recompilation times.
Bugfixes:
- #759 (thanks @Starwort!):
multisetmethods should now always returnmultisets when the arguments are allmultisets rather thanCounters. - #764 (thanks @koraa!): An issue that caused function definitions to take much longer to compile when compiling from the interpreter has now been fixed.
- #762 (thanks @Starwort!): Semicolon-separated commands should now always work properly on
xonsh. - #775: Coconut should no longer set the
MYPYPATHto include the entire directory that Coconut has been installed into when running with--mypy. - #777: Docstrings should now show up properly in any third-party tools that look at Coconut's stub files.
Coconut v3.0.2
See Coconut's documentation for more information on all of the features listed below.
This is another patch release, mainly for #751 and #755.
New features:
- #753:
async with forloops provide a simple syntax for implementing the recommended pattern for handlingasyncgenerators.
Language changes:
- #752:
typingimports will redirect totyping_extensionswhenever possible to ensure you always get the latest implementation oftypingobjects on all versions. - #754:
asyncgenerators and some related utilities will now be automatically backported to 3.5 via theasync_generatorlibrary. - #748: Certain confusing Unicode operator alternatives removed.
Compiler changes:
- #750:
coconut.conveniencerenamed tococonut.api(coconut.convenienceis still available as an alias for backwards compatibility).
Bugfixes:
Coconut v3.0.1
See Coconut's documentation for more information on all of the features listed below.
This is a patch release primarily aimed at fixing #746, though it also brings a couple of new features and other fixes as well.
New features:
- #743: New
f(...=long_name)syntax as a shorthand forf(long_name=long_name). - #744:
f ..> gwill now preserve the signature offwhen inspected usinginspect.signature.
Language changes:
- #736:
fmapwill now raiseTypeErrorrather than falling back to a default implementation when it encounters an unknown type. For backwards compatibility, the old behavior can be recovered withfmap$(fallback_to_init=True). - #737:
fmapnow works properly onmultiset.
Bugfixes:
- #746: Syntax errors produced when using Coconut's Jupyter kernel will now present themselves nicely rather than causing an error.
- #745 (thanks @Starwort!):
xonshwill no longer fail on semicolon-seperated commands when using the Coconut extension. - #739 (thanks @yggdr!): Compiling a single directory in
--stand-alonemode will now properly make use of--jobs. - #742 (thanks @kloczek!): Fixed a deprecation warning when installing Coconut.
Coconut v3.0.0
Coconut v3! See Coconut's documentation for more information on all of the features listed below.
Note that v3 is a major version release that comes with some breaking changes, though Coconut will do its best to warn you if your code does anything that changed from v2 to v3.
Breaking changes:
- #714:
setpatterns now work likedictpatterns where they allow extra keys, such that{1, 2}will match{1, 2, 3}. To get back the strict behavior, use the{1, 2, 3, *()}pattern. Coconut will warn you if your code contains set patterns without an explicit strictness marker. - #707: the precedence of implicit function application has been changed to be compatible with implicit coefficients, such that
f x**2is now equivalent tof(x**2)rather thanf(x)**2. Coconut will warn you if your code contains expressions with new precedence. - #733:
.$[]will now only default to using an existing__getitem__if the object is registered as acollections.abc.Sequence.__iter_getitem__will still always be used. Lets you do things like{"k": "v"}$[0]. - #730:
obj.syntax as a shorthand forgetattr$(obj)deprecated. - #732:
--jobsnow defaults tosysrather than0.
New features:
- #707: New implicit coefficient syntax! Polynomials are just
a x**2 + b x + c, with support for single variable names and numeric constants as coefficients. - #731: New
copyclosure deffunctions that copy their closures on function creation, allowing them to e.g. hold on to loop variables. - #709:
(+)syntax in a typing context now yields atyping.Protocolthat requires supporting that operator. - #709: New
&:operator for combining multipletyping.Protocol's into a single protocol. - #718 (thanks @yggdr!): You can now use
addpattern defeven if there's no existing function of that name, allowing you to useaddpattern deffor every pattern rather than having to usematch deffor the first one. - #727: New
x |> awaitsyntax for usingawaitin pipes. - #734: Substantially improved
pandassupport. - #714: New
frozensetandmultisetpatterns.
Bugfixes:
- #725 (thanks @yggdr!): Fixed
(in)operator function argument ordering. - #721 (thanks @yggdr!):
is notandnot inoperator functions now supported. - #724 (thanks @Starwort!): Coconut no longer slows down
xonshloading and fixedxontrib unload coconut. - #726 (thanks @caedmon-kitty!): Fixed certain
xonshcommands when using Coconut'sxonshplugin. - #723:
dictnow always functions as on the latest Python 3 on any Python version. - #728 (thanks @yggdr!): Fixed
supercompatibility across Python versions and some cases wheresuper()wouldn't work. - #717 (thanks @kksgandhi!): Fixed
coconut --jupyter qtconsole.
Coconut v2.2.0
See Coconut's documentation for more information on all of the features listed below.
Major changes:
- #694: New
multisetbuilt-in based oncollections.Counter, including new multiset literal syntax (m{1, 1, 2, 3, 3, 4}). - #691: New
Expectedbuilt-in based on Haskell'sEither, plus newsafe_callbuilt-in that calls a function while collecting any errors into anExpected. Additionally, theofbuilt-in has been renamed tocall(ofis still available as a deprecated alias when compiled without--strict). - #701: New
windowsofbuilt-in for iterating over sliding windows of the given iterable. - #688: New
cartesian_productbuilt-in as an enhanced version ofitertools.productincludingnumpysupport. - #690: New
cyclebuilt-in as an enhanced version ofitertools.cycle. - #704, #703, #702, #693, #692: Lots of improvements to existing built-ins:
mapnow supports astrict=Truekeyword-only argument that works as inzip.flattennow supports alevelsargument for how many levels to flatten.groupsofnow supports afillvalueargument to pad the last group.addpatternnow accepts any number of pattern-matching functions.memoizenow accepts a function to memoize as the first argument.
- #710: New
None-aware function composition pipes (e.g.f ..?> g).
Minor changes:
- #686: Type parameter bounds can (and should) now use
<:syntax instead of:or<=(e.g.def f[T <: int[])(xs: T) -> T = ...). - #711: Backwards
None-aware pipes now supported (e.g.<?|). - #708: Pattern-matching against
datatypes with default arguments now allows those defaults to be elided in thematch. - #697:
::now produces a reiterable object when called on reiterable objects. - #706: Multiple Coconut projects should now be able to seamlessly use each other's
MatchErrors when compiled in--packagemode. - #695: Set literal syntax now supports star unpacking.
- #699: Support for
__bool__magic method fixed on Python 2. - #687: Jupyter kernel and other automatic compilations now uses
--no-wrap. - #685, #684: Improved detection of code issues on and off
--strict. - #700: Some confusing unicode alternatives were removed.
- #698: Typing for
fmaphas been improved. - #689: Improved
numpysupport for some built-ins. - #705: Many Coconut built-ins have now been made
weakrefable.
v2.1.1 [The Spanish Inquisition]
v2.1.1 is a relatively small release on top of v2.1.0 primarily releasing now to provide Python 3.11 support, though v2.1.1 also has a couple of exciting new features, primarily Coconut's new type parameter syntax. See Coconut's documentation for more information on all of the features listed below.
Bugfixes:
- #682: Coconut no longer errors out on Python 3.11.
Major changes:
- #677: New type parameter syntax following PEP 695! For example: type a generic function as
def ident[T](x: T) -> T = x.
Minor changes:
- #679: Error and logging output is now colored on terminals that support it.
- #678: Non-
mypytype checkers should now have an easier time type-checking Coconut code. - #680: New
async (...) -> ...and(..., **P) -> ...enhanced type annotation constructs for Callables following PEP 677. - #644:
f = async def x -> xasync statement lambda syntax now supported. - #624:
x |> (.+1)syntax now produces better optimized compiled Python. - #681:
case/matchsyntax now deprecated on--strictin favor of Python 3.10match/casesyntax.