Skip to main content

A command-line tool for interacting with Canvas LMS

Project description

๐ŸŽ“ Canvas CLI (Canvas-CMD on PyPi)

Status Tests Tests Python License PyPI

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 default assignment and file info for quick upload
  • ๐Ÿ”ฝ Pull descriptions formatted to markdown
  • ๐Ÿ“œ View assignment details and course information
  • ๐Ÿ“‚ Download submissions to quickly get previously submitted work
  • โš™๏ธ Configure once, use anywhere with global and project-specific settings
  • ๐Ÿ”— Based on git and npm paradigms for a quick learning curve with config, init, push, pull, status, and clone
  • ๐Ÿš€ Fast and efficient workflow for developers and students who live in the terminal
  • ๐Ÿ“œ Open source and actively maintained
  • ๐Ÿ› ๏ธ Easy to install and configure with your Canvas API token install from PyPi with pip install canvas-cmd

๐Ÿšจ 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).

Please, please, PLEASE report any bugs or issues you encounter. Your feedback is invaluable in making this tool better!

๐Ÿ› ๏ธ Installation

# Clone this repository
git clone https://github.com/PhantomOffKanagawa/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.9+
  • Requests library
  • Canvas API key
  • Additional dependencies optional

๐Ÿ“œ License

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

๐Ÿ“‹ Roadmap & TODOs

Next Step Refactor with cleo for better testing and cleaner code

Future improvements and features planned for Canvas CLI:

  • ๐ŸŽจ Improve CLI interface and error handling
  • ๐Ÿ”„ Consider git remote paradigm over npm package.json for canvas init
  • ๐Ÿ’ฌ Add canvas pull to download current submissions
  • โฌ‡๏ธ Add canvas clone to get 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
  • ๐Ÿ“œ 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
  • ๐Ÿช™ Add real caching between calls rather than just in place

๐Ÿค 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.2.0.tar.gz (57.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_cmd-0.2.0-py3-none-any.whl (48.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: canvas_cmd-0.2.0.tar.gz
  • Upload date:
  • Size: 57.9 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.2.0.tar.gz
Algorithm Hash digest
SHA256 5b5f363b8ef73d316db6eeb85dbee355dce28e4a175c8b155c1b5e5b209b80c9
MD5 5b3cd26be10436c45da39bb0958f5783
BLAKE2b-256 d5571f0c9834528b140cb55c5b5f8eb8eb089b7ca120108cd41eed92e4862b43

See more details on using hashes here.

Provenance

The following attestation bundles were made for canvas_cmd-0.2.0.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: canvas_cmd-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 48.1 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8bc90c7d07ad7eefed0c47b56a9a9f50541d8cdedd69a9238f10a4bf5aeac432
MD5 81d0551df79ed22b70e620d24dc02e68
BLAKE2b-256 a9d76e5d0231421f5740ba99e8f158624e7a2fbe08a324cad2e3361d0d374b00

See more details on using hashes here.

Provenance

The following attestation bundles were made for canvas_cmd-0.2.0-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