Package: coursescheduler
SENG 499 - Company 2: Algorithm 1This repository contains a package (coursescheduler) that schedules
the courses required for a software engineering degree at University of Victoria. The problem is implemented as a
constraint satisfaction problem and an optimized backtracking search algorithm is used to find a valid schedule.
This package was created for the Capstone SENG499 class: Company 2 Course Scheduler Project.
Authored by the Company2 Algorithm1 sub-team.PrerequisitesThis package requires Python 3.9 or higher. In this README, it is assumed thatpythonandpipwill use Python 3.9.
To check your Python version, you can run the following command:$python--version# Should output "Python 3.9.0" or higherTo check your pip version, you can run the following command:$pip--version# Should output some version of pip and "python 3.9" or higherInstall from PyPi Using PIPInstall this package into your environment from PyPi usingpip.$pipinstallcourseschedulerThe most recent available version of the package is uploaded to the PyPi index automatically as part of our CI/CD
pipeline. To ensure that you are working with the most recent release, upgrade this module before integrating.$python-mpipinstall--upgradecourseschedulerInstall from Local ArchivesClone this repo into your repository. Inside the algorithm 1 module directory,
build and install the package as shown below. Note: you must replace0.1.0with the correct version.$python-mbuild
$pipinstallcoursescheduler-0.1.0.tar.gzUsageOnce installed, the algorithm can be imported and called withgenerate_schedule, as shown below.generate_scheduleexpects two parameters and returns a single output, all of which are Python dictionaries.
The API specification
can be foundhere.fromcourseschedulerimportgenerate_scheduleschedule=generate_schedule(professors,schedule)A third parameter,debug, can be included. If set to True,professorsand/orschedulecan be set toNoneand the algorithm will use mock data.schedule=generate_schedule(None,None,True)# Uses mock data for professors and scheduleschedule=generate_schedule(professors,None,True)# Uses mock data for scheduleschedule=generate_schedule(None,schedule,True)# Uses mock data for professorsThere are also functions that will validate input data according to the spec:fromcourseschedulerimportvalidate_professor_structure,validate_professors_structure,validate_schedule_structurevalidate_professor_structure(professor)# One Professor dictvalidate_professors_structure(professors)# A list of Professor dictsvalidate_schedule_structure(schedule)# A Schedule dictIf the input is valid according to the spec, these functions will returnTrue.
If there is a spec violation, aSchemaErrorwill be raised. A second parameter can be passed to all three validate functions calledprint_output, which is set toTrueby default.
Ifprint_outputisTrueand the input is valid, a success message will be printed to the console.DevTo make and test changes to the project, navigate into the root level directory/path/to/algorithm1/. After editing the project files, in order for the changes to take
effect you must reinstall the local package by the following cmd:$pipinstall.To run the tests, run the following command:$cdtests
$python-mpytestPython LinterWe follow thePEP8style guide, and we useflake8to lint our code.To installflake8, run the following command:$pipinstallflake8To runflake8, run the following command:$python-mflake8[fileordirectory]We recommend using the code formatterblack:$pipinstallblackTo runblack:$python-mblack[fileordirectory]