Skip to main content

A simple context builder and converter toolkit

Project description

ContextMaker

License Python

Feature to enrich the CMBAgents: Multi-Agent System for Science, Made by Cosmologists, Powered by AG2.

Acknowledgments

This project uses the CAMB code developed by Antony Lewis and collaborators. Please see the CAMB website and documentation for more information.


Strategy

ContextMaker is designed to convert any scientific or software library documentation into a clean, standardized text format optimized for ingestion by CMBAgent. It handles multiple input formats including Sphinx documentation, Markdown files, Jupyter notebooks, and source code with embedded docstrings. When documentation is missing, ContextMaker can auto-generate basic API docs directly from the source code. This makes it a versatile tool to prepare heterogeneous documentation sources into a consistent knowledge base for AI agents specialized in scientific research.


Installation

Clone the repository and install in editable mode:

git clone https://github.com/chadiaitekioui/contextmaker
cd contextmaker
python3 -m venv contextmaker_env
source contextmaker_env/bin/activate
pip install -e .

You can now use ContextMaker from the command line.


Usage

Simple Command Line Interface

ContextMaker automatically finds libraries on your system and generates complete documentation with function signatures and docstrings.

# Convert a library's documentation (automatic search)
contextmaker library_name

# Example: convert pixell documentation
contextmaker pixell

# Example: convert numpy documentation
contextmaker numpy

Advanced Usage

# Specify custom output path
contextmaker pixell --output ~/Documents/my_docs

# Specify manual input path (overrides automatic search)
contextmaker pixell --input_path /path/to/library/source

Output

  • Default location: ~/your_context_library/library_name.txt
  • Content: Complete documentation with function signatures, docstrings, examples, and API references
  • Format: Clean text optimized for AI agent ingestion

Supported Inputs

  • Sphinx documentation (conf.py + .rst) - Complete documentation with signatures
  • Markdown README files (README.md)
  • Jupyter notebooks (.ipynb)
  • Python source files with docstrings (auto-generated docs if no user docs)

Library Requirements

For complete documentation extraction, the library should have:

  • A docs/ or doc/ directory containing conf.py and index.rst
  • Source code accessible for docstring extraction

If only the installed package is found (without Sphinx docs), ContextMaker will extract available docstrings from the source code.


Advanced Usage for Developers

Direct Module Usage

# Use the module directly
python -m contextmaker.contextmaker pixell

Manual Sphinx Conversion

For advanced users, you can use the markdown builder directly:

python src/contextmaker/converters/markdown_builder.py \
  --sphinx-source /path/to/docs \
  --output /path/to/output.txt \
  --source-root /path/to/source \
  --html-to-text

Examples

Convert pixell documentation

# 1. Clone pixell (if not already done)
git clone https://github.com/simonsobs/pixell.git ~/Documents/GitHub/pixell

# 2. Generate documentation
contextmaker pixell

# 3. Result: ~/your_context_library/pixell.txt

Convert numpy documentation

# 1. Clone numpy
git clone https://github.com/numpy/numpy.git ~/Documents/GitHub/numpy

# 2. Generate documentation
contextmaker numpy

# 3. Result: ~/your_context_library/numpy.txt

Troubleshooting

Command not found

# Reinstall the package
pip install -e .

# Use module directly
python -m contextmaker.contextmaker pixell

Library not found

# Use manual path
contextmaker pixell --input_path /path/to/pixell/repo

No documentation detected

  • Ensure the library has a docs/ or doc/ directory with conf.py and index.rst
  • Clone the official repository if using an installed package

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

contextmaker-0.0.1.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

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

contextmaker-0.0.1-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file contextmaker-0.0.1.tar.gz.

File metadata

  • Download URL: contextmaker-0.0.1.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for contextmaker-0.0.1.tar.gz
Algorithm Hash digest
SHA256 fd1995f164e0772ec3f7be29591b58102d1560d261cb421860391d8421f93692
MD5 c8eaf670c6a4527c21f8894d27675438
BLAKE2b-256 557c2bebef41aaac6070b9921f6276cfa5db24aa495536cc9b992ff5a7e8b55a

See more details on using hashes here.

File details

Details for the file contextmaker-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: contextmaker-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for contextmaker-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 640beb99838ffcb8821ca0d6bab5aa972eac2cffe85dcc4e912532dce02b1234
MD5 75c0d1e5b7feb8a61ec98f9f577e354c
BLAKE2b-256 470a37d13542f83788a689d50d922d8507fd156129c7be2617f8780ac7bb7b7b

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