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

Uploaded Python 3

File details

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

File metadata

  • Download URL: sunpal-0.2.2.tar.gz
  • Upload date:
  • Size: 56.5 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.2.tar.gz
Algorithm Hash digest
SHA256 c8a06d5d649d0395526a30a13195ebce77c2eef1a0c7a03e7fdf5f6ce8cc5566
MD5 13c5a03521b76361a153f0e1d1ed3b16
BLAKE2b-256 d21f1bc49c17f1327065f66412441eda8f9665f8260504930c071b99e23e32c7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sunpal-0.2.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1c4f247cac7d5a57457584cdb6af7494c31e57fbbf28979577bb4d9470711a10
MD5 f95c8af38e05a4f3ec80f4a1272f3f49
BLAKE2b-256 2d29c51d218f637a5650cfcf80d94d65f7de00e477f881964267efc604076e0b

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