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

Uploaded Python 3

File details

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

File metadata

  • Download URL: sunpal-0.2.3.tar.gz
  • Upload date:
  • Size: 57.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.3.tar.gz
Algorithm Hash digest
SHA256 daea781737e29ff9bb1c160a1e85c6d1896fc4bd1a7aed2721a062821bcfbd67
MD5 2bbcc6718f799fff98334dfb12bdca5e
BLAKE2b-256 4a372c601f5b845d3d262d5f085a50f45e1a646a2800a7ca580a091c9b3cfcde

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sunpal-0.2.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cd6a1a37f335384c8d99a6586738922592390f1f4188c0cac034a22406f7e792
MD5 1109a376576992bc9171d7bf5abd2bbe
BLAKE2b-256 15d9c05c698681fc8b28dcdc7a23a82a6195ffb6a36edd1f74c5f6adc5130658

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