Skip to content

Commit

Permalink
docs: setting up PyCharm
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-reimann committed Apr 16, 2023
1 parent 7ebc5a1 commit 3740894
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions docs/development/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ You must complete these steps once before you can start setting up the project i
```
If this fails, add the directory that contains the `python` executable to your `PATH` environment variable.

3. Install [Poetry](https://python-poetry.org/docs/master/#installing-with-the-official-installer) with the official installer. Follow the instructions in the linked document for your operating system.
3. Install [Poetry](https://python-poetry.org/docs/master/#installing-with-the-official-installer) with the official installer. Follow the instructions for your operating system in the linked document.
4. Verify that `poetry` can be launched by running this command in a **new** terminal:
```shell
poetry --version
Expand All @@ -32,30 +32,34 @@ Follow the instructions for your preferred IDE. If you want to use neither [PyCh

1. Clone the repository.
2. Open the project folder in PyCharm.
3. Follow the instructions in the [PyCharm documentation](https://www.jetbrains.com/help/pycharm/poetry.html#poetry-env) to create a **new** Poetry environment and to install the dependencies of the project.
4. Open the PyCharm settings and search for "Python Integrated Tools". Set the "Default test runner" to "pytest" and the "Docstring format" to "NumPy". Your settings should look like this:
![PyCharm settings "Python Integrated Tools"](./img/pycharm_python_integrated_tools.png)

=== "Visual Studio Code"

1. Clone the repository.
2. Open the project folder in Visual Studio Code.
3. Install the [Python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python).
4. Create a new virtual environment and install the dependencies of this project by running this command:
4. Create a new Poetry environment and install the dependencies of the project by running this command:
```shell
poetry install
```
5. Find the path to the virtual environment that was created in step 4 by running this command:
5. Find the path to the Poetry environment that was created in step 4 by running this command:
```shell
poetry env info --path
```
6. Open the command palette and search for "Python: Select Interpreter".
7. Select the virtual environment that matches the output of step 5. It should show up in the list of available interpreters. If it does not, you can pick it manually by choosing "Enter interpreter path..." and pasting the path that was outputted in step 5 into the input field.
8. Open the command palette and search for "Python: Configure Tests".
9. Select "pytest" as the test runner.
10. Select "tests" as the directory containing tests.
6. Copy the output of step 5 to your clipboard.
7. Open the command palette and search for "Python: Select Interpreter".
8. Select the Poetry environment that matches the output of step 5. It should show up in the list of available interpreters. If it does not, you can pick it manually by choosing "Enter interpreter path..." and pasting the path that you copied in step 6 into the input field.
9. Open the command palette and search for "Python: Configure Tests".
10. Select "pytest" as the test runner.
11. Select "tests" as the directory containing tests.

=== "Generic"

1. Clone the repository.
2. Create a new virtual environment and install the dependencies of this project by running this command:
2. Create a new Poetry environment and install the dependencies of the project by running this command:
```shell
poetry install
```
Expand All @@ -64,15 +68,15 @@ Follow the instructions for your preferred IDE. If you want to use neither [PyCh

=== "PyCharm"

.
Right-click the `tests` directory in the [Project tool window](https://www.jetbrains.com/help/pycharm/project-tool-window.html) and select "Run 'pytest in tests'".
=== "Visual Studio Code"
1. Run the tests by opening the command palette and searching for "Test: Run All Tests".
Run the tests by opening the command palette and searching for "Test: Run All Tests".
=== "Generic"
1. Run this command from the root of the repository:
Run this command from the root of the repository:
```shell
poetry run pytest
```
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3740894

Please sign in to comment.