Skip to content

Latest commit

 

History

History
274 lines (161 loc) · 5.6 KB

1. IDEs.md

File metadata and controls

274 lines (161 loc) · 5.6 KB

Python IDEs

Where and how to run python program

Plan for today

  • Installing python 3.7
  • Installing PyCharm IDE
  • Instaling Jupyter notebook
  • Getting familiar with command line

Download links

Command line

  • On Mac it is called terminal

  • It is file management system

  • Whatever you can do with your mouse, you can do with command line

  • Every file on PC has path, which uniquely describes it

  • Meaning that using path we can do everything what we can perform using mouse

    • open, close, delete, rename, move

File path

  • Root directory

  • Why is directory important?

    • We can open files from current directory by calling just its name
    • We can open file from other directory, but its path should be specified
  • Types of file path:

    • Absolute
    • Relative
  • Absolute file path tells us where particular file is located relative to root directory

  • Relative file path tells us where particular file is located relative to some other directory

  • What is system path?

    • Programs stored in folders that are in system path, can be opened by simply calling their names regardless of folder (file path) we are currently located in !!!
  • All files stored in system pathS must have unique name !!!

Command line

  • What is necessary to run file on command line?
  • What we need to specify?
    • Using which program we want to open specific file.
    • What specific file we want to open.
  • What activities we can perform on cmd/terminal?
  • What is workflow?
    • Traveling from one place to another (from one folder to another)
    • Opening files from some specific place
    • Renaming, deleting, moving files

Basic commands on Mac

  • pwd present working directory
  • ls list files from present working directory
  • cd change directory
  • cp copy
  • mv move
  • cd .. go one folder back

Basic commands on Windows

  • cd present working directory
  • dir list files from present working directory
  • cd change directory
  • copy copy
  • move move
  • cd .. go one folder back

Command line

  • Be very careful !

  • On command line, you can really make a mess

  • It is just one command from totally destroying PC

  • Example

    • Create txt file on desktop
    • Open it using notepad
    • Type on cmd ‘notepad filepath’

Different ways to run python

  • Command line / terminal

  • Using IDEs

  • Using jupyter

Terminal/command line

  • Simplest way to run commands
  • Just open terminal and type ‘python’
    • It will work if you included python in system path
  • No support in writing code

What is good developer?

  • Someone who knows all syntax by heart, or
  • Someone who perfectly knows building blocks and know how to combine different elements into useful and meaningful unit/module.
    • (Some elements of creativity is required).

Modern IDEs

  • An IDE is as important for developer as a calculator for a mathematician.

Why to use modern IDEs?

  • Autocomplete
  • Documentation
  • Syntax highlight and validation
  • Debugging
  • Refactoring
  • Code generation
  • VCS

Things I try to avoid

  • Learning syntax by heart
  • Learning over-specific and narrowly specialised functions and methods

IDE advantages

  • Give us opportunity to focus on important and general things.

  • Provide us with tools to query documentation fast.

  • Release burden of learning language syntax by heart.

  • Give us possibility to choose from!

PyCharm and Jupiter

  • We are going to use both programs/editors

  • PyCharm is the best product in the market and for most of the tasks it is 5 places in front of its competition

  • Jupyter is becoming more and more popular (PyCharm Professional has Jupyter notebook integrated within IDE)

  • Also, jupyter is good for visualisation and presentations

  • But still, jupyter lacks most of intellisense features

Python installation

  • Pay attention at ‘include as system variable’. It should be checked.

  • Python should be in system variables.

PyCharm installation

  • Just follow the steps: ‘next, next…finish’

  • Doesn’t have to be included in system path variables

Jupiter installation

  • Open command line

  • Type: ‘pip install jupyter’

PyCharm elements

  • Editor
  • Console
  • Project window
  • Variable explorer

IDE’s advanced features

  • Quick documentation
  • Function/class implementation details
  • Parameter info
  • Find class/function by name i.e. auto import
  • Debugging
  • Version control

IDE’s standard features

  • Find and replace
  • Rename
  • Refactor code
  • Syntax highlight
  • Find usage

PyCharm shortcuts

  • Mac shortcuts

    • Shift + command + I
    • Option + J
    • Command + P
    • Control + space space
    • control+alt+t
  • Windows shortcuts

    • Control + shift + I
    • Control + Q
    • Control + P
    • Control + space space
    • option+command+t

Jupiter shortcuts

  • command+tab

  • command+tab-tab

My suggestion

  • Don’t be afraid of making mistakes.

  • Python errors are going to become your second nature.

  • Google is going to be your best friend.

Other tools available in market

  • VScode
  • Eclipse
  • Visual studio
  • Xcode
  • Jupyter lab

Extra tip

  • How to see what libraries you have installed?

    • Command: pip list

Topic for next class

  • Storing data into variables.

The end

  • Thank you for your most valuable resource, your time.