Skip to content

For Developers

Patrick Creighton edited this page Jul 20, 2021 · 18 revisions

For Developers

To contribute to this project, please reach out to pcreighton429@gmail.com.

Linting

To ensure that our Python code stays clean, we are using flake8 to enforce our style guide, which is mostly based off pep8. The only modification we have made to Flake8 is increasing the character line limit to 120.

VS Code

Settings in the .vscode directory will be automatically applied, which selects Flake8 as the linter and sets a vertical ruler of 120 for Python files.

Command Line

The command run by the Flake8 Python Linter workflow (additionally excluding the .venv directory) is:

flake8 . --count --show-source --statistics --max-line-length=120 --extend-exclude=.venv/

Scripts

  • updatescripts.py is used to sync locally stored data with the APIs: uncomment the code block corresponding to the desired data to sync, then run the file. These will take a while to execute.
    • Updates to the UBCGrades and UBC Course Explorer APIs depend on their respective owners, running these scripts might not change anything
    • We recommend only running the RateMyProf section
  • testscripts.py is used to test the output of various scraper methods: uncomment the code block corresonding to the desired method(s) to test, modify the parameters as required, then run the file.

Viewing Course Objects stored in the data base

  • The database only stores Course objects that have been previously searched. These objects contain all the information displayed on the details page, except for the lists used: for the prerequisite tree, section professors, and course professors sections.
  • To view and manage the Course objects currently stored, will need to create a super user account: Introducing the Django Admin
    • You can sort pages by name and average, as well as view as the information stored for each object image

Modifying Course Model

  • If Course fields are modified (added, renamed, deleted), the database will need to be updated: run python manage.py makemigrations, then python manage.py migrate
    • If the field representations are changed without modifying the fields themselves (eg. changed professors_info field from dictionary to list), run python manage.py updatecourseobjects to refresh all the fields of all Course objects currently stored in the database
Clone this wiki locally