-
Notifications
You must be signed in to change notification settings - Fork 0
Setup and Installation
This guide will help you install and configure Canvas-CLI, a command-line tool designed for interacting with Canvas Learning Management System.
Before installing Canvas-CLI, ensure you have the following:
- Python 3.9 or higher installed
- pip (Python package installer)
- A Canvas LMS account with API access
The easiest way to install Canvas-CLI is from PyPI:
pip install canvas-cmdThis will install the latest stable version along with all dependencies.
Note
I am so aware how unhelpful it is that it is canvas-cmd on PyPI and canvas-cli on GitHub. I prefer canvas-cli as a name, but it was already taken on PyPI. I will make a decision on this in the future, but for now, it is canvas-cmd on PyPI and canvas-cli everywhere else.
For the latest development version or to contribute to the project:
-
Clone the repository:
git clone https://github.com/PhantomOffKanagawa/canvas-cli.git cd canvas-cli -
Install in development mode:
pip install -e .
After installation, you need to configure Canvas-CLI with your Canvas API token:
canvas config set --global token YOUR_CANVAS_API_TOKEN
canvas config set --global host your-institution.instructure.com- Log in to your Canvas account
- Navigate to Account > Settings
- Scroll down to "Approved Integrations"
- Click "New Access Token"
- Enter a purpose (e.g., "Canvas-CLI") and an optional expiration date
- Click "Generate Token"
- Copy the token shown (you will only see it once)
To verify that CanvasLMS-CLI is correctly installed and configured:
canvas --helpThis should display the help message with available commands.
canvas config --global listThis should display your configured settings.
For a better workflow, you can initialize a project directory with Canvas course and assignment information:
# Create a project directory
mkdir my_assignment
cd my_assignment
# Initialize with Canvas information
canvas initFollow the interactive prompts to select your course and assignment.
Tip
Many commands have the --tui option, which provides a text-based user interface for selecting courses and assignments. This is useful as it saves you from getting IDs from the web interface.
-
"Command not found" error
Ensure the Python scripts directory is in your PATH. You may need to restart your terminal after installation.
-
Authentication errors
Check that your API token is valid and correctly entered. Tokens have specific permissions and may expire.
-
error: externally-managed-environment
Check you are in a virtual environment if you want to use one, else I recommend using "pipx" for a global installation.
If you encounter any issues not covered here:
- Check the full documentation
- Open an issue on GitHub
After installation and configuration, check out the Usage Guide for detailed instructions on how to use CanvasLMS-CLI for your Canvas assignments.