Skip to content

Commit

Permalink
Update documentation website (#1128)
Browse files Browse the repository at this point in the history
* docs: Update styling of logo
* docs: Update home page
* docs: Update Quick Start guide
* docs: Add API page
* docs: Update configuration page
  • Loading branch information
david-yz-liu authored Jan 9, 2025
1 parent 6e44c4d commit f199625
Show file tree
Hide file tree
Showing 11 changed files with 353 additions and 197 deletions.
6 changes: 6 additions & 0 deletions docs/_static/css/pyta-custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.wy-side-nav-search .wy-dropdown > a.icon img.logo,
.wy-side-nav-search > a.icon img.logo {
display: inline;
margin-top: 0;
width: 3em;
}
16 changes: 13 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# -- Project information -----------------------------------------------------

project = "PythonTA"
copyright = "2023, David Liu"
copyright = "David Liu"
author = "David Liu"


Expand Down Expand Up @@ -48,12 +48,22 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = []
html_static_path = ["_static"]

# These paths are either relative to html_static_path
# or fully qualified paths (eg. https://...)
html_css_files = [
"css/pyta-custom.css",
]

html_logo = "images/pyta_logo.svg"
html_favicon = "images/favicon.png"

html_theme_options = {"logo_only": True}
html_theme_options = {
"collapse_navigation": False,
"logo_only": False,
"navigation_depth": 2,
}

# -- Options for LaTeX output ------------------------------------------------
latex_logo = "images/pyta_logo.svg"
21 changes: 21 additions & 0 deletions docs/demos/sample.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""This file illustrates basic usage of PythonTA's code analysis.
"""


def add_two(x: int, y: int) -> int:
"""Return the sum of x and y.
PythonTA's analysis of this code will report three issues:
1. A missing return statement (a logical error)
2. Missing whitespace around the + (a formatting issue)
3. The presence of a print call (a code style issue)
"""
result = x + y
print(result)


if __name__ == "__main__":
import python_ta

python_ta.check_all()
Binary file added docs/images/sample_report.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 40 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,51 @@
# Table of Contents
# PythonTA

Welcome!
PythonTA is a free, open-source suite of educational code analysis tools aimed at novice Python programmers.
It builds on top of professional tools like [pylint], [pycodestyle], and [mypy], with custom feedback messages that are designed to be accessible to beginners and customizable by educators.
It also provides analysis features that occur while code is being executed, including automatic checking of type annotations and logging variable changes across loops.

## Installation and getting started

PythonTA is a pure Python package, and can be installed through [pip](https://pip.pypa.io/en/stable/getting-started/) by running the following command in the terminal:

```console
$ pip install python-ta
```

Then, you can use PythonTA to analyse a Python file from the terminal:

```console
$ python_ta my_file.py
```

or using its Python API:

```python
import python_ta
python_ta.check_all('my_file.py')
```

For a more detailed introduction to PythonTA, check out our {doc}`Quick Start Guide <usage/quick_start>`.

## Acknowledgements

PythonTA is maintained by [David Liu](https://www.cs.toronto.edu/~david/) at the University of Toronto, and has nearly [fifty contributors](https://github.com/pyta-uoft/pyta?tab=readme-ov-file#contributors), most of whom are undergraduate students at the University of Toronto.
This project has received funding from the Faculty of Arts and Science at the University of Toronto.

```{toctree}
:maxdepth: 2
:caption: Contents
:hidden:
usage/quick_start
checkers/index
usage/api
usage/configuration
contracts/index
debug/index
cfg/index
```

[pylint]: https://pylint.readthedocs.io/en/latest/
[pycodestyle]: https://pycodestyle.pycqa.org/en/latest/intro.html
[mypy]: https://www.mypy-lang.org/
19 changes: 19 additions & 0 deletions docs/usage/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# API

The main entrypoint for running PythonTA's code analysis is the `check_all` function.

```{eval-rst}
.. autofunction:: python_ta.check_all
```

Notes:

- For information on using the `config` argument, see {doc}`Configuration <./configuration>`.
- If using the `ColorReporter`, writing to a file using the `output` argument is not recommended.
This reporter uses terminal-specific characters to colourize text displayed on your screen, and these characters will look strange when opening the output file in a text editor.

The `doc` function can be used to open the {doc}`PythonTA Checks webpage <../checkers/index>` to look up a specific error.

```{eval-rst}
.. autofunction:: python_ta.doc
```
Loading

0 comments on commit f199625

Please sign in to comment.