python_ta
is a Python library used to check your code
for errors in code correctness and good programming style. We are using
python_ta
as part of the grading for this assignment. The
great thing about python_ta
is that you can run it
yourself, just like doctest
, to make sure you receive a
perfect score on this part!
Here are some instructions for using python_ta
to check
your work:
First, make sure you are using version 2.11.1 of PythonTA. This version has some different checks compared to older versions, so it’s important that you use this version, to be consistent with how we’ll be evaluating your work.
You can check what version of PythonTA you’re using in the Python console:
>>> import python_ta
>>> python_ta.__version__
'2.11.1'
If you have an older version installed, please check out this Software Installation Tips & Troubleshooting page.
In the starter files for Parts 2 and 3, we’ve included the
necessary code to run PythonTA in the main block at the bottom of the
file, similar to running doctest
. All you need to do is
uncomment (delete the #
and space) each of those lines of
code, and then run the file (right-click -> Run File in Python
Console).
Do not change the given code for calling
python_ta.check_all
; this sets specific options for doing
the checks that are the same as the ones we’ll be using when grading
your work.
Your web browser will open up, with a report showing any errors
detected by python_ta
. If you aren’t sure what a particular
error means, click on the code and you’ll be taken to the
python_ta
help page with some more information. If you
still aren’t sure, ask on Ed!
Tip: PyCharm can fix many style errors automatically if you select all of the code in a file and go to the menu Code -> Reformat Code.
You can run python_ta
as many times as you want, even as
you’re working on completing the assignment. You must fix ALL errors
before submitting your work.
You will be penalized for all errors detected by
python_ta
that aren’t fixed by your final submission, so
please fix all of them!
To learn more about PythonTA, check out Course
Notes Appendix B.3 python_ta
or the PythonTA website.