Releases: hylang/hy
1.1.0 ("Business Hugs")
Supports Python 3.9 – Python 3.14
New Features
- New pragma
hy.
Misc. Improvements
- Added compatibility with setuptools 80.3.0.
Bug Fixes
- Fixed a crash from using an empty string in a
(. …)expression. (except [[]] …)now catches no exceptions, rather than being treated like(except [] …), which catches all exceptions.(except [e []] …)is now translated to Python correctly byhy2py.- Fixed a bug where logical ops starting with a
(setv …)expression failed to compile. - A complex
imagargument tohy.models.Complexis no longer allowed.
1.0.0 ("Afternoon Review")
Supports Python 3.8 – Python 3.13
See also the announcement post for this release.
Bug Fixes
- Fixed a crash on Python 3.12.6.
- Keyword objects can now be compared to each other with
<etc. - The order of evaluation in multi-item
withs now matches that of nested one-itemwiths. - Fixed a bug in which the REPL misinterpreted the symbol
pass.
0.29.0
Removals
hy.disassemblehas been removed.(defn/a …)is now(defn :async …).(fn/a …)is now(fn :async …).(with/a […] …)is now(with [:async …] …).- As with
for,:asyncmust precede each name to be bound asynchronously, because you can mix synchronous and asynchronous types.
- As with
(yield-from …)is now(yield :from …).
New Features
- You can now set
repl-ps1andrepl-ps2in yourHYSTARTUPto customizesys.ps1andsys.ps2for the Hy REPL.
Bug Fixes
- Tracebacks now point to the correct code in more cases.
helpshould no longer crash when objects are missing docstrings.hy -i < script.hynow executesscript.hyinside the REPL environment, like Python.
0.28.0
Removals
dochas been removed. Use(help (get-macro foo))or(help (get-macro :reader foo))instead.delmacrohas been removed. Use(eval-when-compile (del (get _hy_macros (hy.mangle "foo"))))instead.hy.reservedhas been removed. Use(.keys (builtins._hy_macros))or Python's built-inkeywordmodule instead.- The environment variables
HY_DEBUGandHY_FILTER_INTERNAL_ERRORShave been replaced withHY_SHOW_INTERNAL_ERRORS.
Other Breaking Changes
defmacroandrequirecan now define macros locally instead of only module-wide.- When a macro is
require\d from another module, that module is no longer implicitly included when checking for further macros in the expansion. hy.Mhas been renamed tohy.I.hy.evalhas been overhauled to be more like Python'seval. It also has a new parametermacros.hy.macroexpandandhy.macroexpand-1have been overhauled and generalized to include more of the features ofhy.eval.hynow only implicitly launches a REPL if standard input is a TTY.hy -ihas been overhauled to work as a flag likepython3 -i.hy2pynow requires-mto specify modules, and uses the samesys.pathrules as Python when parsing a module vs a standalone script.- New macro
deftype. - New macro
get-macro. - New macro
local-macros.
New Features
- New syntax
(hy.R.aaa/bbb.m …)for calling the macromfrom the moduleaaa.bbbwithout bringingmoraaa.bbbinto scope. nonlocalnow also works for globally defined names.defn,defn/a, anddefclassnow support type parameters.HyReadernow has an optional parameter to install existing reader macros from the calling module.- New pragma
warn-on-core-shadow.
Misc. Improvements
- Some syntax errors raised by core macros now have more informative messages.
- Logical operators now compile to simpler Python code in some cases.
Bug Fixes
- Implicit returns are now disabled in async generators.
- Fixed parsing of infinite and NaN imaginary literals with an uppercase "J".
- Double quotes inside of bracketed f-strings are now properly handled.
- Fixed incomplete recognition of macro calls with a unary dotted head like
((. defn) f []). ~@ #*now produces a syntax error instead of a nonsensical result.nonlocalnow works for top-levellet-bound names.requirenow warns when you shadow a core macro, likedefmacroalready did.- Fixed
hy.evalfailing ondefreaderorrequireforms that install a new reader. - The parameter
result-okthat was mistakenly included in the signature ofhy.macroexpandis now gone. hy -iwith a filename now skips shebang lines.
0.27.0
Removals
- Python 3.7 is no longer supported.
Other Breaking Changes
- Reader macros now always read a full identifier after the initial
#. Thus,#*foois now parsed as a call to the reader macro named*foo; to unpack a variable namedfoo, say#* foo. - The names of reader macros names are no longer mangled.
- Question marks (
?) are no longer mangled specially, sofoo?now mangles tohyx_fooXquestion_markXinstead ofis_foo. hy2py's recursive mode now expects a module name as input, not any old directory. You must be in the parent directory of the module directory.
New Features
- Python 3.12 is now supported.
- New built-in object
hy.Mfor easy imports in macros. cutnow has a function version inhy.pyops.- The
pymacro now implicitly parenthesizes the input code, so Python's indentation restrictions don't apply. tryno longer requiresexcept,except*, orfinally, and it allowselseeven withoutexceptorexcept*.nonlocalandglobalcan now be called with no arguments, in which case they're no-ops.- For easier reading,
hy --spynow prints a delimiter after the Python equivalent of your code, before the result of evaluating the code.
Bug Fixes
- Fixed an installation failure in some situations when version lookup fails.
- Fixed some bugs with traceback pointing.
- Fixed some bugs with escaping in bracket f-strings
- The parser no longer looks for shebangs in the REPL or
hy -c. requirewith relative module names should now work correctly withhy -m, as well ashy2py's recursive mode.hy.models.Symbolno longer allows constructing a symbol beginning with#.
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 tobnot.
- Whitespace is now allowed after these syntactic elements. Thus one can apply
-
Dotted identifiers like
foo.barand.sqrtnow parse as expressions (like(. foo bar)and(. None sqrt)) instead of symbols. Some odd cases likefoo.andfoo..barare now syntactically illegal. -
New macro
do-mac. -
New macro
pragma(although it doesn't do anything useful yet). -
hy.cmdline.HyREPLis nowhy.REPL. -
Redundant scripts named
hy3,hyc3, andhy2py3are no longer installed. Usehy,hyc, andhy2pyinstead.
New Features
- Pyodide is now officially supported.
.,.., etc. are now usable as ordinary symbols (with the remaining special rule that...compiles toEllipsis).- On Pythons ≥ 3.7, Hy modules can now be imported from ZIP archives in the same way as Python modules, via
zipimport_. hy2pyhas a new command-line option--output.hy2pycan now operate recursively on a directory.
Bug Fixes
hy.REPLnow restores the global values it changes (such assys.ps1) afterhy.REPL.runterminates.hy.REPLno longer mixes up Hy's and Python's Readline histories when run inside Python's REPL.- Fixed
hy.reprof non-compilable uses of sugared macros, such as(quote)and(quote 1 2).
0.25.0
Breaking Changes
dforno 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 intry, and a placeholder macro forexcept*has been added.
New Features
- Python 3.11 is now supported.
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 -Owhere assertions were still partly evaluated. - Fixed
hy.reprofsliceobjects with non-integer arguments.
Misc. Improvements
hycnow requires a command-line argument.hycprints 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-decoratorand#@have been removed in favor of decorator lists (see below).- Fraction literals have been removed. Use
fractions.Fractioninstead. - Unrecognized backslash escapes in string and byte literals are no longer allowed. (They've been deprecated in Python since 3.6.)
- A bare
#is no longer a legal symbol. uis no longer allowed as a string prefix. (It had no effect, anyway.)hy.read-strhas been removed. Usehy.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 asExpression\s. -
ifnow requires all three arguments. For the two-argument case (i.e., with no else-clause),whenis a drop-in replacement. -
condhas a new unbracketed syntax:(cond [a b] [x y z]) ; Old (cond a b x (do y z)) ; New -
defmacroonce 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_replhas been replaced withhy.cmdline.HyREPL.run.
New Features
-
Added user-defined reader macros, defined with
defreader. -
defnanddefclassnow allow a decorator list as their first argument. -
...is now understood to refer toEllipsis, 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 (cpython#90678).
-
New macro
export.- Or you can set the variable
_hy_export_macrosto control what macros are collected by(require module *).
- Or you can set the variable
-
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
letbodies. - Literal newlines (of all three styles) are now recognized properly in string and bytes literals.
defmacrono longer allows further arguments after#* args.!=with model objects is now consistent with=.- Tracebacks from code parsed with
hy.readnow show source positions. - Elements of
builtinssuch ashelpare 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(cpython#46927). - Module names supplied to
hy -mare now mangled. - Hy now precompiles its own Hy code during installation.
1.0a4
Removals
- Python 3.6 is no longer supported.
Other Breaking Changes
-
importandrequireno longer need outer brackets.(import [foo [bar]])is now(import foo [bar])and(import [foo :as baz])is now(import foo :as baz). To import all names from a module, use(import foo *). -
Lots of objects (listed below) have been spun off to a new package called Hyrule, from which you can
importorrequirethem. Thus Hy now brings only thehymodule and a limited set of core macros into scope automatically.- Functions:
butlast,coll?,constantly,dec,destructure,distinct,drop-last,end-sequence,flatten,inc,macroexpand-all,parse-args,pformat,postwalk,pp,pprint,prewalk,readable?,recursive?,rest,saferepr,walk - Classes:
PrettyPrinter,Sequence - Macros:
#%,#:,->,->>,ap-dotimes,ap-each,ap-each-while,ap-filter,ap-first,ap-if,ap-last,ap-map,ap-map-when,ap-reduce,ap-reject,as->,assoc,cfor,comment,defmacro!,defmacro/g!,defmain,defn+,defn/a+,defseq,dict=:,do-n,doto,fn+,fn/a+,ifp,let+,lif,list-n,loop,ncut,of,profile/calls,profile/cpu,seq,setv+,smacrolet,unless,with-gensyms
- Functions:
-
Functions that provide first-class Python operators, such as
+in constructs like(reduce + xs), are no longer brought into scope automatically. Say(import hy.pyops *)to get them. -
Hy scoping rules more closely follow Python scoping in certain edge cases.
-
letis now a core macro with somewhat different semantics. In particular, definition-like core macros (defn,defclass,import) now introduce new names that shadow correspondinglet-bound names and persist outside the body of thelet. -
The constructors of
StringandFStringnow check that the input would be syntactically legal as a literal. -
hy.extra.reservedhas been renamed tohy.reserved.
New Features
hy.reprnow supports several more standard types.- The attribute access macro
.now allows method calls. For example,(. x (f a))is equivalent to(x.f a). hy.as-modelchecks for self-references in its argument.- New function
hy.model_patterns.keepsym.
Bug Fixes
- In comprehension forms other than
for, assignments (other than:setvand loop clauses) are now always visible in the surrounding scope. matchnow only evaluates the subject once.letwill no longer re-evaluate the default arguments of a
function it's used in.hy.reprnow properly formats bracket strings.- The
reprandstrof string models now includebracketsif necessary. - When standard output can't accommodate Unicode,
hy2pynow crashes instead of emitting incorrect Python code. - Fixed a bug with self-requiring files on Windows.
- Improved error messages for illegal uses of
finallyandelse.
1.0a3
Bug Fixes
- Fixed a dependency-management bug that prevented installation of Hy from a wheel on Pythons < 3.9.