From f66a9c8224f6d1f6fbb30d1b199f4ae5f0050126 Mon Sep 17 00:00:00 2001 From: Brian Peterson Date: Mon, 29 Sep 2025 13:01:44 -0500 Subject: [PATCH] docs: updated readme --- CLAUDE.md | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 175 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..80afe0d --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,91 @@ +# Claude Code Development Guide + +This file contains information for Claude Code to help with development tasks for the Channel Advisor API Python project. + +## Project Overview + +This is a strongly typed Pydantic-based Python API client for Channel Advisor with built-in pagination, retries, and AI-enhanced product data capabilities. + +## Development Commands + +### Testing +```bash +# Run full test suite with coverage +make test + +# Runs: pytest --cov --cov-branch --cov-report=xml --cov-report=term-missing:skip-covered +``` + +### Code Quality +```bash +# Run linting (flake8) +make lint + +# Auto-fix formatting and imports +make fix + +# Combines fix + lint +make lint-fix +``` + +### Versioning +```bash +# Check what version changes would be made (dry run) +make version-noop + +# Create new version using semantic-release +make version +``` + +## Code Standards + +- **Linting**: Use `flake8` for code linting (configured in `.flake8`) +- **Formatting**: Use `black` with 120 character line length +- **Import Management**: `autoflake` removes unused imports and variables +- **Testing**: `pytest` with coverage reporting required +- **Type Hints**: Full type annotation required (Pydantic models) + +## Project Structure + +``` +channel_advisor_api/ +├── models/ # Pydantic models and API wrappers +├── utils/ # Utility functions (logger, AWS helpers) +└── __init__.py +``` + +## Development Workflow + +1. **Create Feature Branch**: Create a branch from `main` +2. **Implement Changes**: Follow coding standards, add tests +3. **Run Quality Checks**: `make lint-fix` and `make test` +4. **Create Pull Request**: Submit PR against `main` branch +5. **Merge**: After approval, merge triggers automatic PyPI deployment via GitHub Actions + +## Environment Setup + +Required environment variables for development: +```bash +CA_REFRESH_TOKEN=your_refresh_token +CA_APPLICATION_ID=your_application_id +CA_SHARED_SECRET=your_shared_secret +``` + +## Key Dependencies + +- **pydantic**: Type validation and serialization +- **requests**: HTTP client for Channel Advisor API +- **aws-lambda-powertools**: AWS integration utilities + +## Testing Guidelines + +- Write tests for all new functionality +- Maintain test coverage (current config reports missing coverage) +- Use pytest fixtures for reusable test setup +- Mock external API calls in tests + +## Deployment + +- Automatic deployment to PyPI via GitHub Actions on merge to main +- Semantic versioning handled by `semantic-release` +- Version bumps automatically update `pyproject.toml` and `__init__.py` \ No newline at end of file diff --git a/README.md b/README.md index e69de29..488d9ac 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,84 @@ +# Channel Advisor API Python + +A strongly typed Pydantic-based Python API client for Channel Advisor with built-in pagination, retries, and AI-enhanced product data improvement capabilities. + +## Features + +- **Strongly Typed**: Full Pydantic model support with comprehensive type hints +- **Robust Pagination**: Automatic handling of paginated API responses +- **Smart Retries**: Built-in retry logic for reliable API interactions +- **AI Enhancement**: AI-powered functions to improve and optimize product data +- **Easy Authentication**: Simple environment variable-based credential management + +## Installation + +```bash +# Using pip +pip install channel-advisor-api-python + +# Using uv +uv add channel-advisor-api-python +``` + +## Quick Start + +### 1. Set up your environment variables + +Create a `.env` file or set the following environment variables: + +```bash +CA_REFRESH_TOKEN=your_refresh_token_here +CA_APPLICATION_ID=your_application_id_here +CA_SHARED_SECRET=your_shared_secret_here +``` + +### 2. Basic Usage + +```python +from channel_advisor_api.models.channel_advisor import BaseProduct +from channel_advisor_api.models.channel_advisor_client import ChannelAdvisorClient + +# Initialize client +client = ChannelAdvisorClient() + +# Get products with automatic pagination and typing +products = BaseProduct.get_client().get_products() + +# Access strongly typed product data +for product in products: + print(f"SKU: {product.sku}") + print(f"Title: {product.title}") + print(f"Price: {product.price}") +``` + +### 3. AI-Enhanced Product Data + +```python +from channel_advisor_api.models.channel_advisor_llm import ProductOptimizer + +# Use AI to improve product descriptions and titles +optimizer = ProductOptimizer() +improved_product = optimizer.enhance_product_data(product) +``` + +## API Credentials + +To use this library, you need Channel Advisor API credentials: + +1. **CA_REFRESH_TOKEN**: Your Channel Advisor refresh token +2. **CA_APPLICATION_ID**: Your application ID from Channel Advisor +3. **CA_SHARED_SECRET**: Your shared secret from Channel Advisor + +You can obtain these from your Channel Advisor developer account. + +## Development + +See [CLAUDE.md](CLAUDE.md) for development setup and contribution guidelines. + +## License + +This project is licensed under the MIT License. + +## Support + +For issues and feature requests, please use the GitHub issue tracker. \ No newline at end of file