LLM-powered Python library explorer
Project description
PyLib Explorer
PyLib Explorer is an LLM-powered tool for exploring Python libraries. This library generates comprehensive README.md files for randomly selected or specified Python packages, helping developers understand new libraries and implement them in their applications.
Features
- 🔍 Random Python library discovery
- 🤖 OpenAI and Claude LLM integrations
- 📚 Detailed README.md file generation
- 🔧 Code examples and usage scenarios
- 📊 Popularity-based filtering
- 🧩 Easy-to-use API and CLI
- 🌍 Multi-language support (create READMEs in any language)
Installation
pip install pylib-explorer
Quick Start
Python API Usage
from pylib_explorer.core import LibExplorer
# You can provide your API key directly or use environment variables
# English is the default language (language="en")
explorer = LibExplorer(api_key="your_api_key_here", provider="openai")
# For README in a different language:
explorer_tr = LibExplorer(api_key="your_api_key_here", provider="openai", language="tr")
# Generate README for a random package
readme_content = explorer.generate_readme()
print(f"README file created: {explorer.output_dir}")
# or for a specific package:
readme_content = explorer.generate_readme(package_name="requests")
Command Line Usage
For a random library exploration:
# Set your OpenAI API key as an environment variable
export OPENAI_API_KEY=your_api_key_here
# Explore a random library (default language: English)
pylib-explorer
# Explore in Turkish
pylib-explorer --language tr
# Explore in German
pylib-explorer --language de
For a specific library exploration:
# English (default)
pylib-explorer --package requests
# Turkish
pylib-explorer --package requests --language tr
Using Claude API:
export ANTHROPIC_API_KEY=your_anthropic_api_key
pylib-explorer --provider claude --package pandas --language fr
Command Line Options
usage: pylib-explorer [-h] [--package PACKAGE] [--provider {openai,claude}]
[--api-key API_KEY] [--output-dir OUTPUT_DIR]
[--min-downloads MIN_DOWNLOADS] [--language LANGUAGE]
[--verbose]
Options:
-h, --help Show this help message and exit
--package PACKAGE, -p PACKAGE
Name of the Python package to explore. If not specified, a random package will be selected.
--provider {openai,claude}, -m {openai,claude}
LLM provider to use ('openai' or 'claude').
--api-key API_KEY, -k API_KEY
API key for the LLM provider. If not specified, it will be read from environment variables.
--output-dir OUTPUT_DIR, -o OUTPUT_DIR
Directory where README files will be saved.
--min-downloads MIN_DOWNLOADS, -d MIN_DOWNLOADS
Minimum download count filter for random selection.
--language LANGUAGE, -l LANGUAGE
Language for the README content (e.g.: 'en', 'tr', 'fr', 'de', etc.)
--verbose, -v Enable verbose logging mode.
Supported Languages
PyLib Explorer can generate READMEs in any language supported by the LLMs. To specify the language:
- You can use ISO language codes:
en,tr,fr,de,es,it, etc. - Or you can use full language names:
English,Turkish,French,German, etc.
English is the default language (en).
How Language Selection Works
PyLib Explorer communicates your language choice to the LLM with clear and strong instructions. Here's how it works:
- Your language choice (short codes like
tr,en) is converted to full language names - The prompt sent to the LLM includes:
- At the beginning: "IMPORTANT: You must prepare this README in {language} language!"
- At the end: "REMINDER: All content must be in {language} language! This is very important."
- These strong instructions ensure the LLM produces content in the specified language
If you request a specific language but get content in a different language, please report it through GitHub issues.
Setting Up API Keys
PyLib Explorer requires API keys for either OpenAI or Claude APIs. You can provide these keys in these ways:
- Environment Variables: Set
OPENAI_API_KEYorANTHROPIC_API_KEYenvironment variables. - Direct Parameter: Provide API keys directly via code or CLI.
- .env File: Create a
.envfile in your project's root directory:OPENAI_API_KEY=your_openai_api_key ANTHROPIC_API_KEY=your_anthropic_api_key
Development
Requirements
- Python 3.7+
- OpenAI and/or Anthropic API keys
Installation
git clone https://github.com/username/pylib-explorer.git
cd pylib-explorer
pip install -e ".[dev]"
Running Tests
pytest
License
Licensed under the MIT License. See LICENSE file for more information.
Contributing
Contributions are welcome! Please check out CONTRIBUTING.md.
Contact
For questions or feedback, please use GitHub Issues.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pylibexplorer-0.1.1.tar.gz.
File metadata
- Download URL: pylibexplorer-0.1.1.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ee97dac54fb007ef1de34392647765f4991942cd40a4f4480b5ce65aaeb2339
|
|
| MD5 |
6af83f4394f15d0e450f616cdc622ce1
|
|
| BLAKE2b-256 |
27e88ccc6cfae0ed297f8d7065a3d60ae0bf7c035d2227245cfaea314f79c543
|
File details
Details for the file pylibexplorer-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pylibexplorer-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0021e0336d0df953dc31b15352771220c6d9299e5c3db2331819f6dcab5fe9c3
|
|
| MD5 |
957f73f68d48c440cd51cfeff24b7ef2
|
|
| BLAKE2b-256 |
abd7b2895c1aee021ac0ce987e1df040c4a474514b647f9708d737a2da8f05ee
|