A command-line tool for interacting with Canvas LMS
Project description
๐ Canvas CLI (Canvas-CMD on 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, andclone - ๐ 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
- Log in to your Canvas account
- Go to Account > Settings
- Scroll down to "Approved Integrations"
- Click "New Access Token"
- Generate a token with appropriate permissions
- 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 is123456) -
Assignment ID: The number in the URL after "assignments/" (e.g.,
https://canvas.instructure.com/courses/123456/assignments/789012โ Assignment ID is789012)
๐ 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 - ๐ฌ
Addcanvas pullto download current submissions - โฌ๏ธ
Addcanvas cloneto 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 - ๐
Implementgit 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b5f363b8ef73d316db6eeb85dbee355dce28e4a175c8b155c1b5e5b209b80c9
|
|
| MD5 |
5b3cd26be10436c45da39bb0958f5783
|
|
| BLAKE2b-256 |
d5571f0c9834528b140cb55c5b5f8eb8eb089b7ca120108cd41eed92e4862b43
|
Provenance
The following attestation bundles were made for canvas_cmd-0.2.0.tar.gz:
Publisher:
publish-pypi.yml on PhantomOffKanagawa/canvas-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
canvas_cmd-0.2.0.tar.gz -
Subject digest:
5b5f363b8ef73d316db6eeb85dbee355dce28e4a175c8b155c1b5e5b209b80c9 - Sigstore transparency entry: 200551864
- Sigstore integration time:
-
Permalink:
PhantomOffKanagawa/canvas-cli@2cd48d9c17b1bfa8b5e648e329f285f5bb6a6d3a -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/PhantomOffKanagawa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@2cd48d9c17b1bfa8b5e648e329f285f5bb6a6d3a -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bc90c7d07ad7eefed0c47b56a9a9f50541d8cdedd69a9238f10a4bf5aeac432
|
|
| MD5 |
81d0551df79ed22b70e620d24dc02e68
|
|
| BLAKE2b-256 |
a9d76e5d0231421f5740ba99e8f158624e7a2fbe08a324cad2e3361d0d374b00
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
canvas_cmd-0.2.0-py3-none-any.whl -
Subject digest:
8bc90c7d07ad7eefed0c47b56a9a9f50541d8cdedd69a9238f10a4bf5aeac432 - Sigstore transparency entry: 200551865
- Sigstore integration time:
-
Permalink:
PhantomOffKanagawa/canvas-cli@2cd48d9c17b1bfa8b5e648e329f285f5bb6a6d3a -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/PhantomOffKanagawa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@2cd48d9c17b1bfa8b5e648e329f285f5bb6a6d3a -
Trigger Event:
release
-
Statement type: