Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Python on Windows Like a Boss

Python on Windows Like a Boss

Historically, Python coding on Windows has been kind of troublesome, but not anymore. Since a couple of years ago it is possible write awesome quality Python code with Visual Studio. This is good news for Python developers of all levels, because Visual Studio offers and incredible set of tools to enhance all the stages of product development: from managing virtual environments and handling package management, to writing and refactoring code, up to testing & debugging - all of that for free. In this talk I will demo how you can use PTVS to boost your Python development on Windows.

Presented at PyCon 8, Italy, on April 9, 2017.

Nicola Iarocci

April 09, 2017
Tweet

More Decks by Nicola Iarocci

Other Decks in Programming

Transcript

  1. 1
    Python on Windows Like a Boss
    Nicola Iarocci

    View Slide

  2. 2
    Who Am I
    Nicola Iarocci, a weirdo
    Python by Night
    I am the author and
    maintainer of a few
    Python open source
    projects: python-eve.org,
    python-cerberus.org, and
    more.
    Microsoft MVP
    MongoDB Master
    I also happen to be a
    Microsoft MVP for Visual
    Studio and Development
    Technologies and a
    MongoDB Master.
    Communities
    I run DevRomagna, a
    developers community, and
    CoderDojo Ravenna, a
    coding club for kids.
    http:/
    /devromagna.org
    C# by Day
    I am the author of Sofware
    Gestionali Amica, a line of
    accounting and invoicing
    applications for Italian small
    businesses. Check it out at
    http:/
    /gestionaleamica.com

    View Slide

  3. 3
    You know the drill. If
    you’re on Vim you’re
    also on bash. Or zsh. Or
    fish. Or whatever.
    Vim
    The most awesome
    text editor ever made
    by human beings
    (Emacs is good too).
    iTerm
    iTerm2 brings the
    terminal into the
    modern age with
    features you never
    knew you always
    wanted
    Bash
    OSX
    Long story short, until
    not too long ago doing
    Python on Windows
    was a (major) pain in
    the ass.
    Python Hacking
    by night

    View Slide

  4. 4
    Visual Studio
    Most awesome IDE
    ever made by human
    beings.
    No kidding.
    VsVim
    Perfect Vim emulator
    for Visual Studio.
    Windows
    I write desktop apps
    so Visual Studio Mac
    and VS Code are not
    an option (yet?)
    .NET Framework
    Most awesome
    framework ever made
    by human beings. No
    kidding.
    C# Coding
    by day

    View Slide

  5. 5
    I have been living a utopian dream that became a dystopian nightmare
    Nightmare

    View Slide

  6. 6

    View Slide

  7. 7
    Open Source
    Formerly known as Python
    Tools for Visual Studio,
    developed in the open at
    github.com/microsoft/PTVS
    Made With Love
    by Core developers. Steve
    Dower, main contributor to
    PTVS, is also a Python Core
    developer.
    100% Free
    VS Community Edition, best
    Windows IDE, is free to use. Check it
    out at:
    visualstudio.com/vs/community/
    Python for Visual Studio
    Python on Windows like a boss

    View Slide

  8. 8
    Visual Studio Community
    100% free Python experience in the Visual Studio IDE
    Education. Any number of users may use the software to
    develop and test applications as part of online or in person
    classroom training and education, or for academic research.
    01
    Open Source Projects. Any number of your users may use the
    software to develop and test your applications released under
    Open Source Institute (OSI)-approved licenses.
    02
    Individuals. If you are an individual working on your own
    applications to sell or for any other purpose, you may use the
    software to develop and test those applications.
    03
    Small Teams. Up to 5 of your individual users can use the
    software concurrently to develop and test your applications.
    04

    View Slide

  9. 9
    Features

    View Slide

  10. 10
    Built-in Python Experience
    Install from the Visual Studio Installer

    View Slide

  11. 11
    Python Templates
    Start a Django, Flask, PyGame, IronPython project in seconds

    View Slide

  12. 12
    Package Management
    Pip install the libraries you need

    View Slide

  13. 13
    Virtual Environments
    add project environments or reuse existing ones

    View Slide

  14. 14
    We will install the needed
    dependencies directly from
    the requirements.txt file, at
    project creation.
    Package Management Virtual Environments
    Dependencies will be
    installed in a virtual
    environment specific to our
    website project, in perfect
    isolation.
    Python Templates
    We will use the
    FlaskWebProject pre-built
    template which comes
    with the Python Workload.
    Let’s build a Web Site
    Using Flask and Visual Studio

    View Slide

  15. 15
    IntelliSense
    An editor that knows your code

    View Slide

  16. 16
    Unit Tests
    Validate your changes in the editor

    View Slide

  17. 17
    Interactive Debugging
    Diagnose issues with your code (remote debugging works too)

    View Slide

  18. 18
    Source Control
    Git support without a command line

    View Slide

  19. 19
    Import Code
    Easily import existing code in a Visual Studio Solution

    View Slide

  20. 20
    We will learn how to
    leverage VIsual Studio GUI
    to commit changes to our
    repository.
    Git Support GitHub Support
    Once the game is updated
    we will push our changes
    upstream.
    Import Code
    We will see how we can
    import existing Python
    code into Visual Studio.
    Let’s play a game?
    Or, dealing with existing code and Version Control

    View Slide

  21. 21
    Python Shell
    Interactive REPL right there at your fingertips

    View Slide

  22. 22
    IPython (Jupyter)
    The REPL supports IPython for inline plots, etc.

    View Slide

  23. 23
    My two worlds are colliding now. What about yours
    Dream?

    View Slide

  24. 24
    https:/
    /github.com/Microsoft/PTVS
    GitHub
    Getting Started with Python
    Development using Visual Studio
    http:/
    /bit.ly/1plyaiT
    YouTube
    http:/
    /bit.ly/2n6yW6K
    Documentation
    https:/
    /www.visualstudio.com/vs/python/
    Python for Visual Studio
    Get Started!
    Check out these great resources

    View Slide

  25. 25
    nicolaiarocci.com [email protected]
    @nicolaiarocci
    Thank You!
    Send feedback or get in touch at

    View Slide