Skip to main content

Sunpal small library devs

Project description

Sunpal

Python client library for the Sunpal API - simplifying access to Sunpal services.

PyPI version Python Support

🚀 Quick Start

Installation

pip install sunpal

Basic Usage

import sunpal

# Configure with your credentials
sunpal.configure(
    api_key="your_api_key_here",
    site="sunwise"  # your company/site identifier
)

# Use the library
# (Add your specific usage examples here)

💻 Development

We use Docker for a consistent development environment across all team members.

Quick Setup

# Clone the repository
git clone <repository-url>
cd sunpal-library

# Run the quick start script
./quick-start.sh

The script will guide you through setting up either:

  1. Docker environment (recommended) - Isolated, consistent Python versions
  2. Local environment - Direct Python installation

Development with Docker

# Build the Docker image
make build

# Start development environment
make up

# Enter the container shell
make shell

# Run tests
make test

# Run linting
make lint

# Format code
make format

# See all available commands
make help

Development without Docker

# Create virtual environment
python3 -m venv venv
source venv/bin/activate

# Install dependencies
make install
make install-dev

# Run tests locally
make test-local

# Format and lint
make format
make lint

🧪 Testing

# Run all tests
make test

# Run specific test file
python3 -m unittest tests.customers

# Run specific test
python3 -m unittest tests.interactive.TestCases.test_retrieve

# Multi-version testing (Docker)
make test-all-versions  # Tests on Python 3.8, 3.9, 3.10

📦 Deployment

To deploy a new version to PyPI:

# 1. Update version in setup.py and sunpal/version.py

# 2. Build distribution packages
make dist

# 3. Check packages are valid
make check-dist

# 4. Upload to PyPI (requires credentials)
make deploy

# For TestPyPI first
make deploy-test

🔧 Configuration

Environment Variables

Create a .env file (copy from .env.example):

# Sunpal API Configuration
SUNPAL_API_KEY=your_api_key_here
SUNPAL_SITE=sunwise

# Optional: Override API domain (for local development)
LOCAL_SUNPAL_DOMAIN=localhost:8004

Using Custom Domain

For local development against a local Sunpal API instance:

export LOCAL_SUNPAL_DOMAIN=localhost:8004
export SUNPAL_API_KEY=your_dev_api_key

📚 Documentation

🛠️ Available Make Commands

Run make help to see all available commands:

  • Development: build, up, down, shell, logs
  • Testing: test, test-local, test-all-versions, coverage
  • Code Quality: lint, format, type-check
  • Deployment: dist, deploy, deploy-test
  • Cleanup: clean, docker-clean, clean-all

📋 Requirements

  • Runtime: Python 3.6+
  • Development: Python 3.9+ (or use Docker)
  • Docker: For containerized development (optional but recommended)

🤝 Contributing

  1. Create a feature branch from master
  2. Make your changes
  3. Run tests: make test
  4. Format code: make format
  5. Lint: make lint
  6. Commit with conventional commits (feat:, fix:, docs:, etc.)
  7. Submit a pull request

📄 License

See LICENSE.txt for details.

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

sunpal-0.2.0.tar.gz (56.0 kB view details)

Uploaded Source

Built Distribution

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

sunpal-0.2.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file sunpal-0.2.0.tar.gz.

File metadata

  • Download URL: sunpal-0.2.0.tar.gz
  • Upload date:
  • Size: 56.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sunpal-0.2.0.tar.gz
Algorithm Hash digest
SHA256 bcd5d10dbf458abb85475157fbdd262b90a3b3035978aa667b1759fc5bcd3b9d
MD5 fcdaad576d0a00c6fbefea9d16ba0f2e
BLAKE2b-256 29c86f5db0671ed65df522cd4c5a2a0957203f8ec89a62ed80c64744ee33222e

See more details on using hashes here.

File details

Details for the file sunpal-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: sunpal-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sunpal-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 214cf965fdcd5bc8aeecf7095abaf022e3b28fb9f3039ff8a0094a8bcb752940
MD5 16ee961c6291499ca5cc36ef038e11f0
BLAKE2b-256 dc8641a699345b984a94a982f234e3bb45f3971b60959980045066cc4ce2852c

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