Skip to content

🧠 PyCharm Setup Guide for AFCCP

This guide walks you through setting up PyCharm for use with the Air Force Cadet Career Problem (AFCCP) project. It covers: - Opening the project - Setting up the Python interpreter - Creating a run configuration - Using the built-in terminal


🧰 1. Install PyCharm

If you haven't already:


πŸ“‚ 2. Open the Project Folder

  1. Open PyCharm.
  2. Click "Open" on the welcome screen.
  3. Navigate to the directory where you cloned the afccp repository (e.g., ~/Documents/Projects/afccp) and click Open.

πŸ“ If you haven’t cloned the repository yet, do this from terminal first:

git clone https://github.com/dglaird/afccp.git
cd afccp


🐍 3. Configure the Python Interpreter (Conda or VirtualEnv)

  1. Go to File > Settings > Project: afccp > Python Interpreter
  2. Click the βš™οΈ icon (top-right) and choose Add...
  3. In the dialog:
  4. Select Conda Environment
  5. Choose:
    • Existing environment if you've already created one (e.g., via terminal):
      conda create -n afccp python=3.8 -y
      conda activate afccp
      
    • New environment if you want PyCharm to create it
  6. Set Python version to 3.8
  7. Click OK to save and apply the interpreter

βœ… Once set, PyCharm will index your environment and show packages in the interpreter panel.


πŸ“¦ 4. Install Project Dependencies

Once your interpreter is set:

  1. Open the Terminal tab at the bottom of PyCharm
  2. Run:
pip install -r requirements.txt

This installs all packages required for AFCCP, including pyomo, pandas, mkdocs, and more.


▢️ 5. Create a Run Configuration

To quickly run the model script from inside PyCharm:

  1. Go to Run > Edit Configurations...
  2. Click the βž• to add a new configuration
  3. Choose Python
  4. Set:
  5. Name: Run AFCCP
  6. Script path: afccp/example.py (use the file chooser)
  7. Python Interpreter: select the environment you just configured
  8. Click Apply and OK

Now you can run the model with the ▢️ button in the top-right corner.


πŸ§ͺ 6. (Optional) Add Test Configurations

If you have test files in tests/, create another Run Configuration:

  1. Add a new pytest configuration
  2. Point it to the tests/ directory
  3. Give it a name like Run Tests

Editor Settings

  • Enable soft wrap for Markdown and .py files:
    Preferences > Editor > General > Soft Wraps

Markdown Preview

  • Preferences > Languages & Frameworks > Markdown > Preview
    Choose "Preview with HTML and CSS"

Auto-save on Run

  • Preferences > Appearance & Behavior > System Settings > Save files on frame deactivation

🧠 You're Ready to Develop!

You now have a fully working setup in PyCharm: - Code highlighting and linting - Conda environment - One-click model execution - Markdown editing with preview - Git integration

Happy modeling!