可以连接远程环境的Python编辑器?

发布于 2024-11-02 17:30:12 字数 462 浏览 0 评论 0原文

我在应用程序中设置了一个交互式 python 环境。我可以输入命令,它们将在其中执行,并可以访问那里的变量。

问题是我编写了一个半途而废的编辑器,只允许这样做。它没有命令历史记录、代码完成等,因为我没有编写完整的 IDE。但是,我希望能够使用精美的编辑器在该环境中编写代码。

我认为它可以解决的方法是,编辑器将具有用于远程Python会话的接口/协议,并且我只需要在我的应用程序中实现一个服务器(而不是简单的编辑器)并且能够连接和运行代码。

我可以实现我必须实现的任何接口或协议,但我找不到定义了此类协议的 IDE(或者插入充当客户端的扩展的简单方法)。

本质上,我想要一个 python 编辑器,它可以选择在命令(可以是多行)完成输入时调用函数 x,并在发生自动完成请求时调用另一个函数 y。 我检查了一些编辑器,但找不到这样的功能。有谁知道这样的事情吗?它实际上不必是一个Python编辑器,只需支持我需要的钩子即可。

谢谢!

I set up an interactive python environment in an application. I can input commands and they will execute inside it, having access to the variables that live there.

The problem is that I coded a half-assed editor that allows only that. It doesn't have command history, code completion etc, because I didn't code a full IDE. However, I would like to be able to write code in that environment with a fancy editor.

The way I think it can work out is that an editor will have an interface/protocol for remote python sessions, and I will just have to implement a server in my application (instead of the simple editor) and be able to connect and run code.

I can implement any interface or protocol that I have to, but I can't find an IDE that has such a protocol defined (or an easy way to plug an extension that will serve as the client side).

Essentially, I want a python editor that has an option to call a function x whenever a command (can be multiline) finished typing, and another function y when an autocomplete request occurs.
I checked out some editors but couldn't find such a feature. Does anyone know of such a thing? It actually doesn't have to be a python editor, just support the hooks that i need.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月竹挽风 2024-11-09 17:30:12

您是否尝试将 PyCrust 集成到您的应用程序中?请参阅这个SO问题

在Python程序中嵌入Python shell

rpyc 听起来可能对您有用。 rpyc 在其最新版本中添加了对 IronPython 的支持。 PyScripter 支持 rpyc。也许这就是您正在寻找的组合?

Did you try integrating PyCrust into your application? See this SO question

Embedding a Python shell inside a Python program

rpyc sounds like something which could be useful to you. rpyc added support for IronPython in their latest release. PyScripter supports rpyc. Maybe this is the combo you are looking for?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文