#Circuit Python on PyCharm
1 messages · Page 1 of 1 (latest)
Circuit Python on PyCharm
This is now an referenceable Record for Circuit Python in Regards to PyCharm
These steps will help setup PyCharm to to get the most benefit from it's features for developing CircuitPython scripts for microcontroller:
- Disable PyCharms autosaving features
- Install the circuitpython-stubs
- Install any libraries that you are working with if they are deployed to pypi
- Create a project on your local system drive and add CIRCUITPY as a sources root
More details on each of these steps are provided below.
Disabling autosave:
- Open settings with ctrl+alt+s or File -> Settings
- Open up Appearance & Behavior -> System Settings
- Uncheck the box for "Save files if the IDE is idle for X seconds
- Uncheck the box for "Save files when switching to a different application
(screenshot below)
Use ctrl-s when you are ready to save and run your code.py file.
Install the circuitpython-stubs via pip with this command:
pip3 install circuitpython-stubs
The stubs will make PyCharm aware of all of the buildin modules and functions of CircuitPython
Install libraries via pip:
If you are using libraries from the bundle check to see if they are deployed to PyPi. You can find out by checking the repo on Github and see if there is a setup.py file in the root of it. (If it has setup.py.disabled that means it's not deployed on PyPi.
For example:
pip3 install adafruit-circuitpython-display-text
Will install the Display Text library. Once installed PyCharm will be aware of the libraries classes and functions for offering autocompletion suggestions. You'll need to install each library that you are using individually.
Create a project and add CIRCUITPY as a sources root:
This step is not strictly necessary, but it's recomended because it will prevent the .idea folder from getting created on your CIRCUITPY drive like it would be if you open the drive directly as a project in PyCharm.
- Click File -> New Project
- Selecte a location on your computer drive (not the CIRCUITPY drive) and choose whatever name you'd like
- Open settings with ctrl-alt-s or File->Settings
- Click Project: [project name] -> Project Structure
- Click "Add Content Root"
- Select your CIRCUITPY drive
Now you'll be able to see your CIRCUITPY drive and all of its files in the project tree window. Technically your project folder exists on your PC drive so the .idea folder with pycharm configuration and cache files will be on your PC instead of the CIRCUITPY drive which saves space and prevents unwanted resets.
I may go back and try to break that up some so that screenshots can be provided in the relevant section(s) instead of at the bottom.
@timber shell to install stubs with the GUI instead of terminal: Open up settings with ctrl-alt-s or File-Settings. Unfold Project in the left nav and click Project Interpreter. That screen will show all of the python modules that are installed in your environment. Click the Plus icon button on the right side of the window and it will open up a new window to find and install modules. Search for "circuitpython-stubs" and then click the "Install Package" button for that.
Thanks a ton, Ive purged my extranious messages to keep this file clean for people who will stumble through in the future. will attempt to do this now.
been a long day at work, may not get to it today, but im going to as quickly as i can.
lol i see you have a 7.0.3 version here? https://puu.sh/If8nC/4692ae5ed4.png
is that a uhh. test branch?
I published a copy with my name in it in order to test a few things about the way it's packaged and deployed with the CI actions. I had removed those, but ended up deploying a new version again a few days ago to test something else.
Will delete it again though so there is only one in the results list and folks don't end up accidentally getting my (likely outdated) version.
good annotation, ty
hi foamguy, is it possible to print to terminal through Pycharm and an attached board?
im not seeing any data output
I use a program called tio on linux, but I'm not sure of a windows alternative. This looks similar https://github.com/fasteddy516/SimplySerial but I've never used it personally.