Coconut

Latest version: v3.1.2

Safety actively analyzes 687881 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 8

1.6.0

Barring any necessary hotfixes, this release, `v1.6.0`, will be the last release on the `v1.X.X` branch—which means next up is Coconut `v2`! Coconut `v2` will include [substantial backwards-incompatible changes to Coconut's pattern-matching syntax](https://github.com/evhub/coconut/issues/605), as well as likely including other backwards-incompatible changes as well.

Coconut `v1.6.0` includes a substantial list of new features, many of which have been added in anticipation of Coconut `v2`. See Coconut's [documentation](http://coconut.readthedocs.io/en/master/DOCS.html) for more information on all of the features and bugfixes listed below.

New language features:
* 558, 601: Coconut now fully supports [Python 3.10 pattern-matching syntax](https://www.python.org/dev/peps/pep-0634/#class-patterns), including compiling Python 3.10 pattern-matching syntax to any Python version and mixing and matching between Python 3.10 pattern-matching and Coconut pattern-matching (including in destructuring assignment and pattern-matching function definition).
* 566: Coconut can now specifically target Python `3.9`, Python `3.10`, and/or Python `3.11`.
* 425 (thanks ExpHP for the issue!): Coconut pattern-matching now supports view patterns that allow calling a function in pattern-matching and matching on the result.
* 607: Coconut pattern-matching now supports infix patterns that allow calling a binary boolean function in pattern-matching and matching only if the return value is truthy.
* 570: Coconut now supports an `override` built-in that, when used to decorate a method, asserts that it is overwriting some method from a base class.
* 582, 583 (thanks aananko for the issue!): Coconut now supports a `flatten` built-in for flattening one layer of an iterable of iterables.
* 574: Coconut now supports `reveal_type` and `reveal_locals` built-ins that will print the inferred type of the contained expression when compiled with `coconut --mypy`.
* 421: Coconut now supports `yield def` function definition syntax for explicitly specifying that you want a generator function, regardless of whether a `yield` actually occurs somewhere in the function.
* 598: Coconut now supports `if condition then x else y` ternary syntax in addition to Python's `x if condition else y` ternary syntax.
* 544: Coconut now supports the additional `.[0][1]` and `.a.b(c)` implicit partials.
* 348 (thanks ArneBachmann for the issue!): Pattern-matching functions now support return type annotations (though not argument type annotations).
* 289: Coconut now supports `dict`, `tuple`, and `list` star and double-star unpackings across all Python versions.
* 571 (thanks tbsexton for the issue!): Coconut now fully supports Python 3.10 `int | bool` type annotation syntax, including compiling it to any Python version.
* 572: Coconut's `zip` and `zip_longest` built-ins now supports a Python-3.10-style `strict` keyword argument on all Python versions.
* 307: Coconut now supports `class A(metaclass=...)` syntax on all Python versions, including compiling to universal code to support Python 2.
* 495 (thanks pavelbraginskiy for the issue!): Coconut now supports `exec` as a function on all Python versions.
* 352 (thanks ArneBachmann for the issue!): Coconut will now compile `enum` imports into [`aenum`](https://pypi.org/project/aenum/) imports on targets that don't support `enum`.
* 365 (thanks ArneBachmann for the issue!): Coconut now supports `==` instead of `=` as the prefix for equality checking in pattern-matching (this will be made mandatory in Coconut `v2`).
* 576: Coconut's `case` syntax now allows a `cases` keyword to be used at the top level instead of the `case` keyword for clarity.
* 603: Coconut now supports optional `as x` explicit name-binding syntax in pattern-matching.
* 567: Coconut now supports in-line augmented global/nonlocal assignments.

New compiler features:
* 586, 591 (thanks tbsexton for the issue!): Coconut now has an [official VSCode highlighting extension]().
* 587, 595 (thanks nlipsyc for the PR!): Coconut now supports an `--and src dest` flag for compiling additional files/directories with the same `coconut` command, including splitting the compilation across multiple processes when `--jobs` is passed.
* 497 (thanks matanagasauce for the issue!): Coconut now supports a ` coding: coconut` header in `.py` files to use Coconut syntax along with a `coconut --site-install` command to make all such automatic compilation behavior available without first importing `coconut.convenience`.
* 596, 597 (thanks lazyprop for the PR!): Coconut now supports a `--vi-mode` flag and `COCONUT_VI_MODE` environment variable for enabling `vi` mode in the interpreter.
* 386 (thanks ArneBachmann for the issue!): Coconut will now throw more informative error messages for many common syntax errors.
* 611: Installing all the dependencies that Coconut uses to backport old code is now be done by installing `coconut[backports]` rather than individually as in installing `coconut[asyncio]`.

Bugfixes:
* 577: As long as a `dataclasses` library exists at runtime, all Coconut targets now support `x: int` syntax for specifying the fields of a `dataclass`.
* 578: Bound method are now properly tail call optimized.
* 604: When pattern-matching fails, it should no longer make any variable assignments (though in case of a guard, the variable assignments will still occur prior to the guard being run and will persist if the guard fails).
* 580 (thanks leogao2 for the issue!): Coconut's `parallel_map` is now substantially more efficient in processing very large iterators.
* 602: `or` and `|` in pattern-matching will no longer sometimes run duplicate checks.
* 593: `--no-wrap` now disables `from __future__ import annotations` on Python 3.7+.
* 334: In-place pipe operators are now optimized the same as normal pipe operators.
* 543: Keyword-only function arguments will now raise a more informative error on unsupported targets.
* 588 (thanks servadestroya for the issue!): Coconut will now properly compile vanilla Python destructuring assignment in `with` statements.
* 592 (thanks servadestroya for the issue!): Coconut will now properly concatenate naked `f`-strings placed next to each other.
* 519 (thanks bj0 for the issue!): Coconut will no longer compile `:=` operators inside of `::` expressions to invalid Python.
* 585 (thanks Gurkenglas for the issue!): Coconut now has better handling of permission errors in Jupyter kernel installation.

Coconut `v1.6.0` should also compile about 10% faster on average than Coconut `v1.5.0`.

1.5.0

See Coconut's [documentation](http://coconut.readthedocs.io/en/master/DOCS.html) for more information on everything listed below.

Features
- 545: Added support for embedding a Coconut interpreter for debugging; just `from coconut import embed; embed()`.
- 562: All lazy lists are now reiterable.
- 550: All enhanced built-ins are now reiterable when given an iterable.
- 542: New `None`-aware pipe operators.
- 105: New `zip_longest` built-in.
- 552: Full [PEP 553](https://www.python.org/dev/peps/pep-0553/) (breakpoint built-in) support on all Python versions.
- 531: Add support for `=` specifier in `f`-strings.
- 508: Added `.multiple_sequential_calls()` context managers to `parallel_map` and `concurrent_map`.
- 540: Add `nb_conda_kernel` support (thanks tbsexton for reporting the issue).
- 514, 523: Added `--no-wrap` flag (thanks QuestofIranon for the PR!).
- 547: Added Coconut homebrew installation (thanks SeekingMeaning for making this happen!)

Bugfixes:
- 548: Significantly improve pattern-matching performance.
- 561: Fix Python 3.9 issues (thanks BruceEckel for reporting the issue).
- 551: Fix issues with new Jupyter kernel (thanks regr4 for reporting the issue and bj0 for finding the root cause).
- 281: Fix `coconut --jupyter` calling the wrong Jupyter installation (thanks betabrain for reporting the issue).
- 560: Fix error on non-numeric `setuptools` versions (thanks fabianhjr for the PR!).
- 559: Fix nested `f`-string parsing (thanks bjo for reporting the issue).
- 553: Proper [PEP 563](https://www.python.org/dev/peps/pep-0563/) support (now Coconut doesn't wrap annotations in strings when they'll be deferred anyway).
- 536: Fixes iterator `return`s on all Python versions.
- 541: Prevent accidentally compiling to source files (thanks dryprogrammer for reporting the issue).

1.4.3

See Coconut's [documentation](http://coconut.readthedocs.io/en/master/DOCS.html) for more information on everything listed below.

Bugfixes:
- 527: Coconut once again builds properly on Python 2 (thanks hasufell for the issue!)
- 526: fixes `=` function definition returning string literals not working (thanks vietspaceanh for the issue!)
- attributes now work properly in implicit function application (e.g. `f b.x c.y`)

1.4.2

See Coconut's [documentation](http://coconut.readthedocs.io/en/master/DOCS.html) for more information on all of the features listed below.

Bugfixes:
- 521: prevents Coconut from installing an incompatible version of `cPyparsing` by default
- 515: prevents Coconut from installing `trollius` on Python 3 when doing `pip install coconut[all]` (thanks DennisMitchell for the issue!)

New features:
- 496, 506: `addpattern` now issues a warning if passed a non-pattern-matching function unless `allow_any_func=True` is passed (thanks m-burst for the PR and pavelbraginskiy for the issue!)
- 517: simple implicit function application such as `f x y` is now supported

1.4.1

See Coconut's [documentation](http://coconut.readthedocs.io/en/master/DOCS.html) for more information on all of the features listed below.

New features:
- 465: new `addpattern def` shorthand syntax (thanks MichalMarsalek for the issue!)
- 301, 504, 505: full support for Python 3.6 f-strings on all targets including (thanks m-burst for the PR!)
- 323: added support for `|**>` kwargs pipes (thanks ArneBachmann for the issue!)
- 490: new `(assert)` operator function (thanks arnauorriols for the issue!)
- 503: added support for Python 3.8 positional-only arguments (thanks pavelbraginskiy fo the issue!)
- 483: `fmap` now works on numpy arrays (thanks hoishing for the issue!)
- 494: added support for pattern-matching in `data` definitions (thanks arnauorriols for the issue!)
- 493: added truncation for long MatchError messages (thanks arnauorriols for the issue!)
- 482: added support for Python 3.8 assignment expressions under `--target 3.8` (thanks terrdavis for the issue!)
- 446, 458: `data` types are now hashable (thanks m-burst for the PR!)
- 502: `addpattern`, `recursive_iterator`, and TCO'd functions are now pickleable
- 488: fewer `__coconut__.py` files are created when compiling in `--package` mode

Plus lots and lots of bugfixes!

1.4.0

See Coconut's [documentation](http://coconut.readthedocs.io/en/master/DOCS.html) for more information on all of the features listed below.

New features:
- 320: added import hook to automatically compile imported Coconut files (thanks ArneBachmann!)
- 347: added `where` clauses
- 270: added a `memoize` decorator (thanks iamrecursion!)
- 403: added a `TYPE_CHECKING` constant
- 409: added support for ``M `bind` x -> y`` syntax
- 419: `data` type equality is now typed (thanks everyone in 418!)
- 331: support negative pattern-matching with `match ... not in ...`
- 411: `count` now supports a step size of `0`
- 394: `scan` now has an initializer argument
- 398: creating a new indented block after a colon is no longer necessary for any statement
- 229: `--strict` now warns on unused imports
- 327: interpreter now supports `reload` built-in (thanks, ArneBachmann!)
- 382: interpreter now supports compiling to arbitrary file names
- 393: unicode operators for multiplication and matrix multiplication have been switched
- 153: function composition precedence is now such that `f..g(x)` is the same as `f..(g(x))` not `(f..g)(x)`
- 395: built-in attributes changed to remove initial underscores

Plus lots and lots of bugfixes!

Page 3 of 8

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.