Metadata-Version: 2.4
Name: xdiscussion
Version: 0.1.0
Summary: Client library for XDiscussion - links autograder errors to Ed Discussion threads
Author: XDiscussion Contributors
License: MIT
Keywords: autograder,ed-discussion,education
Requires-Python: >=3.11
Description-Content-Type: text/markdown

# XDiscussion Client

The purpose of the XDiscussion client is to capture errors and provide students with some possible related discussion threads on Ed Discussion.

For best results, ensure you return error messages to students rather than obscuring them:

```py
XDISCUSSION_ADDRESS = ("http://127.0.0.1", 5050)
# In a Question in grader.py
except Exception as e:
    error_str = f"{e.__class__.__name__}: {e}"
    self.add_message(error_str)
    matches = get_formatted_matches(XDISCUSSION_ADDRESS, error_str)
    if matches:
        self.add_message(matches)
```

## Example Usage

Create a .env file inside `/server` with the following contents

```env
ED_API_TOKEN=
XD_COURSE_ID=67912
XD_CONFIG_PATH=./config
```

Note: This example expects you to have access to course 67912, which you may not.

```sh
cd server
docker build . -t xdiscussion
docker run -p "5050:5050" -t xdiscussion

# In another terminal
cd client/examples
python3 grader.py -s Example_Assignment.ipynb
```
