Skip to main content

A command-line tool for interacting with Canvas LMS

Project description

๐ŸŽ“ Canvas CLI

Status Tests Tests Python License

Automate your Canvas LMS submissions with a git like command-line interface!

Are you tired of navigating through the Canvas web interface to submit assignments? Canvas CLI puts the power of Canvas in your terminal, making it easy to submit assignments and manage your Canvas interactions with simple commands.

โœจ Features

  • ๐Ÿ“ค Submit assignments directly from your terminal
  • ๐Ÿ”„ Initialize projects with course and assignment information for quick submissions
  • โš™๏ธ Configure once, use anywhere with global and project-specific settings
  • ๐Ÿš€ Fast and efficient workflow for developers and students who live in the terminal

๐Ÿšจ Pre-Release Notice

This project is currently in pre-release status. Most features are working, but you might encounter some rough edges or features marked as "Not Implemented" (NI).

๐Ÿ› ๏ธ Installation

# Clone this repository
git clone https://github.com/yourusername/canvas-cli.git
cd canvas-cli

# Install in development mode
pip install -e .

After installation, the canvas command will be available in your terminal!

๐Ÿ”ง Configuration

Before using the tool, configure it with your Canvas API token:

canvas config set --global token YOUR_CANVAS_API_TOKEN
canvas config set --global host your-institution.instructure.com

๐Ÿ”‘ Getting Your Canvas API Token

  1. Log in to your Canvas account
  2. Go to Account > Settings
  3. Scroll down to "Approved Integrations"
  4. Click "New Access Token"
  5. Generate a token with appropriate permissions
  6. Copy the token for use with Canvas CLI

๐Ÿ“ Commands

โšก Initialize a Project

canvas init

This interactive command helps you set up a project configuration for faster assignment submissions.

๐Ÿ“ค Submit an Assignment

# Full command (works anywhere)
canvas push -cid COURSE_ID -aid ASSIGNMENT_ID -f path/to/submission.py

# In an initialized project directory:
canvas push                     # Uses saved course ID, assignment ID, and file
canvas push -f different.py     # Override the default file

# Get info on the course and assignment
canvas status --course_details

โš™๏ธ View Configuration

canvas config --global list
canvas config --local list

๐Ÿ” Finding Course and Assignment IDs

Course and Assignment IDs can be found in the URLs of your Canvas pages:

  • Course ID: The number in the URL after "courses/" (e.g., https://canvas.instructure.com/courses/123456 โ†’ Course ID is 123456)

  • Assignment ID: The number in the URL after "assignments/" (e.g., https://canvas.instructure.com/courses/123456/assignments/789012 โ†’ Assignment ID is 789012)

๐Ÿ“‹ Example Workflow

# Create a new project directory
mkdir python_assignment
cd python_assignment

# Create your solution file
echo "print('Hello, Canvas!')" > solution.py

# Submit your solution when ready
canvas push -cid 123456 -aid 789012 -f solution.py

๐Ÿš‘ Troubleshooting

  • Authentication Error: Make sure your API token is valid and has the required permissions
  • File Not Found: Double-check the path to your submission file
  • Course/Assignment Not Found: Verify the course and assignment IDs

๐Ÿ“Š Requirements

  • Python 3.6+
  • Requests library

๐Ÿ“œ License

This project is open source and available under the GPL v3 License.

๐Ÿ“‹ Roadmap & TODOs

Future improvements and features planned for Canvas CLI:

  • ๐Ÿ”„ Consider git remote paradigm over npm package.json for canvas init
  • โฌ‡๏ธ Add canvas pull to download current submissions and assignment descriptions
  • โš™๏ธ Implement cascading config scope like git
  • ๐Ÿ” Build a TUI for getting course ID and assignment ID from name
  • ๐Ÿ“Š Add ability to retrieve versioning of submissions
  • ๐Ÿ“… Implement git status-like command to get due dates, grading status, and comments
    • ๐ŸŽ“ Get grades via submissions
    • ๐Ÿ›๏ธ Show completed vs open assignments
  • ๐Ÿ’ฌ Add commands for commenting on submissions
  • ๐ŸŽจ Improve CLI interface and error handling
  • ๐Ÿ“œ Add more detailed documentation and examples
  • ๐ŸŽฌ Add a github actions integration to automatically submit on push to main
  • ๐Ÿ“ฆ Package the tool for easy installation via pip or conda
  • ๐Ÿค Add support for zipping up multiple folders for submission
  • ๐Ÿ“ฆ Add support for submitting multiple files at once
  • ๐Ÿ“ƒ Add support for pagination
  • ๐Ÿ“‚ Add file select support to TUIs

๐Ÿค Contributing

Contributions are welcome! Feel free to submit pull requests or open issues to improve the tool.

๐Ÿ”— Related Projects

Tired of clicking into a file module to download it? Try canvas-file-downloader for a simple extension to download files from Canvas.


Made with โค๏ธ by a student who was tired of clicking through Canvas

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_cmd-0.1.2.tar.gz (45.0 kB view details)

Uploaded Source

Built Distribution

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

canvas_cmd-0.1.2-py3-none-any.whl (36.9 kB view details)

Uploaded Python 3

File details

Details for the file canvas_cmd-0.1.2.tar.gz.

File metadata

  • Download URL: canvas_cmd-0.1.2.tar.gz
  • Upload date:
  • Size: 45.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for canvas_cmd-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d175bec70fd6572ed59e0ee02ec1757b2280f80537a432a72abac10eaaecb720
MD5 e7a034d9c5f72e8ab0293ee2871ec127
BLAKE2b-256 f238e92e3d22ad5a13d9ce5b62837f7d66c613fbda559e440a008e6aed5f8b5c

See more details on using hashes here.

Provenance

The following attestation bundles were made for canvas_cmd-0.1.2.tar.gz:

Publisher: publish-pypi.yml on PhantomOffKanagawa/canvas-cli

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_cmd-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: canvas_cmd-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 36.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for canvas_cmd-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5d268f8f1fef689e558a651078ccb0e73d20cb2d05b22b76a1b5ce9f3661a870
MD5 b40d84b625d5e052e47bc11bdef13485
BLAKE2b-256 9eee788eff85633340ceba9f3bb4b0109e7064442d4273da10a6e59e9ef4ed03

See more details on using hashes here.

Provenance

The following attestation bundles were made for canvas_cmd-0.1.2-py3-none-any.whl:

Publisher: publish-pypi.yml on PhantomOffKanagawa/canvas-cli

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