Skip to content

clemson-cal/canvas-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Canvas CLI Tool

A command-line interface for interacting with the Canvas LMS API. This tool simplifies common Canvas tasks for instructors and teaching assistants.

Features

  • List courses, assignments, files, students, and assignment groups
  • Set and view configuration options
  • Create and edit assignments from Markdown files with YAML frontmatter
  • Upload files to Canvas
  • Create assignment groups
  • Download and display gradebook information

Installation

pip install git+https://github.com/clemson-cal/canvas-cli.git

(Coming soon... for now just check out the repository and use the script)

Required dependencies:

  • canvasapi
  • typer
  • rich
  • pyyaml
  • markdown

Getting Started

You will need a Canvas API key. Go to Account > Settings > New Access Token. Commands in the set category create or modify a .canvas file in the current directory.

python canvas.py set api_url https://your-institution.instructure.com
python canvas.py set api_key your-canvas-api-key
python canvas.py list courses # find the ID of your course, e.g. 123456
python canvas,pu set course 123456

Usage Examples

View Configuration

python canvas.py show api_url
python canvas.py show course

List Items

python canvas.py list courses
python canvas.py list assignments
python canvas.py list files
python canvas.py list students
python canvas.py list assignment_groups

Create Assignment

Create a Markdown file with YAML frontmatter like:

---
name: Homework 6
points_possible: 4
assignment_group_id: 12345
due_at: January 15, 2026 09:30
submission_types: on_paper
---

# Assignment Title

Instructions go here...

Inline LaTeX is marked like this: \( \exp(i\phi) = \cos(\phi) + i \sin(\phi) \)

[Links](the_file_id) to uploaded files (with Canvas preview if PDF) will be supported soon...

The YAML header contains assignment meta-data. To see allowed keys and values consult the Canvas API docs here.

Then create the assignment:

python canvas.py create assignment hw6.md --publish

Upload File

python canvas.py create file path/to/file.pdf

Create Assignment Group

python canvas.py create assignment_group "Homework"

Find the Group ID

python canvas.py list assignment_groups

Markdown and LaTeX Support

The tool supports Markdown formatting and preserves LaTeX math expressions (enclosed in \( and \)) when creating assignments.

About

Creates Canvas content from the command line

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages