Hy

Latest version: v0.28.0

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

Scan your dependencies

Page 2 of 6

0.26.0

=============================

Removals
------------------------------
* Coloring error messages and Python representations for models is no
longer supported. (Thus, Hy no longer depends on `colorama`.)

Other Breaking Changes
------------------------------
* Various warts have been smoothed over in the syntax of `'`,
\`, `~`, and `~`:

* Whitespace is now allowed after these syntactic elements. Thus one
can apply `~` to a symbol whose name begins with "".
* \` and `~` are no longer allowed in identifiers. (This was already
the case for `'`.)
* The bitwise NOT operator `~` has been renamed to `bnot`.

* Dotted identifiers like `foo.bar` and `.sqrt` now parse as
expressions (like `(. foo bar)` and `(. None sqrt)`) instead of
symbols. Some odd cases like `foo.` and `foo..bar` are now
syntactically illegal.
* New macro `do-mac`.
* New macro `pragma` (although it doesn't do anything useful yet).
* `hy.cmdline.HyREPL` is now `hy.REPL`.
* Redundant scripts named `hy3`, `hyc3`, and `hy2py3` are no longer
installed. Use `hy`, `hyc`, and `hy2py` instead.

New Features
------------------------------
* Pyodide is now officially supported.
* `.`, `..`, etc. are now usable as ordinary symbols (with the
remaining special rule that `...` compiles to `Ellipsis`).
* On Pythons ≥ 3.7, Hy modules can now be imported from ZIP
archives in the same way as Python modules, via `zipimport`_.
* `hy2py` has a new command-line option `--output`.
* `hy2py` can now operate recursively on a directory.

Bug Fixes
------------------------------
* `hy.REPL` now restores the global values it changes (such as
`sys.ps1`) after `hy.REPL.run` terminates.
* `hy.REPL` no longer mixes up Hy's and Python's Readline histories
when run inside Python's REPL.
* Fixed `hy.repr` of non-compilable uses of sugared macros, such as
`(quote)` and `(quote 1 2)`.

.. _zipimport: https://docs.python.org/3.11/library/zipimport.html

0.25.0

==============================

Breaking Changes
------------------------------
* `dfor` no longer requires brackets around its final arguments, so
`(dfor x (range 5) [x (* 2 x)])` is now `(dfor x (range 5) x (* 2
x))`.
* `except*` (PEP 654) is now recognized in `try`, and a placeholder
macro for `except*` has been added.

Bug Fixes
------------------------------
* `__file__` should now be set the same way as in Python.
* `\N{…}` escape sequences are now recognized in f-strings.
* Fixed a bug with `python -O` where assertions were still partly
evaluated.
* Fixed `hy.repr` of `slice` objects with non-integer arguments.

New Features
------------------------------
* Python 3.11 is now supported.

Misc. Improvements
------------------------------
* `hyc` now requires a command-line argument.
* `hyc` prints each path it writes bytecode to, and its messages now
go to standard error instead of standard output.

0.24.0

==============================

This release is a direct successor to 1.0a4. We've returned to 0.*
version numbers to work around the inflexibility of PyPI and pip
regarding the default version to install. (We skipped some version
numbers because this release is several major releases since 0.20.0.)
Sorry for the mess.

Removals
------------------------------
* Tag macros have been removed. Use reader macros instead, rewriting
`(defmacro "foo" [arg] …)` as
`(defreader foo (setv arg (.parse-one-form &reader)) …)`.
* `with-decorator` and `` have been removed in favor of decorator
lists (see below).
* Fraction literals have been removed. Use `fractions.Fraction`
instead.
* Unrecognized backslash escapes in string and byte literals are
no longer allowed. (They've been `deprecated in Python since 3.6
<https://docs.python.org/3.6/reference/lexical_analysis.html#index-23>`_.)
* A bare `` is no longer a legal symbol.
* `u` is no longer allowed as a string prefix. (It had no effect,
anyway.)
* `hy.read-str` has been removed. Use `hy.read`, which now accepts
strings, instead.

Other Breaking Changes
------------------------------
* Tuples are now indicated with `( … )`, as in `(1 2 3)`, instead of
`(, … )`, as in `(, 1 2 3)`.
* Tuples have their own model type, `hy.models.Tuple`, instead of
being represented as `Expression`\s.
* `if` now requires all three arguments. For the two-argument case
(i.e., with no else-clause), `when` is a drop-in replacement.
* `cond` has a new unbracketed syntax::

(cond [a b] [x y z]) ; Old
(cond a b x (do y z)) ; New

* `defmacro` once again requires the macro name as a symbol, not
a string literal.
* Annotations are now indicated by `^` instead of `^`.
* `annotate` (but not `^`) now takes the target first and the type
second, as in `(annotate x int)`.
* The way f-strings are parsed has changed, such that unescaped double
quotes are now allowed inside replacement fields.
* Non-ASCII whitespace is no longer ignored during tokenization like
ASCII whitespace.
* The mangling rules have been refined to account for Python's
treatment of distinct names as referring to the same variable if
they're NFKC-equivalent. Very little real code should be affected.
* `hy.cmdline.run_repl` has been replaced with
`hy.cmdline.HyREPL.run`.

New Features
------------------------------
* Added user-defined reader macros, defined with `defreader`.
* `defn` and `defclass` now allow a decorator list as their first
argument.
* `...` is now understood to refer to `Ellipsis`, as in Python.
* Python reserved words are allowed once more as parameter names and
keyword arguments. Hy includes a workaround for a CPython bug that
prevents the generation of legal Python code for these cases
(`cpython90678`_).
* New macro `export`.

- Or you can set the variable `_hy_export_macros` to control what
macros are collected by `(require module *)`.

* New macro `delmacro`.
* New function `hy.read_many`.
* New function `hy.model_patterns.parse_if`.
* New function `hy.model_patterns.in_tuple`.
* Added a command-line option `-u` (or `--unbuffered`) per CPython.
* Tab-completion in the REPL now attempts to unmangle names.

Bug Fixes
------------------------------
* Fixed a crash when using keyword objects in `match`.
* Fixed a scoping bug in comprehensions in `let` bodies.
* Literal newlines (of all three styles) are now recognized properly
in string and bytes literals.
* `defmacro` no longer allows further arguments after `* args`.
* `!=` with model objects is now consistent with `=`.
* Tracebacks from code parsed with `hy.read` now show source
positions.
* Elements of `builtins` such as `help` are no longer overridden until
the REPL actually starts.
* Readline is now imported only when necessary, to avoid triggering a
CPython bug regarding the standard module `curses`
(`cpython46927`_).
* Module names supplied to `hy -m` are now mangled.
* Hy now precompiles its own Hy code during installation.

.. _cpython46927: https://github.com/python/cpython/issues/46927#issuecomment-1093418916
.. _cpython90678: https://github.com/python/cpython/issues/90678

0.20.0

==============================

Removals
------------------------------
* Python 3.5 is no longer supported.

New Features
------------------------------
* `let` macro now supports extended iterable unpacking syntax.
* New contrib module `pprint`, a Hy equivalent of `python.pprint`.

Bug Fixes
------------------------------
* Fixed a bug that made `hy.eval` from Python fail on `require`.
* Fixed a bug that prevented pickling of keyword objects.
* Fixed a compiler crash from `setv` with an odd number of arguments in
`defclass`.

0.19.0

==============================

Breaking Changes
------------------------------
* `parse-args` is no longer implemented with `eval`; so e.g. you should
now say `:type int` instead of `:type 'int`.

New Features
------------------------------
* Python 3.9 is now supported.

Bug Fixes
------------------------------
* Improved support for nesting anaphoric macros by only applying
symbol replacement where absolutely necessary.
* Quoted f-strings are no longer evaluated prematurely.
* Fixed a regression in the production of error messages for empty
expressions.
* Fixed a scoping bug for code executed with `hy -c`.
* Fixed a bug in the compilation of multiple `require`\s.
* Fixed various bugs in command-line option parsing.

0.18.0

==============================

Removals
------------------------------
* Python 2 is no longer supported.
* Support for attribute lists in `defclass` has been removed. Use `setv`
and `defn` instead.
* Literal keywords are no longer parsed differently in calls to functions
with certain names.
* `hy.contrib.multi` has been removed. Use `cond` or the PyPI package
`multipledispatch` instead.

Other Breaking Changes
------------------------------
* `HySequence` is now a subclass of `tuple` instead of `list`.
Thus, a `HyList` will never be equal to a `list`, and you can't
use `.append`, `.pop`, etc. on a `HyExpression` or `HyList`.

New Features
------------------------------
* Added special forms `py` to `pys` that allow Hy programs to include
inline Python code.
* Added a special form `cmp` for chained comparisons.
* All augmented assignment operators (except `%=` and `^=`) now allow
more than two arguments.
* Added support for function annotations (PEP 3107) and variable
annotations (PEP 526).
* Added a function `parse-args` as a wrapper for Python's `argparse`.

Bug Fixes
------------------------------
* Statements in the second argument of `assert` are now executed.
* Fixed a bug that caused the condition of a `while` to be compiled
twice.
* `in` and `not-in` now allow more than two arguments, as in Python.
* `hy2py` can now handle format strings.
* Fixed crashes from inaccessible history files.
* Removed an accidental import from the internal Python module `test`.
* Fixed a swarm of bugs in `hy.extra.anaphoric`.

Misc. Improvements
------------------------------
* Replaced the dependency `clint` with `colorama`.

Page 2 of 6

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.