You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

chat-ideyalabs

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chat-ideyalabs

Secure LLM API wrapper with user authentication and request validation

0.1.5
pipPyPI
Maintainers
1

ChatIdeyalabs PyPI Publishing Guide

🚀 Publishing to PyPI

This guide explains how to securely publish the ChatIdeyalabs package to PyPI while keeping sensitive information hidden.

📋 Prerequisites

  • PyPI Account: Create account at pypi.org
  • PyPI API Token: Generate API token in PyPI account settings
  • Environment Setup: Configure environment variables for security

🔐 Security Setup

Environment Variables (Required)

Create a .env file for local development (DO NOT commit this):

# .env file (for local development only)
CHATIDEYALABS_LLM_BASE_URL=https://your-llm-endpoint.com
CHATIDEYALABS_LLM_API_KEY=your-llm-api-key-here
CHATIDEYALABS_MONGODB_URL=mongodb+srv://username:password@cluster.mongodb.net/database
CHATIDEYALABS_MONGODB_DATABASE=your_database
CHATIDEYALABS_MONGODB_COLLECTION=apiKeys
CHATIDEYALABS_ENABLE_LOGGING=true
CHATIDEYALABS_LOG_SENSITIVE=false

Add .env to .gitignore

echo ".env" >> .gitignore
echo "*.env" >> .gitignore
echo "__pycache__/" >> .gitignore
echo "*.pyc" >> .gitignore
echo "dist/" >> .gitignore
echo "build/" >> .gitignore
echo "*.egg-info/" >> .gitignore

📦 Publishing Workflow

Step 1: Install Publishing Tools

pip install build twine

Step 2: Update Version

Edit setup.py:

setup(
    name="chat-ideyalabs",
    version="0.2.0",  # Increment version
    # ... rest of setup
)

Step 3: Clean Previous Builds

rm -rf dist/ build/ *.egg-info/

Step 4: Build the Package

python -m build

This creates:

  • dist/chat_ideyalabs-0.2.0.tar.gz
  • dist/chat_ideyalabs-0.2.0-py3-none-any.whl

Step 5: Test Upload (Optional)

# Upload to TestPyPI first
python -m twine upload --repository testpypi dist/*

# Test installation from TestPyPI
pip install --index-url https://test.pypi.org/simple/ chat-ideyalabs

Step 6: Upload to PyPI

python -m twine upload dist/*

Enter your PyPI API token when prompted.

👥 User Installation & Setup

For Package Users

Installation:

pip install chat-ideyalabs

Environment Setup (Required for Users):

Users need to set environment variables:

# Required: LLM configuration (set by admin)
export CHATIDEYALABS_LLM_BASE_URL=https://your-llm-endpoint.com
export CHATIDEYALABS_LLM_API_KEY=your-llm-api-key-here

# Required: MongoDB configuration for API key validation
export CHATIDEYALABS_MONGODB_URL=mongodb+srv://username:password@cluster.mongodb.net/database

# Optional: Logging configuration
export CHATIDEYALABS_ENABLE_LOGGING=false
export CHATIDEYALABS_LOG_SENSITIVE=false

Usage:

from chat_ideyalabs import ChatIdeyalabs

# User provides their API key
chat = ChatIdeyalabs(api_key="user-api-key-from-admin")
response = chat.invoke("Hello, world!")
print(response.content)

🔧 Administrator Setup

Server Environment Variables

Set these on your API server:

# Production environment
export CHATIDEYALABS_LLM_BASE_URL=https://your-llm-endpoint.com
export CHATIDEYALABS_LLM_API_KEY=your-llm-api-key-here
export CHATIDEYALABS_MONGODB_URL=mongodb+srv://username:password@cluster.mongodb.net/database
export CHATIDEYALABS_MONGODB_DATABASE=your_database
export CHATIDEYALABS_MONGODB_COLLECTION=apiKeys
export CHATIDEYALABS_ENABLE_LOGGING=true
export CHATIDEYALABS_LOG_SENSITIVE=false

Docker Deployment Example

# Dockerfile
FROM python:3.10-slim

ENV CHATIDEYALABS_LLM_BASE_URL=https://your-llm-endpoint.com
ENV CHATIDEYALABS_LLM_API_KEY=your-llm-api-key-here
ENV CHATIDEYALABS_MONGODB_URL=mongodb+srv://username:password@cluster.mongodb.net/database

COPY . /app
WORKDIR /app
RUN pip install -e .

CMD ["uvicorn", "chat_ideyalabs.api.main:app", "--host", "0.0.0.0", "--port", "8000"]

📋 User Documentation Template

Create this for your users:

ChatIdeyalabs Package Usage Guide

Installation:

pip install chat-ideyalabs

Environment Setup:

# Set the MongoDB connection (provided by admin) 
export CHATIDEYALABS_MONGODB_URL=mongodb+srv://username:password@cluster.mongodb.net/database
export CHATIDEYALABS_LLM_BASE_URL=https://your-llm-endpoint.com
export CHATIDEYALABS_LLM_API_KEY=your-llm-api-key-here

Get API Key: Contact your administrator to get an API key.

Usage:

from chat_ideyalabs import ChatIdeyalabs

# Initialize with your API key
chat = ChatIdeyalabs(
    api_key="your-api-key-here",
    response_format={"type": "json_object"},
    temperature=0.7
)

# Basic usage
response = chat.invoke("What is AI?")
print(response.content)

# Async usage
response = await chat.ainvoke("Explain machine learning")
print(response.content)

# Streaming
async for chunk in chat.astream("Write a poem"):
    print(chunk, end="", flush=True)

🔒 Security Benefits

Sensitive data hidden - All secrets in environment variables
No hardcoded credentials - Package safely distributed
User authentication - Each user needs valid API key
Configurable logging - Can disable/mask sensitive data
Easy deployment - Environment-based configuration

🚨 Important Notes

  • Never commit .env files to version control
  • Always test on TestPyPI first before publishing to PyPI
  • Users need environment setup - provide clear instructions
  • API keys expire - implement key rotation if needed
  • Monitor usage - track package downloads and API usage

📈 Version Management

  • Patch: Bug fixes (0.1.0 → 0.1.1)
  • Minor: New features (0.1.0 → 0.2.0)
  • Major: Breaking changes (0.1.0 → 1.0.0)

🆘 Troubleshooting

Publishing Issues

  • Check PyPI API token
  • Verify package name availability
  • Ensure version number is incremented

User Issues

  • Verify environment variables are set
  • Check API key validity
  • Confirm validation endpoint is accessible

Keywords

llm

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.