Skip to main content

A Python library for processing conversation data, creating Jupyter Notebooks, handling Google Drive uploads, and updating Google Sheets.

Project description

mdtidy

mdtidy is a Python library designed to process conversational AI outputs (specifically GPT and Gemini) into Jupyter Notebooks (.ipynb), while also counting code errors within the content. It's an intuitive tool for transforming raw markdown, code blocks, and conversation data into well-structured Jupyter notebooks, specifically tailored for reviewing AI-generated conversation data and integrating with Google Drive and Google Sheets for enhanced data management.

Features

  • Markdown to Jupyter Notebook: Convert markdown content with embedded Python code blocks into a Jupyter Notebook file.
  • Error Counting: Identify and count common Python error types within the content.
  • Conversation Analysis: Supports parsing and formatting conversation data from both GPT and Gemini models.
  • Google Drive Integration: Upload processed notebooks to Google Drive.
  • Google Sheets Integration: Update Google Sheets with processed conversation data and error counts.

Installation

Install mdtidy using pip:

pip install mdtidy

Usage

Convert GPT Conversations to Notebook

This example shows how to process GPT conversation data into a structured Jupyter notebook.

from mdtidy.process_gpt_conversation import process_gpt_conversation

# Trigger the processing of a GPT conversation, prompting for required details
process_gpt_conversation()

Convert Gemini Conversations to Notebook

This example details processing Gemini model conversations into a notebook format, integrating error analysis.

from mdtidy.process_gemini_conversation import process_gemini_conversation

input_string_1 = """
# Insert the content of the first input string here, preserving its structure.
"""

input_string_2 = """
# Insert the content of the second input string here, preserving its structure.
"""

# Add more input strings as needed.

# Prepare your input strings for the Gemini model conversation
input_strings = [input_string_1, input_string_2]  # Extend this list as needed.
process_gemini_conversation(input_strings)

Count Code Errors

This function identifies and counts typical Python errors within given content.

from mdtidy.process_gemini_conversation import count_code_errors

# Example content with typical Python errors
input_strings_with_errors = [
    """
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'variable' is not defined

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'str'
"""
]

# Count and display code errors
error_counts = count_code_errors(input_strings_with_errors)
print(error_counts)

Update Google Sheets

This example shows how to update Google Sheets with processed conversation data and error counts. The first time you run this function, you will be prompted to provide the name of the Google Sheet and the path to your Google Sheets API credentials. These details will be saved for future use, but you will have the option to update them if needed.

from mdtidy.update_google_sheets import update_google_sheet

# Update the Google Sheet
update_google_sheet()

The update_google_sheet function will automatically use the default directory comp_ana_json for JSON files and the stored Google Sheets credentials and spreadsheet name from the configuration file (google_sheets.ini).

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

mdtidy-0.4.0.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mdtidy-0.4.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file mdtidy-0.4.0.tar.gz.

File metadata

  • Download URL: mdtidy-0.4.0.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.9

File hashes

Hashes for mdtidy-0.4.0.tar.gz
Algorithm Hash digest
SHA256 f379f83d7775ebd2922ef24cddddf8d74e422496b6b8b678ca83730cc76c44e3
MD5 b7b2371b29a4f57e2cc6ef99835604c3
BLAKE2b-256 e45324fc411ff6e0c7042fdf7af7fd1b25f9f8c21b7c3bf4de0523de72767154

See more details on using hashes here.

File details

Details for the file mdtidy-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: mdtidy-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.9

File hashes

Hashes for mdtidy-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9f68bfa41dafc7369fe9fcca37b4f182600fbe62a630ada9e409a8df9e972a9
MD5 837309ceac41b9fb27ee836dfde55132
BLAKE2b-256 83f04937666b70ff49b4a29648db5c01c573f480f6c9781f610329db2eed6902

See more details on using hashes here.

Supported by

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