Giter VIP home page Giter VIP logo

pynash-pycharm's Introduction

=========================================== Remote Debugging with PyCharm (and Vagrant)

Hello!!! My name is Jeremy Phelps and I'm from Bowling Green, KY (about an hour north of here)

Super glad to be hanging with PyNash and look forward to learning a ton

I spend a lot of my time building things as a member of Dell Cloud Manager on the backend systems team.

Other times I can be found mountain biking with my family and in pursuit of the perfect hot wing.

My motivations for presenting at PyNash are:

1. Get out of my comfort zone and in front of people (the scariest place).
2. Talk about PyCharm because I think it's cool (and I wanna know some more about it).
3. Be a part of a great community.

Setup Instructions for PyCharm on Mac 0SX

This assumes you have PyCharm Professional Edition and Vagrant installed

  1. Go into the project directory
  • cd ~/pynash-pycharm/
  1. Copy pycharm-debug.egg into the project directory
  • cp /Applications/PyCharm.app/pycharm-debug.egg .
  1. Start up VM with provided Vagrantfile
  • The project root will be mapped to /vagrant directory in the VM once started.

  • vagrant up

  • vagrant ssh

  • sudo -i

  • apt-get update

  • apt-get install python-virtualenv

  • cd /vagrant

  • Create and activate virtualenv and install deps

  • virtualenv --no-site-packages /opt/pynashenv

  • source /opt/pynashenv/bin/activate

  • pip install -r requirements.txt

  • Install unzip then cp and unzip pycharm-debug.egg into virtualenv site-packages

  • apt-get install unzip

  • cd /opt/pynash-pycharm/lib/python2.7/site-packages/

  • cp /vagrant/pycharm-debug.egg .

  • unzip pycharm-debug.egg

  1. Setup PyCharm
  • Make sure you have Vagrant plugin installed (Pycharm -> Preferences -> plugins -> vagrant)
  • Set up remote interpreter (point to the one we have just created) (File -> Default Settings -> Default Project -> interpreter)
  • Edit configuration to set up remote debugger (Edit config-> + -> Python Remote Debug)
  • Fill in name, hostname, port, and path mapping (remember the port)
  • You can now start the debug server
  1. Go back to your VM and kick off a script or test suite:
  • Copy the following snippet into the script that you want to debug
  import pydevd
  pydevd.settrace(<local ip of host machine>, port=4567, stdoutToServer=True, stderrToServer=True) 
  • Now you can kick off your script/test-suite and you will see the process connect to the PyCharm debugger
  • Here is where we do nosetests or python -m unittest <module>
  • It will pause on the first executable statement that it comes to if you pass suspend=True to settrace
  • Otherwise you can now set breakpoints and step through/step out. Even just going step by step to get a nice visual of how your program executes.
  1. We have a computer so we should automate the setup some

pynash-pycharm's People

Contributors

jpwku avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.