From 84998568dbb5125dcb5a0799cfa01f4acd40b260 Mon Sep 17 00:00:00 2001 From: Fokko Driesprong Date: Thu, 9 Jun 2022 17:52:57 +0200 Subject: [PATCH] Python: Add Poetry IDEA instructions (#4980) --- python/CONTRIBUTING.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/python/CONTRIBUTING.md b/python/CONTRIBUTING.md index 1afa7bd9489b..d760efc9f06e 100644 --- a/python/CONTRIBUTING.md +++ b/python/CONTRIBUTING.md @@ -34,6 +34,22 @@ To get started, you can run `make install`, which will install poetry and it wil If you want to install the library on the host, you can simply run `pip3 install -e .`. If you wish to use a virtual environment, you can run `poetry shell`. Poetry will open up a virtual environment with all the dependencies set. +To set up IDEA with Poetry ([also on Loom](https://www.loom.com/share/6d36464d45f244729d91003e7f671fd2)): + +- Open up the Python project in IntelliJ +- Make sure that you're on a lastest master (that includes Poetry) +- Go to File -> Project Structure (⌘;) +- Go to Platform Settings -> SDKs +- Click the + sign -> Add Python SDK +- Select Poetry Environment from the left hand side bar and hit OK +- It can take some time to download all the dependencies based on your internet +- Go to Project Settings -> Project +- Select the Poetry SDK from the SDK dropdown, and click OK + +For IDEA ≤2021 you need to install the [Poetry integration as a plugin](https://plugins.jetbrains.com/plugin/14307-poetry/). + +Now you're set using Poetry, and all the tests will run in Poetry, and you'll have syntax highlighting in the pyproject.toml to indicate stale dependencies. + ## Linting We rely on `pre-commit` to apply autoformatting and linting: