Python standard library code examples using AI
This application generates code examples for Python's standard library modules using AI. The code examples are generated using the qwen2.5-coder:3b model.
-
Install the necessary dependencies:
pip install -r requirements.txt
-
Ensure the
ollama
service is running. -
Run the main script to generate individual module examples:
python main.py [--force]
Use
--force
to overwrite existing example files. -
The markdown files for each standard library module will be created under the
standard_library_documents
directory. -
Optionally, generate a single merged markdown document:
python create_markdown_version.py
The combined file
markdown_version/python_std_bible.md
will be created. -
Optionally, generate a JSON version:
python create_json_version.py
The file
json_version/python_std_bible.json
will be created. -
Optionally, add table of contents to all markdown files:
python add_table_of_contents.py
This will automatically add a Table of Contents section to each markdown file in the
standard_library_documents
directory, making navigation easier within each document. -
Optionally, generate an HTML version:
python create_html_version.py
The file
html_version/index.html
will be created with interactive navigation and copy buttons. -
You can add or remove modules in
main.py
under thestandard_library
dictionary to customize the examples.
Check out the demo of this application here.
You can use Copilot edits to refactor the standard_library_documents
to improve examples if needed.