Skip to main content

🎓 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.

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

Metadata

Release files for canvas-cmd 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for canvas-cmd 0.2.0
File Size Uploaded Provenance Actions
canvas_cmd-0.2.0.tar.gz 57.9 kB With provenance Details for canvas_cmd-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for canvas-cmd 0.2.0
File Interpreter ABI Platform Actions
canvas_cmd-0.2.0-py3-none-any.whl Python 3 none any Details for canvas_cmd-0.2.0-py3-none-any.whl

Total release size: 105.9 kB

Release files / canvas_cmd-0.2.0.tar.gz

Download URL canvas_cmd-0.2.0.tar.gz
Size 57.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5b5f363b8ef73d316db6eeb85dbee355dce28e4a175c8b155c1b5e5b209b80c9
BLAKE2b-256 checksum
How to use checksums
d5571f0c9834528b140cb55c5b5f8eb8eb089b7ca120108cd41eed92e4862b43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 22, 2025.

Transparency log

Release files / canvas_cmd-0.2.0-py3-none-any.whl

Download URL canvas_cmd-0.2.0-py3-none-any.whl
Size 48.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8bc90c7d07ad7eefed0c47b56a9a9f50541d8cdedd69a9238f10a4bf5aeac432
BLAKE2b-256 checksum
How to use checksums
a9d76e5d0231421f5740ba99e8f158624e7a2fbe08a324cad2e3361d0d374b00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 22, 2025.

Transparency log

Security for canvas-cmd 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for canvas_cmd-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 22, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page