IDE setup documentation for contributing

Hello all,

Yesterday I tried to build the PlatforIO core project from the GitHub repo, using PyCharm.

Unfortunately, I came to a set of problems, the one really hard to solve is: https://youtrack.jetbrains.com/issue/PY-23615?_ga=2.206289299.1431457697.1615115567-98609791.1600594717

Finally, I managed to get some part of the project to be debuggable by installing the packages in the local venv, thus avoiding the name shadowing problem with “platform” package.

My question is to the core devs: What environment do you use and if you have a ready IDE setup guide, can you share it.

I am committed to start contributing to the project so I think soon I will be able to give a working IDE setup using PyCharm or other IDE in the following weeks. (I can do some work mainly on weekends)

1 Like

@ivankravets for this topic

Have you seen this platformio-core/CONTRIBUTING.md at develop · platformio/platformio-core · GitHub?

Yes, this was my starting point, and in the end, I managed to get it to run and debug in PyCharm. :slight_smile:

I think the main problems were with PyCharm itself and its settings.

I am now happily on my way to adding Arduino framework for a few more boards: [Feature Request] Support Arduino framework for Atmel SAMD21 Xplained Pro · Issue #147 · platformio/platform-atmelsam · GitHub (my feature request)

For easier setup for other people this is what I did to get PyCharm to work nicely with the code:

  1. Do the contributing steps till step 5 (step 5 is not needed for PyCharm, yet if you want to use the console do it too)
  2. Then in PyCharm open the project if not already opened (the root should be the repo root, everything should be good if you create a project from your repo/the main repo)
  3. Add a new Python SDK, using the option for an existing environment like so:
  4. As an interpreter pick the tox generated python binary in project-dir/.tox/py38/bin/python (here py38 should be replaced with the version of python you want to use)
  5. Create a new run configuration of type Python. Use Module name instead of the default Script name. As module type “platformio” and make sure you have the newly created environment as your interpreter. Like so:

After this setup run and debug worked for me, including debugging of packages (platform-atmel-sam) that were downloaded by the core.

@ivankravets Do you think this makes sense to be added somewhere as a document?

2 Likes

You don’t need to use PlatformIO Core in this way if you plan to contribute to platform-atmel-sam.

We don’t use Python debugging for PlatformIO Core. It does not make sense due to SCons engine which runs in the background.

I recommend installing PlatformIO Core as described at Redirecting...

Well, for now, I am using debugging mostly as a learning tool, to get faster to what I need to actually do to get the build of Arduino for SAMD21_XPRO running.

And if I install the pio, how will I debug the platform-atmel-sam as I am pretty sure I will miss things right at the start… :smiley:

1 Like