# PyCharm
{id: pycharm}

## PyCharm Intro
{id: pycharm-intro}

* IDE - Integrated Development Environment
* Introspection (understands Python)
* Running, Debugging
* Refactoring

## PyCharm configure interpreter
{id: pycharm-configure-interpreter}

* Mac: PyCharm / Preferences / Project: (name) / Project Interpreter
* Windows/Linux: File / Settings / Project Interpreter

## PyCharm install modules
{id: pycharm-install-modules}

* Same place where we set the interpreter

## PyCharm Project
{id: pycharm-project}

* At the opening create a new project (directory + Python version)
* File/New Project

## PyCharm Files
{id: pycharm-files}

* New file
* Open file
* Ctrl-Shift-N

## PyCharm - run code
{id: pycharm-run}

* Run/Run
* Set command line parameters
* Set environment variables

![](examples/pycharm/demo.py)

## PyCharm - debugging code
{id: pycharm-debug}

* Set fixed Breakpoints (click on line next to row-number to have a red circle)
* Run/Debug
* Inspect variables
* Conditional breakpoint
* Step in function
* Step out of function
* Step over function

## PyCharm Terminal
{id: pycharm-terminal}

* Bottom "Terminal"

## PyCharm Python console at the bottom left
{id: pycharm-python-console}

* Bottom "Python Console"

```
 2 + 3
 x = 2
 print(x)
 def f(x, y):
    return x+y

 f(4, 5)
```


## Refactoring example with PyCharm
{id: pycharm-refactoring}

* Change variable name (in scope only)

![](examples/pycharm/calc.py)

* Extract method

