使用 Visual Studio 的 Python 工具进行无堆栈 Python 开发
适用于 Visual Studio Beta 的 Python 工具(包含对 CPython 的支持)是否允许您使用 Stackless Python 进行开发?
如果是这样,您能否扩展您的答案,以包括除了在现有 VS2010 安装上安装 PTVS 之外设置 Stackless Python 环境所需的任何步骤?
Does the Python Tools for Visual Studio Beta, which includes support for CPython, allow you to develop in Stackless Python?
If so, could you expand your answers to include any of the steps necessary to set a Stackless Python environment up beyond installing PTVS on an existing VS2010 installation please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您当然可以为 Stackless 进行开发,但目前没有针对 Stackless 的专门支持。这意味着您会发现代码编辑体验和 REPL 窗口工作得很好。但是依赖于 sys.settrace 的分析和调试对于微线程不起作用。
如果您通过 MSI 安装 Stackless,PTVS 将像任何正常的 CPython 安装一样进行安装。如果您通过其他机制安装了它,则需要转到“工具”->“选项”->“Python 工具”->“解释器选项”,并使用“添加解释器”按钮设置自定义解释器。
如果您想让这变得更好,您可以回馈 PTVS 来改进这一点。 Stackless 的文档包含有关如何启用调试的信息,但它没有看起来并不太难。从 PTVS 的角度来看,这只需要更新 Visualstudio_py_debugger.py 以检测它是否在 Stackless 上运行并添加适当的代码并确保其工作。
You certainly can develop for Stackless but there is currently no specialized support for Stackless. This means that you'll find the code editing experience and the REPL window work just fine. But profiling and debugging, which rely upon sys.settrace, won't work for tasklets.
If you install Stackless via the MSIs PTVS will pick up the installation as it would any normal CPython installation. If you've installed it via some other mechanism you'll need go to Tools->Options->Python Tools->Interpreter Options and setup a custom interpreter using the Add Interpreter button.
If you'd like to make this better you can contribute back to PTVS to improve this. Stackless's documentation has information on how to enable debugging and it doesn't look like it'd be too difficult. From the PTVS stand point this would just involve updating visualstudio_py_debugger.py to detect that it's running on Stackless and add the appropriate code and make sure it works.