Skip to main content

A Python library to clean and format markdown content into Jupyter Notebooks.

Project description

mdtidy

mdtidy is a Python library designed to clean and format markdown content from 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 and code blocks into well-structured Jupyter notebooks, specifically tailored for reviewing AI-generated conversation data.

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.

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.gpt_processor 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.gemini_processor 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.gemini_processor 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)

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.3.1.tar.gz (7.1 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.3.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mdtidy-0.3.1.tar.gz
Algorithm Hash digest
SHA256 9342e65d6874ea7fec09a9d996b8860b8066ef46d13266731b02ba54a55ac2bc
MD5 fe711990fcfb491d72c488bed5fdb7d1
BLAKE2b-256 9ef4b8b9605e4dc1bf0dc936a416ad13d445b75a58d42dd91813add489cc7066

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mdtidy-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 10.3 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.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 76687c02f9f6fb2307a0bb511e360e752d34878511c1c1ed3bd327b03c3f3849
MD5 577711dc9ce3958b9b4ff03522784b66
BLAKE2b-256 0200b74cf2cd9ea3f44aeb53556c97e7a0e6d3c80df3dfbdbeb6bd912583ee5b

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