A collection of tools for automating Canvas LMS instructor operations.
Project description
Canvas Tools
A Python package for automating common instructor operations on the Canvas LMS.
Features
- Download Submissions: Bulk download all file submissions for a specific assignment, automatically renaming them with the student's name.
- Course and Assignment Discovery: List available courses and assignments.
- Submission Metadata: Retrieve normalized submission payloads and assignment descriptions.
- Grade and Comment Posting: Post grades/comments for individual students or batch updates.
Installation
pip install canvas-instructor-tools
Configuration
Create a .env file in your working directory with your Canvas credentials:
CANVAS_API_URL=https://your.institution.instructure.com
CANVAS_API_KEY=your_api_key_here
Usage
Command Line Interface
To download submissions for a specific assignment:
# Syntax: canvas-tools download <course_id> <assignment_id>
canvas-tools download 12345 67890
Optional arguments:
--outputor-o: Specify the output directory (default: current directory)--include-links: Attempt to download URL submissions as files
Additional commands:
canvas-tools list-courses
canvas-tools list-assignments <course_id>
canvas-tools post-grade <course_id> <assignment_id> <user_id> <posted_grade> --comment "Nice work"
canvas-tools post-comment <course_id> <assignment_id> <user_id> "Please add more tests"
Python API
from canvas_tools import (
download_submission_artifacts,
get_assignment_description,
list_assignment_submissions,
list_course_assignments,
list_courses,
post_submission_grade,
)
courses = list_courses()
assignments = list_course_assignments(course_id=12345)
submissions = list_assignment_submissions(course_id=12345, assignment_id=67890)
description = get_assignment_description(course_id=12345, assignment_id=67890)
download_submission_artifacts(course_id=12345, assignment_id=67890, output_dir="my_downloads", include_links=True)
post_submission_grade(course_id=12345, assignment_id=67890, user_id=111, posted_grade="95", comment="Strong submission")
Development
- Clone the repository.
- Install dependencies:
pip install -e . - Run tests:
python -m unittest discover tests
CI/CD & Publishing
This project uses GitHub Actions for automated testing and publishing.
Workflow Overview
- CI (
.github/workflows/ci.yml): Runs on every Pull Request and push tomain.- Tests across Python 3.11, 3.12, and 3.13.
- Verifies the package builds successfully.
- Publish (
.github/workflows/publish.yml): Runs on version tags (v*) or when a GitHub Release is published.- Builds the package.
- Publishes to TestPyPI and PyPI using Trusted Publishing (OIDC).
How to Publish a New Version
-
Update Version:
- Edit
pyproject.tomland increment theversion(e.g.,0.0.1->0.0.2). - Commit and push to
main.
- Edit
-
Create Release:
- Go to the GitHub repository page.
- Click Releases > Draft a new release.
- Tag version:
v0.0.2(matching yourpyproject.toml). - Title:
v0.0.2. - Click Publish release.
-
Verify:
- Check the Actions tab to see the
Publish to PyPIworkflow running. - Once green, verify the new version is available on PyPI.
- Check the Actions tab to see the
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file canvas_instructor_tools-0.1.0a1.tar.gz.
File metadata
- Download URL: canvas_instructor_tools-0.1.0a1.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71490446f00d908acc35b0e2ba561082c59488afee268b588eb0de5a34661ebe
|
|
| MD5 |
2ecf2f044acb7a6274e5724ad5b215a9
|
|
| BLAKE2b-256 |
467a7cc885ec85afead786288434f557835d5007f30f9283c078be5df9d7d4a8
|
Provenance
The following attestation bundles were made for canvas_instructor_tools-0.1.0a1.tar.gz:
Publisher:
publish.yml on gperdrizet/canvas-instructor-tools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
canvas_instructor_tools-0.1.0a1.tar.gz -
Subject digest:
71490446f00d908acc35b0e2ba561082c59488afee268b588eb0de5a34661ebe - Sigstore transparency entry: 1832104041
- Sigstore integration time:
-
Permalink:
gperdrizet/canvas-instructor-tools@f069836d87be8d3e4f507934f4684cc7761e4f11 -
Branch / Tag:
refs/tags/v0.1.0-alpha.1 - Owner: https://github.com/gperdrizet
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f069836d87be8d3e4f507934f4684cc7761e4f11 -
Trigger Event:
push
-
Statement type:
File details
Details for the file canvas_instructor_tools-0.1.0a1-py3-none-any.whl.
File metadata
- Download URL: canvas_instructor_tools-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0198b8ed68888acc2a73ddc35ed5234ea48ca33a7ffaec0b802e272440b06d0
|
|
| MD5 |
2e54cc3168ddb6d561ea2edef85c2964
|
|
| BLAKE2b-256 |
0bc239a41d11e5dc6406d535278f4e18b73090c579a8bcbc00dd81b4f21df7af
|
Provenance
The following attestation bundles were made for canvas_instructor_tools-0.1.0a1-py3-none-any.whl:
Publisher:
publish.yml on gperdrizet/canvas-instructor-tools
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
canvas_instructor_tools-0.1.0a1-py3-none-any.whl -
Subject digest:
b0198b8ed68888acc2a73ddc35ed5234ea48ca33a7ffaec0b802e272440b06d0 - Sigstore transparency entry: 1832104120
- Sigstore integration time:
-
Permalink:
gperdrizet/canvas-instructor-tools@f069836d87be8d3e4f507934f4684cc7761e4f11 -
Branch / Tag:
refs/tags/v0.1.0-alpha.1 - Owner: https://github.com/gperdrizet
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f069836d87be8d3e4f507934f4684cc7761e4f11 -
Trigger Event:
push
-
Statement type: