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.1.tar.gz (56.4 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.1-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sunpal-0.2.1.tar.gz
  • Upload date:
  • Size: 56.4 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.1.tar.gz
Algorithm Hash digest
SHA256 81900a6f24b44319e03bed580364d264d9205f452e967b4cc56114dd3892ab66
MD5 744fa639b8496d67bb1bce8ed92693a8
BLAKE2b-256 c8c2a01932b6f509f71c43b23ae963dd9783173b4b60db36db25022e2537bed5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sunpal-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 24b5c65b09910a3fcb3e092204e9152fc470e803566971ae0933985d36a4c059
MD5 ad6078183c12c2afd7121ce701b9617f
BLAKE2b-256 266ae67fdefb50a3c612547c39c17d99349252bd6f8ccba6fb6db13122d34b0f

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