Skip to main content

Dart in Terminal and Python integration

Use Dart in Terminal or Python

Updated over a week ago

Prerequisites

Before installing Dart Tools, ensure the following:

  • Python 3.9 or higher: Download the latest version suitable for your operating system from the official Python website.

  • pip (Python package installer): pip is included by default with Python installations from the official source. To verify pip installation, run:

pip --version

If pip is not installed, refer to the pip installation guide. In the Supported Methods section click on your corresponding platform:

Installation

Install Dart Tools using pip:

pip install dart-tools

This command installs the Dart CLI and Python library, enabling terminal-based project management.

Handling naming conflicts

If you have another application named dart installed, it may conflict with Dart Tools. To resolve this:

  • Identify all instances of dart in your system:

which -a dart
  • Determine the path for Dart Tools.

  • Create an alias in your shell configuration file (e.g., .bashrc, .zshrc):

alias dartai="/path/to/dart-tools"
  • Save the file and restart your terminal.

Authentication

Before using Dart Tools, authenticate your session:

dart login

This command initiates an interactive login process. Alternatively, you can set the DART_TOKEN environment variable with your authentication token from your Dart profile.

Using Dart Tools CLI

After authentication, you can perform various task management operations:

  • Create a new task

dart task-create "Update the landing page" -p0 --tag marketing

This command creates a task titled "Update the landing page" with priority P0 and the tag "marketing".

  • Update an existing task

dart task-update [ID] -s Done

Replace [ID] with the actual task ID to mark it as "Done".

  • Explore available commands

dart --help

For detailed information on specific commands, use:

dart [command] --help

Using Dart Tools as a Python Library

Dart Tools can also be utilized within Python scripts:

import os from dart import create_task, is_logged_in, update_task 

# Ensure authentication
if not is_logged_in():

raise Exception("Not authenticated. Please run 'dart login' in the terminal.")

# Create a new task
create_task("Update the landing page", priority="P0", tags=["marketing"])

# Update an existing task
update_task("TASK_ID", status="Done")

Replace "TASK_ID" with the actual ID of the task you wish to update.

Platform-specific notes

Windows

  • Python installation: Download the Windows installer from the official Python website.

  • Environment Variables: Ensure Python and Scripts directories are added to the system's PATH variable.

macOS

  • Python Installation: Use the macOS installer from the official Python website.

  • Homebrew Users: If using Homebrew, install Python with:

brew install python

Linux

  • Python Installation: Use your distribution's package manager. For example, on Debian-based systems:

sudo apt update sudo apt install python3 python3-pip
  • Environment Variables: Ensure that the installation paths are included in your system's PATH variable.

Additional Resources

Did this answer your question?