Install
Pyking is one program, pyk, together with its standard library.
Compiling, interpreting and the REPL need nothing else.
macOS
Install with Homebrew:
brew install pyking-lang/tap/pykingbrew upgrade pyking updates it and brew uninstall pyking removes it.
Linux and WSL
curl -fsSL https://github.com/pyking-lang/pyking-releases/releases/latest/download/install.sh | shThis installs the latest release for your user, with no sudo: pyk goes
in ~/.local/bin/. Add that directory to your PATH if the installer says
it is not there. Run the command again to update. Options go after
sh -s --:
curl -fsSL …/install.sh | sh -s -- --system # for every user, in /usr/local (sudo)curl -fsSL …/install.sh | sh -s -- --version 0.2.0 # a given releasecurl -fsSL …/install.sh | sh -s -- --uninstall # remove itOn Debian and Ubuntu, a .deb package is also available:
curl -fLO https://github.com/pyking-lang/pyking-releases/releases/latest/download/pyking_amd64.debsudo apt install ./pyking_amd64.deb # pyking_arm64.deb on ARMNix
On Linux and macOS, with flakes enabled:
nix run github:pyking-lang/pyking-releases -- hello.pyk # run it without installingnix profile install github:pyking-lang/pyking-releases # install pyknix profile upgrade pyking-releases updates it and nix profile remove pyking-releases removes it.
Docker
The image runs pyk in the current directory, which is the container’s
/work:
docker run --rm -it -v "$PWD:/work" ghcr.io/pyking-lang/pyking hello.pykdocker run --rm -it -v "$PWD:/work" ghcr.io/pyking-lang/pyking # the REPLTo use the playground, the notebook or the help, publish the port and open the link it prints:
docker run --rm -p 8000:8000 ghcr.io/pyking-lang/pyking playground --port 8000ghcr.io/pyking-lang/pyking:full also holds Python, node, a C compiler, a
JDK and OCaml, so pyk compile --run works for every target.
Check the installation
pyk --versionSave this program as hello.pyk:
Then run it with the interpreter, or compile it and run the result:
pyk hello.pyk # run it with the interpreterpyk compile -t python hello.pyk # write hello.pypyk compile -t node --run hello.pyk # compile to JavaScript and run it with nodeTo start from an example instead, list them and save one in the current directory:
pyk example # one example per linepyk example use_args.pyk # save it herepyk use_args.pyk -- 3 'Hello world!' # and run itThe playground’s Examples menu offers the same ones.
What else you may need
pyk notebookandpyk playgroundneed nothing more:pykserves them itself.- Running compiled output needs that target’s own tools:
nodefor JavaScript, a C compiler for C, a JDK for Java,ocamloptfor OCaml andpython3for Python. Compiling alone needs none of them. - Interpreting a program that has an external module of its own needs the
OCaml compiler
pykwas built with. The standard library works without it.