π§ 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:
- Download from https://www.jetbrains.com/pycharm/download
- Install either the Community (free) or Professional edition
π 2. Open the Project Folder¶
- Open PyCharm.
- Click "Open" on the welcome screen.
- 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)¶
- Go to File > Settings > Project: afccp > Python Interpreter
- Click the βοΈ icon (top-right) and choose Add...
- In the dialog:
- Select Conda Environment
- 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
- Existing environment if you've already created one (e.g., via terminal):
- Set Python version to 3.8
- 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:
- Open the Terminal tab at the bottom of PyCharm
- 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:
- Go to Run > Edit Configurations...
- Click the β to add a new configuration
- Choose Python
- Set:
- Name:
Run AFCCP
- Script path:
afccp/example.py
(use the file chooser) - Python Interpreter: select the environment you just configured
- 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:
- Add a new pytest configuration
- Point it to the
tests/
directory - Give it a name like
Run Tests
π 7. Recommended PyCharm Settings¶
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!