Skip to main content

Trello Extract is a Python project that uses the py-trello library and python-dotenv to authenticate with the Trello API and fetch details from Trello boards, lists, and cards. This project demonstrates how to securely manage API credentials and interact with Trello's API to retrieve project data for further processing.

Project description

AI Trello Extract

Trello Extract is a Python project that uses the py-trello library and python-dotenv to authenticate with the Trello API and fetch details from Trello boards, lists, and cards. This project demonstrates how to securely manage API credentials and interact with Trello's API to retrieve project data for further processing.

Features

  • Authenticate with the Trello API using OAuth.
  • Fetch details of all accessible Trello boards.
  • Retrieve lists and cards from a specified Trello board.
  • Securely manage API credentials using environment variables.

Install through PyPI

pip install ai-trello-extract

For more details, visit the PyPI project page.

Setup

1: Register for Trello API Access

  1. Sign Up for a Trello Account:

    • If you don't have a Trello account, sign up at Trello.
  2. Get API Key and Token:

    • Go to the Trello Developer Portal.
    • Copy your API Key.
    • Click on the "Token" link to generate a token. This token will be used for authentication in your API requests.

2. Clone the repository:

git clone https://github.com/DEV3L/ai-trello-extract
cd ai-trello-extract

Copy the env.local file to a new file named .env and replace the placeholder environment variables with your actual Trello API key:

cp env.default .env

Environment Variables

The following environment variables can be configured in the .env file:

  • TRELLO_API_KEY: The Trello API key
  • TRELLO_API_TOKEN: The Trello API token
  • TRELLO_BOARD_NAME: The Trello board name
  • OUTPUT_DIRECTORY: The output directory

3. Setup a virtual environment with dependencies and activate it:

brew install hatch
hatch env create
hatch shell

Usage

The trello_integration.py script will:

  1. Authenticate with the Trello API using the credentials provided in the .env file.
  2. Fetch and print the details of all accessible Trello boards.
  3. Fetch and print the lists and cards from the first Trello board in the list.

Testing

End to End Test

hatch run e2e

Unit Tests

hatch run test

Coverage Gutters:

Command + Shift + P => Coverage Gutters: Watch

Example

Example Trello Board: AI Trello Extract Example

Example Program

from loguru import logger

from ai_trello_extract.clients.trello_client import get_trello_client
from ai_trello_extract.env_variables import ENV_VARIABLES, set_env_variables
from ai_trello_extract.orchestrators.orchestration_service import OrchestrationService
from ai_trello_extract.services.trello_service import TrelloService


def main():
    orchestration_service = OrchestrationService(
        TrelloService(get_trello_client(ENV_VARIABLES.trello_api_key, ENV_VARIABLES.trello_api_token))
    )

    try:
        markdown_file_name = orchestration_service.write_board_markdown_to_file(
            ENV_VARIABLES.trello_board_name, ENV_VARIABLES.output_directory
        )
        logger.info(f"Markdown file written to {markdown_file_name}")
    except RuntimeError as e:
        logger.error(e)


if __name__ == "__main__":
    set_env_variables()
    main()

Example Output

# BACKLOG

This is a list of cards, work items, user stories, and tasks that are in the backlog category.

## Title: Integrate into other projects

## List Name: Backlog

## Labels

- Future

# TODO

This is a list of cards, work items, user stories, and tasks that are in the todo category.

## Title: Test and Make Sure It Works

## List Name: Todo

## Labels

- Testing

## Description

Need to verify the code works as planned

# DOING

This is a list of cards, work items, user stories, and tasks that are in the doing category.

## Title: Upload to PyPI

## List Name: Doing

## Labels

- Code

# DONE

This is a list of cards, work items, user stories, and tasks that are in the done category.

## Title: Make new project

## List Name: Done

## Labels

- Code

## Description

Create the project for uploading to PyPI

### Comments

Use existing ai-assistant-manager project as a base

Contributing

We welcome contributions! To contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. Make your changes.
  4. Ensure all tests pass.
  5. Submit a pull request with a detailed description of your changes.

Code of Conduct

We expect all contributors to adhere to our Code of Conduct:

  • Be respectful and considerate.
  • Avoid discriminatory or offensive language.
  • Report any unacceptable behavior to the project maintainers.

By participating in this project, you agree to abide by these guidelines.

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

ai_trello_extract-0.0.2.tar.gz (12.8 kB view hashes)

Uploaded Source

Built Distribution

ai_trello_extract-0.0.2-py3-none-any.whl (19.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page