Command Line Interface


Command Line Options

-c <command>

Execute the Hy code in command.

$ hy -c "(print (+ 2 2))"
-i <command>

Execute the Hy code in command, then stay in REPL.

-m <module>

Execute the Hy code in module, including defmain if defined.

The -m flag terminates the options list so that all arguments after the module name are passed to the module in sys.argv.

New in version 0.11.0.


Print equivalent Python code before executing in REPL. For example:

=> (defn salutationsnm [name] (print (+ "Hy " name "!")))
def salutationsnm(name):
    return print('Hy ' + name + '!')
=> (salutationsnm "YourName")
Hy YourName!

–spy only works on REPL mode. .. versionadded:: 0.9.11


Format REPL output using specific function (e.g., repr)

New in version 0.13.0.


Print the Hy version number and exit.


hy2py is a program to convert Hy source code into Python source code. Use hy2py --help for usage instructions. It can take its input from standard input or from a filename provided as a command-line argument. The result is written to standard output.


hy2py can execute arbitrary code. Don’t give it untrusted input.


hyc is a program to compile files of Hy code into Python bytecode. Use hyc --help for usage instructions. The generated bytecode files are named and placed according to the usual scheme of your Python executable, as indicated by importlib.util.cache_from_source().


hyc can execute arbitrary code. Don’t give it untrusted input.