Chapter Z

Instructor Resources

Goodies for Instructors!

Subsections of Instructor Resources

Module Outline & Notes

Notes

Python Project 1

python3 src
pip3 install pytest
pip3 install pytest-html
python3 -m pytest
python3 -m pytest --html=report.html
pip3 install coverage
python3 -m coverage run --source src -m pytest --html=report.html
python3 -m coverage html
pip3 install flake8
pip3 install pep8-naming
pip3 install flake8-docstrings
pip3 install flake8-html
python3 -m flake8 --docstring-convention google --format=html --htmldir=flake

https://realpython.com/python-testing/

New Semester

This page contains notes on deploying this course for a new semester. There are many things to remember to do!

Hugo Website

  • Make new semester branch

  • Copy old Introduction to a folder and update new version

  • Copy old Syllabus to a folder and update new version

  • Copy old Milestones to a folder and update new version

  • #TODO: Merge new semester branch to master and deploy before semester starts

Errata

Errata

This page is a quick reference for any known errata that have yet to be resolved.

Flake 8 and HTML Plugin - 2022-08-25

Currently the flake8-html plugin has not been updated to work with Flake 8 version 5.0.0.

The bug report is here: https://github.com/lordmauve/flake8-html/issues/30.

In the meantime, you can fix this by locking flake8 to a version below 5.0.0 in the requirements.txt file by updating the entry for flake8 to the following:

# Lock flake8 to <5.0.0
# https://github.com/lordmauve/flake8-html/issues/30
flake8<5.0.0

Flake 8 - 2022-04-05

Note

This error may have been resolved by moving Python to version 3.9 in Fall 2022. It has not been tested yet; this will be updated once it is tested and confirmed working.

In Python, you may get some errors when running Flake8 due to a bug. The error message references the “Markup” class as part of “Jinja2” which is used by the Flake8-html plugin.

The bug report and pull request to fix it is here: https://github.com/lordmauve/flake8-html/pull/24. It has yet to be included in a new release.

In the meantime, you can fix this by adding the following information to your requirements.txt file:

# fix for broken jinja
# https://github.com/lordmauve/flake8-html/pull/24
jinja2==3.0.*

Testing with Tox - 2023-03-29

Running tests that include a graphical interface via Tox may cause issues with x11 permissions.

This can be resolved by installing this PyTest plugin: https://github.com/The-Compiler/pytest-xvfb

Documentation has not been updated to note this.

Python 3.9

Updating to Python 3.9

In Fall 2022, the Codio software stack was updated to Python 3.9. This requires several changes to be made to the projects, which are described below.

For Projects Already Started using Python 3.6

  1. Uninstall all Python packages:
pip3 uninstall -y -r requirements.txt
  1. Update the stack by going to the Project > Stack > Settings menu option.

Menu Options Menu Options

On that page, select the latest version of the CC 410 Stack, and click Save.

Select Stack Select Stack

The Codio box should update to the new stack.

For New Projects

  1. Confirm that the current Python version is 3.9 and that Pip3 is updated as well:
python3 --version
pip3 --version

Current versions are shown below:

Python Versions Python Versions

  1. Update tox.ini to use Python 3.9 instead of Python 3.6:
[tox]
envlist = py39
  1. Install project requirements using pip3:
Warning

Check the errata page to see if any requirements must be updated.

pip3 install -r requirements.txt

If there are any errors, contact the instructor.

  1. Test and run the project following the usual procedure.