Skip to content

IPP-IDE-01-003: PyCharm #43

@labbenchstudios

Description

@labbenchstudios

Description

  • This card contains some basic setup and configuration options if you're using PyCharm as the IDE for these exercises.
    • Assumptions:
      • You're already familiar with PyCharm and its functionality as an IDE.
      • You've used PyCharm for Python (or other language) development.
      • You have PyCharm installed.
    • Some notes:
      • In the Configuration Details for PyCharm section, this guide covers some of the basic configuration options you may want to consider. Your own needs may require different extensions.

Review the README

  • Please see README.md for further information on, and use of, this content.
  • License for embedded documentation and source codes: IPP-DOC-LIC

Estimated effort may vary greatly

  • The estimated level of effort for this exercise shown in the 'Estimate' section below is a very rough approximation. The actual level of effort may vary greatly depending on your development and test environment, experience with the requisite technologies, and many other factors.

Configuration Details for PyCharm

Install and Setup

  • Install the latest PyCharm for your platform: https://www.jetbrains.com/pycharm/download/
  • Install your favorite extensions
    • NOTE: Extensions for any IDE can be deeply personal! You may want to review those add-ons and extensions for PyCharm available on their website to see if any will help you with your planned development activities.

Managing Git Repositories in PyCharm

  • You can clone the two repositories (ipp-exercise-components and ipp-exercise-docs) outside of the IDE and simply access those directories from within the IDE, or you can clone the two repositories within the IDE.
    • NOTE: Before committing to your new repository, you'll have to authorize the IDE to access your Git repository - the pop-up windows should make this fairly straight forward to do
    • If you want to clone the two repositories within the IDE, do the following:
      • Launch PyCharm
      • Close any folder that automatically opens
      • On the main PyCharm main page, click Clone Repository... (upper right button)
      • Enter the full URL in the pop-up dialog for the URL: entry (e.g., https://github.com/programming-in-python/ipp-exercise-components.git)
      • Enter the full path where you want the cloned code to be placed
        • Select your IPP_HOME path
      • Now click CTRL+SHIFT+G (or click the Git icon on the left)
      • Click the three dots (...) next to CHANGES - this will pop up another window
      • Find the Remote tree under HEAD (Current Branch) in the navigation window
      • Right click on Remote and select Manage Remotes
      • In the pop-up window, click the origin URL, then click the - (minus) to remove it
      • In the same pop-up window, click the + (plus) and enter the URL of your new remote repository
      • Repeat this process for the other repository

Dev Environment Configuration for Python

  • After cloning ipp-exercise-components, navigate to the install directory (referred to as IPP_HOME going forward)
  • Notice the .idea hidden path - this contains a number of configuration files related to your PyCharm environment
    • You shouldn't need to manually change any of these files, as all configuration we'll need for this course can be done within the IDE's GUI
  • Launch PyCharm (see below for details)
    • NOTE: If you've already configured VS Code and have active projects, PyCharm may find these and ask if you want to copy your VS Code configuration (and add the VS Code active projects)
  • Open the ipp-exercise-components folder (File -> Open)
    • PyCharm should ask if you want to create a virtual environment - you can do so now
      • The defaults (venv location / path, Python interpreter) should be fine, but you may want to modify these to suit your needs
    • NOTE 1: If you create the virtual environment within the ipp-exercise-components path, be sure to add that path to your .gitignore file.
    • NOTE 2: If you forget to create a virtual environment, you can always add it later:
      • macOS: PyCharm -> Settings -> Python -> Interpreter
      • Windws:
      • Linux:
    • NOTE 3: Keep in mind that setting PYTHONPATH is still necessary if you launch a terminal within PyCharm and use it to execute your code. You can set your PYTHONPATH to point to both IPP_HOME and IPP_HOME/tests as follows from a terminal:
      • echo $PYTHONPATH
      • If you get the desired output, you should be good to go. If not, set your PYTHONPATH:
      • export PYTHONPATH:{IPP_HOME}:{IPP_HOME}/tests
        • where {IPP_HOME} is the absolute path of your install path
      • Recall you can also add your export PYTHONPATH={IPP_HOME}:{IPP_HOME}/tests declaration within the activate virtual environment shell script if desired.

Launching PyCharm

  • From Windows 11:

    • Launch PyCharm
    • Open the project folder for IPP_HOME
  • From macOS or Linux

    • Launch PyCharm
    • Open the project folder for IPP_HOME

Estimate

  • This process can vary in duration depending on your own computing environment, Internet download speed, etc.

References

Tests

  • N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Lab Module 01 - Setup

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions