I've managed to succesfully setup a Visual Studio Python project. I now want to share this project with other developers through source control (the company I work at uses SVN).
As I want to avoid each of my colleagues having to manually setup the same Python environment, I looked into using a Virtual Environment. In my head, this seems very similar as to how NPM modules are stored locally.
Without too much hassle, I managed to setup a Virtual Environment, which works brilliantly.
However, I was ready to exclude my "Virtual Environment"-folder from being checked into SVN, when I noticed that the "pyproj"-file contains a reference to my local virtual environment:
<ItemGroup>
<Interpreter Include="VirtualEnvironment\">
<Id>VirtualEnvironment</Id>
<Version>3.6</Version>
<Description>VirtualEnvironment (Python 3.6 (64-bit))</Description>
<InterpreterPath>Scripts\python.exe</InterpreterPath>
<WindowsInterpreterPath>Scripts\pythonw.exe</WindowsInterpreterPath>
<PathEnvironmentVariable>PYTHONPATH</PathEnvironmentVariable>
<Architecture>X64</Architecture>
</Interpreter>
If I remove the "Virtual Environment"-folder and open the Visual Studio solution, I don't have any option to restore the environment based on the generated "requirements.txt"-file (as I expected). Unless I remove the non-working "Virtual Environment" and add a completely new one.
This leads me to believe that there is something wrong in my work-flow or assumptions.
- Should I not exclude the virtual environment from being checked-in?
- Should I only exclude parts of the virtual environment and if so, which parts?
Side notes:
- As you can probably tell, I'm still fairly new to using Python, so any advice is very welcome.
- The reason I want to use Visual Studio is because the company is primarily .NET focused, which makes it a very farmiliar environment for most developers.
- I did read Working with python in Visual Studio - Step 06 Working with Git, but it doesn't mention Virtual Environments at all.