Contributing to the Code Repository
Setting Up Pre-Commit Hooks
- Open your terminal/command prompt and activate your conda environment with
conda activate quantum
. - Clone the repository with
git clone https://github.com/KSU-Quantum-Capstone/CS4850-DL1.git
. - Navigate into the git repository on your local computer with the
cd
command. - Once you are in
.../CS4850-DL1/
, use the commandpre-commit install
. This will set up the pre-commit hooks (which are used for formatting code). - Lastly, run the command
pre-commit run --all-files
which will run the hooks on all of the files. If it says FAILED, see the note in the Git Workflow section below. If you get the errorImportError: DLL load failed while importing _ctypes
, try removing your conda environment and restarting from getting started step 3.
Git Workflow
- Open JupyterLab and navigate to the Git tab on the left hand side.
- If you haven’t already cloned the repository, hit “Clone a Repository” and input this URL: https://github.com/KSU-Quantum-Capstone/CS4850-DL1.git a. If you have already cloned the repo, hit “Open the FileBrowser” and navigate to the file location you cloned the repo to.
- After the local repository has been set up, select the current branch to modify and push your changes to. NOTE: there should already be a branch with your name on it. If not, ask Ethan or Ben to create one for you.
- To commit changes you have made locally, hit the “+” symbol next to the file under the “Changed” dropdown menu.
- To push commited changes to the remote repository: a. First, hit the cloud symbol with the down arrow inside of it to make sure your repository is up-to-date. I. If there were changes pulled down, you will have to do a file compare to make sure your changes will still function properly. b. Once you are ready to push the changes, hit the up cloud symbol with the up arrow inside of it.
- Finally, when you have sufficiently completed a task, it is time to merge your changes to the Staging branch by: a. Go to https://github.com/KSU-Quantum-Capstone/CS4850-DL1/pulls and hit the “New Pull Request” b. Set the base branch to “Staging” and the compare branch to your branch c. Review the detected changes d. If everything looks good, hit “Create Pull Request”, fill out the subject and comment if need be, and hit “Create Pull Request” (again).
- At this point you’re all done. The pull request will be reviewed by Ben and/or Ethan who will reach out to you with any comments.
Note: if your code doesn’t conform to https://pypi.org/project/black/ code guidelines, then each time you try to commit, it will fail. The code will then be automatically reformatted for you. Afterwards, stage your changes, commit them, and then push. If you want to prevent this from happening, format your code (assuming you are in the project’s root directory) beforehand with black ..