7
Vote

Allow Environment Variable to be set for active python project

description

When I have a C++ Project in my solution (and active), I can right click on the project, go to properties and set the environment variables to be used when invoking that project.

Can we have the same thing for the Python project? We have experimental features that are activated by environment variable, and it'd be nice to not have to change the code or restart visual studio to change these.

This isn't a big deal, but I figured I'd mention it in case it were easy..

Thanks!

comments

dinov wrote Jun 26, 2012 at 9:10 PM

I've always wanted this feature for C# as well :)

This would actually be fairly easy for someone to implement - they just need to add the UI to the DefaultPythonLauncherOptions class and update the launcher to respect these - which should just be updating DefaultPythonLauncher.SetupEnvironment which sets the env vars for both debug and non-debug launches.

tmaslach wrote Aug 10, 2012 at 3:42 PM

I wouldn't mind attempting, but is it possible yet to build using Visual Studio Professional? I heard there was a plan to modularize the code in such a way that Ultimate wasn't always required....

Zooba wrote Aug 10, 2012 at 5:03 PM

Yep, that's done. The Build Instructions page (http://pytools.codeplex.com/wikipage?title=Build%20Instructions%20for%20PTVS) lists the options you have here. The easiest approach will be to switch the build platform to "Minimal" in VS. Then the only prerequisite you'll need is the VS SDK (and the strong name check registry keys in the Prerequisites folder).

pminaev wrote Jul 28, 2013 at 11:12 PM

This is in more demand now that the introduction of mixed-mode debugging made mixed-language solutions more interesting.

moigagoo wrote Oct 2, 2013 at 8:05 PM

Absolutely need this feature.

I store my Django's SECRET_KEY in an environment variable, as well as some other secrets that are not to be shared on a repo.

Please make it possible to set environment variables directly from VS.

Thanks!

Tisten wrote May 13 at 7:58 AM

+1, vote

This is tagged as "Release 2.1" which sounds promising, but it's not in the Beta. What is the status?

Zooba wrote May 13 at 4:09 PM

The status is that we'd love to get it done for 2.1, but it's looking unlikely right now. (Putting it against 2.1 in the issue tracker means we'll keep considering it on a week-to-week basis - there are plenty of features that don't have a release assigned that only really get looked at when we start planning the next release.)

Web projects already support this in 2.1 Beta (though it gets saved into the project file, so it isn't quite ideal for moigagoo's purposes - see https://pytools.codeplex.com/workitem/74), but migrating that support back to regular projects is something we haven't quite gotten to yet.

It will happen eventually, and if someone with C# skills and a lot of bravery wants to dive into our code and make a contribution it'll happen sooner, but it may not make 2.1 :(