PolySwarm

This page is available in English.

このページは日本語でもご利用いただけます。

Using PyCharm as your IDE

Installation

Download the PyCharm installer from the JetBrains download page. The free “Community Edition” is sufficient for PolySwarm development. Once you’ve downloaded the installer, follow the instructions for your operating system to install it.

Starting a new PolySwarm development project

For these instructions, we assume that you’ve already created your project directory using cookiecutter on our engine-template. So, we will use the same engine directory name from those instructions (microengine-myeicarengine).

Create project from existing source code

Follow the steps in the PyCharm documentation for Creating projects from existing source code to create your project. When you need to select the directory with your source code, select the microengine-myeicarengine directory.

Configure project settings

Now that you have a PyCharm project created, we can configure the settings.

Mark sources

In the left frame of the PyCharm window, it has the name of your project directory. Click on the arrow to expand the file listing. Then, right-click on the src dir and select Mark Directory as, then select Sources Root.

Select Python interpreter

Next, we need to set your Python Interpreter for this project.

In the File menu, select the Settings option. In the Settings page, select Project: microengine-myeicarengine and then Project Interpreter. In the right frame is where you can configure your project interpreter. Click the gear icon to the right of the project interpreter box. Select Add. In the Add Python Interpreter window, make sure Python Virtual Environment is selected in the left frame. In the right frame, select the Existing environment radio button. Then click the 3-dots icon next to the Interpreter box. This will open a window where you can browse to find your virtual environment. Browse to find the polyswarmvenv virtual environment that you made during the development environment setup. In there, you need to select bin and then select python and then you can click the Ok button on each window to save your choices.

Python dependencies

Now that your project is configured, you may be prompted by a pop-up to “Install requirements”. When asked, select the option to install the requirements.

What this is doing is automatically examining your requirements.txt file and comparing the Python packages listed in that file with the Python packages that are already installed in your virtual environment. If any are missing, it will prompt you to install them.

You should now have a PyCharm development environment ready for microengine development.