IDE setup for Rust&Python


I'm mostly developing in Python so far, but want to learn and use Rust as well. I'd only use them in combination, though. I heard about PyO3 and started dreaming wild things. Imagine the following:

  • You have an Eclipse equipped with pydev and corrosion. (or maybe KDevelop, or Jetbrains, ...; but a full real IDE, preferably as FOSS as possible, but not from BigTech shops, also no -ium variant of a BigTech tool)

  • In a project I can create Python modules/packages as well as Rust ones. (like in MS Visual Studio having a solution with C++, C#, F# or whatever projects that can reference each other)

  • My main routine (if my project is not a library) is either Rust or Python. There is a simple way to call Rust stuff from Python and vice versa.

  • The IDE provides proper support for both languages. Incl. auto completion, debugging, and similar. Ideally as cross-border as possible.

  • There is a simple way to package the project. As Python eggs, Flatpaks, DEB packages, Rust crates, or whatever could make sense. Maybe assuming a particular directory structure and/or other conventions (that do not feel odd). Linux only would be sufficient; Android, Mac, WASM, Windows, ... are nice to have.

  • Maybe explicit support for testing, code documentation, linting, code formatting, etc. (but that's perhaps trivial once the former points are fulfilled)

Once the environment (IDE, other tools, ...) is set up, everything should be convenient and as automatic as possible, so I can basically forget how it internally works and how I set up everything.

I should (solely in theory) be able to bundle that setup and give it to another dev and he should be able to code sth with it and make me a DEB package, just by knowing Rust and Python and maybe reading my 10 lines of readme (which might include a tiny PyO3 quickstart guide).

It doesn't constantly ask me to write boilerplate code to wire things (incl packaging). It lets me focus to writing my actual code.

I guess this doesn't really exist?! But I'm sure I'm not the first one thinking it. Is there someone who tried to set up a similar environment? How far did it go? I would be okay with all kinds of non-trivial configuration, if it's really a one-time challenge and not a per-project one or even worse. Is packaging the biggest challenge, or are all the other points equally impossible? :slight_smile:

I'm of course not asking for a step by step guide. Just some opinions how stupid the idea is, would suffice at first.

You should not forget about that. :sweat_smile:

Anyway, in Elixir language the recommended way to setup environment is asdf (or other version manager - asdf is the most popular I guess). The asdf installation is just a single line you copy-paste to your shell. Then of course you need to add 2 lines to ~/.bashrc or equivalent file for your shell for stuff like setup PATH and autocompletion.

Depending on the language you install you would need to make sure all dependencies are met at your OS/distribution level. Fortunately it looks like Rust does not require any extra package to install.

How simple is to automate dependencies really depends on distribution. In Gentoo Linux for example you only need to add and emerge a package set like:

$ cat /etc/portage/sets/your-set-name
# Elixir (Phoenix file watcher)

# Erlang

# PostgreSQL

In deb-based distributions you can create your simple local repository. I have explained it in a reply to one topic on Elixir forum: WebAuthnLiveComponent - Passwordless Auth for LiveView Apps - #30 by Eiji - Libraries - Elixir Programming Language Forum

For now I'm using Sublime Text 4 as a code editor simply because it has lots of packages and really well support for languages I use. It should be easy to install it using your distribution package manager.

However recently I'm testing zed editor which is written in Rust, it uses GPU to quickly draw user interface and it's look and feel is really similar to Sublime Text. This editor is really good if we look how new it is and what features it offer, but it has 2 important problems:

  1. It's new so there are not much packages except themes, it have so much themes that I would like to filter them out from search results :joy:

  2. It's Linux support is work in progress - so far it officially does not support it, but the latest builds compiles and runs on Linux really well. I haven't noticed any crashes, but still if you look in the source code there are lots of TODOs and unimplemented stuff

I think CLion is your best bet. You can install an (official) plugin for Python. From what I've heard, it works quite well. VSCode should also be fine.

1 Like

For me it was always confusing why there are so many JetBrains IDEs as other editors/IDEs are doing same stuff with plugins. Personally I prefer to have one editor / IDE for all languages. VSCode have some interesting extensions, so it's definitely worth to give a try. At start I would rather recommend Sublime Text as it's easy to begin with not really that hard to master as long as JSON-based configuration is not a problem for you.

Hi. Thank you for your answers! I will take a look whether Sublime will be fine for me as well. So far I use actual IDEs. For Python I use PyCharm. I'm now looking for a similar developer experience, but for a tandem of Python and Rust, which is convenient enough to just code with it. A bit like I could mix e.g. C++ and VB in a Visual Studio solution.

That's probably a bit more complicated than just installing a Rust plugin and a Python plugin in my text editor or IDE. Ideally there is e.g. some autocompletion support for my Python API on the Rust side and vice versa, debugging support, etc... I don't know exactly, since it was just my dream. :smiley:

And there may be some good conventions how to structure the project for that in order to make it work with as less friction as possible.

I was just wondering if someone already tried to go down that road and collected some experience how things could be set up, in order to achieve that at least in some parts. Even if with some trade-offs that are not too unfortunate. Or if maybe even someone started to implement IDE plugins for sth like that.

If you're familiar with PyCharm, you'll have no problems using CLion.

Hm it's a shame, you all aren't answering my question at all, but you just quickly recommend me some IDEs - without any connection to my questions. My question was (intended to be) a bit deeper than just "Tell me some IDEs or text editors with some Rust and Python plugins available."

And why should I of all things take a C IDE, if that vendor also has a Python and a preview of a Rust IDE? Maybe that hint is cleverer than it sounds, but at first glance it's confusing and would need a bit more explanation.

But thank you anyways. Maybe my questions were just stupid, or badly phrased, or posted in the wrong place... :-/

FYI: ChatGPT was not giving me terribly helpful answers, but at least it gave me the feeling that it understood the question and isn't just trying to increase its answer count score:


Your vision is ambitious but not entirely unrealistic. There are tools and frameworks available that can help you achieve most of what you described, although perhaps not in a completely seamless and automated manner.

For instance, PyO3 does indeed allow you to call Rust from Python and vice versa, and there are IDEs like VS Code and IntelliJ IDEA that provide good support for both languages, including auto-completion, debugging, and more.

Packaging your project can be done using tools like setuptools for Python and Cargo for Rust, and there are ways to integrate them together, although it might require some manual configuration initially.

As for the specific setup you described, it's possible someone has attempted something similar, but it would likely require some effort to set up and maintain. The biggest challenge might indeed be in achieving seamless integration between Rust and Python, as well as in automating the packaging process.

Overall, while it might not be as straightforward as you envision, it's definitely worth exploring, especially if you're willing to invest the time and effort into setting it up. It could lead to a powerful and efficient development environment for projects that leverage both Python and Rust.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.