PolySwarmPolySwarmPolySwarmPolySwarm
Help

(Optional) Using Pycharm as Your IDE

安裝

JetBrains 下載頁面下載 PytCharm 安裝程序。 免費的“社區版”對 PolySwarm 開發已足夠。 下載安裝程序後,請按照針對您操作系統的說明進行安裝。


啟動一個新的 PolySwarm 開發項目

For these instructions, we assume that you've already created your project directory using cookiecutter on our participant-template. 因此,我們將使用這些說明中的同樣的引擎目錄 (microngine-eicar)。

用現有源代碼創建項目

按照 PytCharm 文檔中的從現有的源代碼創建項目的步驟,創建您的項目。 當您需要選擇包含您的源代碼的目錄時,請選擇 microngine-eicar 目錄。

自定義項目設置

現在您已經創建了 PyCharm 項目,我們可以配置這些設置。

標記源

在 PytCharm 窗口左邊框中有項目目錄的名稱。 單擊箭頭展開文件列表。 然後,右鍵單擊 src dir,並選擇 Mark Directory as,然後選擇 Sources Root

選擇 Python 解釋器

接下來,我們需要為此項目設置 Python 解釋器。

  • In the File menu, select the Settings option.
  • In the Settings page, select Project: microengine-eicar 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 依賴關係

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.