Skip to main content

Harmony Programming Language

Project description

Harmony

Harmony is a programming language designed for testing and experimenting with concurrent code.

For more information, please visit the official page https://harmony.cs.cornell.edu.

Harmony requires the following to be installed:

  1. Python (version 3.6 or higher)
  2. Graphviz
  3. C Compiler (potentially potential)

In the following instructions, Windows users using WSL should follows instructions for Linux.

For users of a Cornell CS Department Linux machine, e.g. <netid>@ugclinux.cs.cornell.edu, you likely do not need to install Python3 or Graphviz because they may be available already. However, you can verify that they are available by running python3 --version and dot -V respectively.

Installing Python3

Harmony requires Python (version 3.6 or higher) to be installed. If you do not have Python3 already installed, download and install Python depending on your OS (Windows, Mac, Linux, etc) on the official Python site. Be sure to download the installer for Python version 3.6 or higher.

In the installer, the default installation settings will also add pip. If you choose to run the installer with custom settings, be sure that pip gets installed.

On the command line, you can check if Python has been successfully installed by running the following:

python --version

## If python does not work or if python gives version 2.X
python3 --version

Installing Graphviz

Harmony uses Graphviz to visualize the state changes in a program. For example, the following Harmony program can produce the subsequent graph.

# Filename: example.hny
def a():
    print "A"

def b():
    print "B"

spawn a()
spwan b()

# Run with [harmony -o example.png example.hny]

Dot output using example.hny

Instructions for installing the latest version of Graphviz can be found here.

For Windows users, when running the installer, make sure to select the option Add Graphviz to the system PATH for current user so that the command dot is available to produce the graphs.

Install Harmony via Pip

After installing python, you should also be able to use the command pip. Run the following command to get the latest version of Harmony:

pip install --user harmony

## If pip fails try pip3
pip3 install --user harmony

For Windows Users

For Windows users: you may encounter the error message along the lines of the following when installing harmony:

error: Microsoft Visual C++ 14.0 or greater is required. Get it with
"Microsoft C++ Build Tools": <link to visual studio - cpp build tools>

This is to be expected if you had not installed the "Microsoft C++ Build Tools" before. Navigate to the outputted link and press Download Build Tools to download the installer. When you run the installer, you will encounter a selection screen such as the following:

Workload installation selection screen

Select Desktop development with C++ in the Desktop & Mobile section and then install.

Select the workload and install

Note that this will likely take a while. When it finishes installing, run pip install harmony again.

For CS Deparment Linux Machine Users

It may be possible that pip is not available on your Linux machine. In that case, you will need to download and build the source code directly.

Go to https://pypi.org/project/harmony/#files. There, you should find a harmony-1.2.x.tar.gz for the latest version of Harmony. Download the file onto your local machine and then send it to the Linux machine via scp.

Alternatively, you can download the file directly from the Linux machine via wget. Right click on the download link to the file and copy the link address. Then on the Linux machine, run the following:

wget <link copied from pypi.org>

Once you have the tar.gz file on your Linux machine, run the following commands:

# Change the version number accordingly if necessary
gzip -d harmony-1.2.2767.tar.gz
tar -xf harmony-1.2.2767.tar
cd harmony-1.2.2767
python3 setup.py install --user

You can find the latest releases here.

Afterward, you will likely need to add the directory with the harmony command to your environment PATH. You can get the directory with the script by running python3 -m site --user-base, which will output something like /home/<net-id>/.local. Add this directory to your PATH (See here for more information on how to do so).

Adding Scripts to PATH

When installing Harmony, you may encounter a warning on the command line of something like the following:

WARNING: The script harmony is installed in '/path/with/harmony/' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

If you do not see this warning, then you can continue.

Otherwise, add that path displayed in the message to your PATH variable. See here for extra information on editing the PATH variable.

Command-Line Harmony

Once you have installed harmony, you should be able to use the harmony command on your command line.

You check which version you have by running harmony --version.

Harmony on VSCode

Harmony is available as an extension on VSCode, which includes syntax highlighting and basic parser checks.

Please see here for a guide on the basic usage of the VSCode extension.

Updating Harmony

Harmony can be updated by running the following pip command on the command line:

pip install --upgrade harmony

In Harmony versions 1.2.0 and higher, the compiler will output a warning if the currently installed version of Harmony is outdated and an updated one can be installed.

Troubleshooting

The following section provides some guide for how to resolve common issues.

Modifying your PATH variable

Windows:

Search for Edit environment variables in the search bar. You can add it either to the Path associated with your account or the system Path.

A pane with sections

Select the variable Path in the user variables section and then click "Edit", which opens a new pane.

Hover over the new button

Click "New" to add a new path, for example, the directory containing gcc or the pip scripts.

Add new path

Complete your changes by pressing "Ok".

You will have to restart your command line (and VSCode if you are using the extension) to have the changes take effect.

MacOS / Linux:

Open the Terminal application. Check which shell is running on the Terminal. You check which one you have by running echo "$SHELL".

The following instructions are for bash and zsh. Open the ~/.bash_profile file (for bash users) or the ~/.zsh_profile file (for zsh users) using your favorite text editor, such as vim, nano, emacs, or TextEdit. Then, add the following command to the end of the file, where /path/to/add is to be substituted:

export PATH=$PATH:/path/to/add/

Save the file.

You will have to restart Terminal (and VSCode if you are using the extension) to have the changes take effect.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

harmony-1.2.3127.tar.gz (199.8 kB view details)

Uploaded Source

Built Distributions

harmony-1.2.3127-cp310-cp310-win_amd64.whl (298.7 kB view details)

Uploaded CPython 3.10 Windows x86-64

harmony-1.2.3127-cp39-cp39-win_amd64.whl (298.7 kB view details)

Uploaded CPython 3.9 Windows x86-64

harmony-1.2.3127-cp38-cp38-win_amd64.whl (298.7 kB view details)

Uploaded CPython 3.8 Windows x86-64

harmony-1.2.3127-cp37-cp37m-win_amd64.whl (298.7 kB view details)

Uploaded CPython 3.7m Windows x86-64

harmony-1.2.3127-cp36-cp36m-win_amd64.whl (303.6 kB view details)

Uploaded CPython 3.6m Windows x86-64

File details

Details for the file harmony-1.2.3127.tar.gz.

File metadata

  • Download URL: harmony-1.2.3127.tar.gz
  • Upload date:
  • Size: 199.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.9.6 requests/2.27.1 requests-toolbelt/0.10.1 tqdm/4.64.1 CPython/3.6.15

File hashes

Hashes for harmony-1.2.3127.tar.gz
Algorithm Hash digest
SHA256 c6df7da6f1cd02be6af5f36c7364c3988de96816113e430df3aa5413421b8e87
MD5 c039c36574f66d1e474d006803edc85d
BLAKE2b-256 ca06130a2234bb3dfba85b9365715a83ee3c71f29f92e8d125bd3b94ebe2a5a4

See more details on using hashes here.

File details

Details for the file harmony-1.2.3127-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: harmony-1.2.3127-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 298.7 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.12.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9

File hashes

Hashes for harmony-1.2.3127-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3197d6219a224804ee764c78c6b7f6cad36b2f8d03eb48e29a38c59c04d903df
MD5 2572c12f6f80ae9f4d7e5b0f2f8b847c
BLAKE2b-256 455e8da24a805e343a9210304e7a3c19b6926fb23bf696251ef7034c07ca6a71

See more details on using hashes here.

File details

Details for the file harmony-1.2.3127-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: harmony-1.2.3127-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 298.7 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.12.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9

File hashes

Hashes for harmony-1.2.3127-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 da94162d5d4e1ed6f2a807c088be7a262531b0b3f8bc54e63cf3f302fbf56a36
MD5 99f4c0977caed8bf3ebba4e557de49ce
BLAKE2b-256 4ded3119537e4905ce5a4270d8664da337edd3d9da704d4bf9b64a688de117fd

See more details on using hashes here.

File details

Details for the file harmony-1.2.3127-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: harmony-1.2.3127-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 298.7 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.12.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9

File hashes

Hashes for harmony-1.2.3127-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 513d7b8241e01253d2c1df188d78fa7bc8528650323f17c7ef1e1519861b9020
MD5 9e3b1f439d40fc0ef2635ed4787265c5
BLAKE2b-256 447cf554e9c70cc6d653611bf9c70d8c25307b3fc00c7ace5e06ed92f4db89cc

See more details on using hashes here.

File details

Details for the file harmony-1.2.3127-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: harmony-1.2.3127-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 298.7 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.12.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9

File hashes

Hashes for harmony-1.2.3127-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 f3bbe02ee6b074c3a0d0b2cd2eb6b0f9e04a287b5352027e58b46e9575d9e301
MD5 1c8e38847c6b731a42e506d6cd5ac8b1
BLAKE2b-256 118f2fdb551af3bdbb30203734fa8c0df3f01027ee3b040764e67969acbc9763

See more details on using hashes here.

File details

Details for the file harmony-1.2.3127-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: harmony-1.2.3127-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 303.6 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.12.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9

File hashes

Hashes for harmony-1.2.3127-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 da5d6aba2642e6642371d80c81ce8dae631f0d791bd273c03cbb23678736861c
MD5 a812e2dd9acafaf49e5573ea02545747
BLAKE2b-256 cc4ce5c8be0c8a5a89f4964ae8b2ae1d1229cd9623c4728c668f1fcb56ebfc00

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page