Skip to main content

Code checking tool for teaching Python

Project description

PyTA

PyTA is a Python program which uses static code analysis to help students find and fix common coding errors in introductory Python courses. Python already has great static analysis tools like pep8 and pylint, but these tools do not necessarily have the most beginner-friendly format. PyTA has two central goals:

  1. Statically identify common coding errors by using existing linting tools and building custom linters (e.g., as pylint checkers).
  2. Present beautiful, intuitive messages to students that are both helpful for fixing errors, and good preparation for the terser messages they will see in their careers.

This is a new project started in the Summer of 2016, and takes the form of a wrapper around pylint (with custom checkers) that operates directly on Python modules, as well as a website with some supplementary material going into further detail for the emitted errors.

For greater details on the errors PyTA checks for: Help Documentation.

For help getting started using PyTA: Quick Start.

Installation

If you're interested in using PyTA, you can install it using pip (or pip3, on OSX/Linux):

> pip install python-ta

Development

If you're developing PyTA:

  1. First, clone this repository.
  2. Open a terminal in this repo, and run pip install -e ".[dev, cfg, z3]" to install the dependencies.
  3. Then run pre-commit install to install the pre-commit hooks (for automatically formatting and checking your code on each commit).

While not strictly necessary for debugging, some debugging tools require graphviz to be installed on your system.

Tests

To run the test suite, run the following command from inside the pyta directory:

> python -m pytest tests  # Or python3 on OSX/Linux

Generating the docs

The PyTA documentation is generated using Sphinx. To generate the documentation locally, run the commands:

> cd docs
> make html

Then open the file docs/_build/html/index.html in your web browser!

Demo

You can currently see a proof of concept in this repository. Clone it, and then run python in this directory (PyTA is primarily meant to be included as a library). In the Python interpreter, try running:

>>> import python_ta
>>> python_ta.check_all('examples.custom_checkers.e9999_forbidden_import')
[Some output should be shown]
>>> python_ta.doc('E9999')

Contributors

Ibrahim Bilal, Lorena Buciu, Simon Chen, Freeman Cheng, Ivan Chepelev, Yianni Culmone, Daniel Dervishi, Nigel Fong, Adam Gleizer, James Han, Ibrahim Hasan, Niayesh Ilkhani, Craig Katsube, Rebecca Kay, Christopher Koehler, David Kim, Simeon Krastnikov, Ryan Lee, Christopher Li, Hoi Ching (Herena) Li, Hayley Lin, Bruce Liu, Merrick Liu, Wendy Liu, Yibing (Amy) Lu, Maria Shurui Ma, Zain Mahmoud, Aina Fatema Asim Merchant, Karl-Alexandre Michaud, Shweta Mogalapalli, Ignas Panero Armoska, Justin Park, Harshkumar Patel, Varun Sahni, Eleonora Scognamiglio, Stephen Scott, Amr Sharaf, Richard Shi, Kavin Singh, Alexey Strokach, Sophy Sun, Ali Towaiji, Utku Egemen Umut, Sarah Wang, Lana Wehbeh, Jasmine Wu, Raine Yang, Philippe Yu, Shirley Zhang, Yi Cheng (Michael) Zhao

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_ta-2.12.0.tar.gz (905.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_ta-2.12.0-py3-none-any.whl (913.9 kB view details)

Uploaded Python 3

File details

Details for the file python_ta-2.12.0.tar.gz.

File metadata

  • Download URL: python_ta-2.12.0.tar.gz
  • Upload date:
  • Size: 905.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for python_ta-2.12.0.tar.gz
Algorithm Hash digest
SHA256 0f5487608bc0e8e36251d543323377b460fa6a008c84e7b90dda0ef93c548f42
MD5 b4d2b1acd0911af3d599c2b12e6d8f41
BLAKE2b-256 1ab6c26158c547147c6fe689bb3f15995f7184ab93f555a60e1ff66ec1427494

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_ta-2.12.0.tar.gz:

Publisher: publish.yml on pyta-uoft/pyta

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file python_ta-2.12.0-py3-none-any.whl.

File metadata

  • Download URL: python_ta-2.12.0-py3-none-any.whl
  • Upload date:
  • Size: 913.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for python_ta-2.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5542e073166a6f34a72561d39b0faae6b2a7803c03f170852909501492204e6b
MD5 17ac3f56fc336cbae80b51fe7741ffc0
BLAKE2b-256 bf9c187c15cf6763200be4fb2551883bc28b66eceb05ef537405eb34df24a6f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_ta-2.12.0-py3-none-any.whl:

Publisher: publish.yml on pyta-uoft/pyta

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page