Setup dev environment with VSCode on Windows ============================================ This gist is intended to guide on how to setup a dev environment in Windows 7 for developers coming from a Linux background. For Windows 10 see file win10.md below. Install ------- Install - Git for Windows - Python3 for Windows - Cygwin - VSCode - Nodist Cygwin packages - chere - fish - vim - openssh GIT --- Configure git global: ``` > git config --global user.name "George K" > git config --global user.email gk@9-dev.com > git config --global credential.helper store ``` Do not install cygwin git, in order to let cygwin use the windows installed git that VScode will also use with the same global config. You can check the path to the global config with `git config --list --show-origin`. Open VScode and use command git: clone. The git credential manager will ask for password if necessary. Virtualenv ---------- A previous attempt to use fish through cygwin as default shell and virtualfish for virtualenv management failed miserably. Cygwin pip is unable to properly install basic project requirements. When creating the virtualenv through powershell, pip seems to work properly. Install (open powershell as admin): ``` pip install virtualenv virtualenvwrapper-win ``` Create virtualenv and activate: ``` PS> Set-ExecutionPolicy RemoteSigned # once only, to allow execute of activate PS> virtualenv \Users\Wtower\Envs\my-env # create virtualenv PS> \Users\Wtower\Envs\Scripts\activate.ps1 # activate virtualenv PS> Get-Command python # check python executable PS> setprojectdir \Users\Wtower\Workspace\my-project # set the project dir for the virtualenv PS> pip list # verify the install packages for the virtualenv PS> deactivate ``` After that clone project (vscode command git pull remote), install requirements and run django. Specify virtualenv in VScode in workspace settings: ``` { "python.pythonPath": "C:\\Users\\wtower\\Envs\\my-env\\Scripts\\python.exe", } ``` Extensions ---------- VScode installed extensions: ``` > code --list-extensions DavidAnson.vscode-markdownlint donjayamanne.githistory eg2.vscode-npm-script mkaufman.HTMLHint ms-python.python ritwickdey.LiveServer samschneller.git-add-remote searKing.preview-vscode ``` Nodist ------ The nodist package seems to work better than nvm for windows, with less active issues. Install using the installer and append the env variables in PS. Relevant links -------------- - https://github.com/Microsoft/vscode/issues/14977 - https://virtualenv.pypa.io/en/stable/userguide/ - https://code.visualstudio.com/docs/python/environments - http://timmyreilly.azurewebsites.net/python-pip-virtualenv-installation-on-windows/ - https://stackoverflow.com/questions/38944525/workon-command-doesnt-work-in-windows-powershell-to-activate-virtualenv - http://ruddra.com/2017/08/19/vs-code-for-python-development/ - https://stackoverflow.com/questions/35773299/how-can-you-export-vs-code-extension-list