charlesthomas / magpie

Git-backed Evernote replacement
MIT License
646 stars 50 forks source link

How to setup a dev environment #16

Closed Erwyn closed 10 years ago

Erwyn commented 10 years ago

Hello,

I'd like to setup a dev environment to work on magpie's code, but I don't know a lot of things about how to do this for Python. How to setup a dev environment so that I don't install stuff (like tornado or filemagick) system wide?

Regards,

matthewi commented 10 years ago

This is typically accomplished with virtualenv and pip.

Erwyn commented 10 years ago

There is a dev mode for pip? Cause I don't really know how to plug the git repository in it. Le 24 juin 2014 03:11, "matthewi" notifications@github.com a écrit :

This is typically accomplished with virtualenv and pip.

— Reply to this email directly or view it on GitHub https://github.com/charlesthomas/magpie/issues/16#issuecomment-46921594.

charlesthomas commented 10 years ago

Here's how I have done this in the past:

install pip

OS X

brew install python (requires Homebrew & installs a second system Python, but it works and installs pip, too) OR easy_install pip

Debian-based Linux

apt-get install python-pip

install virtualenv & virtualenvwrapper

pip install virtualenv virtualenvwrapper

tell pip to respect virtualenvs

export PIP_RESPECT_VIRTUALENV=true (This should probably go in your .bashrc or .bash_profile file so it's always on)

tell pip to require virtualenvs

export PIP_REQUIRE_VIRTUALENV=true (This will cause pip to fail with a warning if you try to pip install something outside of a virtualenv -- ie in your system Python. It's optional, but recommended. If you use this, it should also go in .bashrc / .bash_profile)

Get a new shell

either bash or source .bashrc or something to get a new shell, which should give you access to virtualenvwrapper commands and export the pip stuff described above.

create a virtualenv

mkvirtualenv magpie (this is just a name for the virtualenv -- it doesn't have to be called magpie) this will put you in the virtualenv. to get out of it, use deactivate. to get back in workon magpie (assuming you named it magpie in the mkvirtualenv command.

fork & clone

this is completely independent from everything else. you don't have to be in the virtualenv to clone the repo and you don't have to be in the repo to use the virtualenv - they are mutually exclusive.

install magpie's requirements

the virtualenv and git repo are mutually exclusive, but you'll need the repo cloned and the virtualenv active in order to install the requirements pip install -r requirements.txt

done

you should now have a working magpie dev environment

Erwyn commented 10 years ago

Thank you! I'll try this asap.