The course uses Python as our language. As software library installation and management can often be tricky, Python supports virtual environments which collect and isolate a set of packages and their versions. CSCI 410 has its own virtual environment to reduce configuration issues. Assignment 0 tasks you with setting up this environment locally.
IMPORTANT: For Windows users, when you first click on the .exe installer, you should make sure the Add python.exe to PATH
box is checked BEFORE you click "Install Now".
cd ~/Desktop && mkdir cs410
Put the requirements.txt
you just downloaded in your new CS410 directory.
Store project files in relation to the virtual environment like so:
cs410/
|โ- cs410env/
|โ- assignment-1
|โ- assignment-2
|โ- โฆ
|โ- requirements.txt
In a VSCode terminal, navigate to the new directory: cd ~/Desktop/cs410
Go to the menu bar -> select Terminal
-> select New Terminal
.
python3.10 -m venv cs410_env
(Mac users)py -3.10 -m venv cs410_env
(Windows users)Note: Make sure you are in the cs410 directory when running the above commands
source cs410_env/bin/activate
cs410_env\Scripts\activate
source cs410_env/bin/activate.csh
If you are running into execution policy restrictions (typically on Windows), follow this Stack Overflow post to resolve the issue.
Your terminal should look like this when it is activated correctly:
python -v
- towards the end of the terminal output you should see "Python 3.10"exit()
to return to the normal command linepip install -r requirements.txt
source cs410_env/bin/activate
cs410_env\Scripts\activate
ERROR: Could not find C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe
, download Microsoft Build Tools for Visual Studio. During installation, make sure to select the "Desktop Development with C++" workloadModuleNotFoundError: No module named 'distutils.msvccompiler'
, ensure you have Python version 3.10.6 installedsource cs410_env/bin/activate.csh
To deactivate the environment, use the following terminal commands:
conda deactivate
deactivate
deactivate
Through the shell script in the previous step, we've already installed PEP8 library, the industry standard Python style guide, for you. Next, you should activate Pylint, a linting tool that automatically checks for semantic and stylistic issues. Linting makes it easier to spot subtle errors and effortlessly follow the CS410 Style Guide!
Enable Pylint by following these steps:
Ctrl+Shift+X
to open the Extensions tab.The extension should now look like this:
Once installed, Pylint will highlight errors in your VSCode file with squiggly lines, indicating PEP8 violations. Hover over an underlined issue to see the details.
To get a comprehensive list of all errors and warnings for a specific file, run the command pylint fileName.py
in your terminal. This will print the style errors in your terminal. For more information on using Pylint, visit this guide.
Remember: While Pylint allows you to disable seeing violations, DO NOT DO DISABLE WARNINGS for your CS410 work, or you will risk point deductions.