Skip to main content

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:

  • --output or -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

  1. Clone the repository.
  2. Install dependencies: pip install -e .
  3. 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 to main.
    • 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

  1. Update Version:

    • Edit pyproject.toml and increment the version (e.g., 0.0.1 -> 0.0.2).
    • Commit and push to main.
  2. Create Release:

    • Go to the GitHub repository page.
    • Click Releases > Draft a new release.
    • Tag version: v0.0.2 (matching your pyproject.toml).
    • Title: v0.0.2.
    • Click Publish release.
  3. Verify:

    • Check the Actions tab to see the Publish to PyPI workflow running.
    • Once green, verify the new version is available on PyPI.

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

canvas_instructor_tools-0.1.0a1.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

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

canvas_instructor_tools-0.1.0a1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file canvas_instructor_tools-0.1.0a1.tar.gz.

File metadata

File hashes

Hashes for canvas_instructor_tools-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 71490446f00d908acc35b0e2ba561082c59488afee268b588eb0de5a34661ebe
MD5 2ecf2f044acb7a6274e5724ad5b215a9
BLAKE2b-256 467a7cc885ec85afead786288434f557835d5007f30f9283c078be5df9d7d4a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for canvas_instructor_tools-0.1.0a1.tar.gz:

Publisher: publish.yml on gperdrizet/canvas-instructor-tools

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

File details

Details for the file canvas_instructor_tools-0.1.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for canvas_instructor_tools-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 b0198b8ed68888acc2a73ddc35ed5234ea48ca33a7ffaec0b802e272440b06d0
MD5 2e54cc3168ddb6d561ea2edef85c2964
BLAKE2b-256 0bc239a41d11e5dc6406d535278f4e18b73090c579a8bcbc00dd81b4f21df7af

See more details on using hashes here.

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

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