Skip to main content

A modern, asynchronous, and type-safe Python SDK for the Zoho Projects API V3.

Project description

Zoho Projects SDK

PyPI - Version Python Versions Build Status License: MIT

A modern, asynchronous, and type-safe Python SDK for the Zoho Projects API V3.

⚠️ Project status: Active development.

Table of Contents

  1. Overview
  2. Highlights
  3. Installation
  4. Configuration
  5. Quick Start
  6. Usage Examples
  7. Architecture
  8. Implemented API Modules
  9. Error Handling & Logging
  10. Development Workflow
  11. Testing Strategy
  12. Contributing
  13. Support & Resources
  14. License

Overview

zoho-projects-sdk wraps the Zoho Projects API with an async-first interface that manages authentication, retries, and data validation for you. The SDK is built on top of httpx, tenacity, and Pydantic V2, giving you a strongly typed client that integrates naturally into modern Python applications.

Highlights

  • Async by default: Every API call is asynchronous to keep your applications responsive under heavy I/O loads.
  • OAuth2 made simple: Automatic access-token refresh handled via ZohoOAuth2Handler with environment-driven configuration.
  • Strong typing everywhere: Responses map to Pydantic models so you get IDE autocomplete and runtime validation for free.
  • Resilient networking: Built-in retries with exponential backoff for transient HTTP errors thanks to tenacity integration.
  • Extensible surface: Resource-specific service classes (projects, tasks, timelogs, etc.) keep the codebase modular and easy to extend.

Installation

Requires Python 3.9+.

pip install zoho-projects-sdk

Or with uv:

uv pip install zoho-projects-sdk

Configuration

The SDK reads credentials from environment variables (directly or via .env).

# .env
ZOHO_PROJECTS_CLIENT_ID="your_client_id"
ZOHO_PROJECTS_CLIENT_SECRET="your_client_secret"
ZOHO_PROJECTS_REFRESH_TOKEN="your_refresh_token"
ZOHO_PROJECTS_PORTAL_ID="your_portal_id"

You can also pass credentials explicitly when instantiating ZohoProjects:

from zoho_projects_sdk.client import ZohoProjects

client = ZohoProjects(
    client_id="...",
    client_secret="...",
    refresh_token="...",
    portal_id="...",
)

Quick Start

import asyncio
from zoho_projects_sdk.client import ZohoProjects


async def main() -> None:
    async with ZohoProjects() as client:
        projects = await client.projects.get_all()
        for project in projects:
            print(project.name)


if __name__ == "__main__":
    asyncio.run(main())

The async context manager ensures the underlying HTTP connection pool is closed cleanly when you are done.

Usage Examples

Fetch a single project

project = await client.projects.get(project_id=123456789)
print(project.id, project.status)

Create a project

from zoho_projects_sdk.models.project_models import Project

new_project = Project(
    name="SDK Launch",
    description="Ship the SDK to production",
)

created = await client.projects.create(new_project)
print(created.id)

Update existing data

updated = await client.projects.update(project_id=created.id, project_data=new_project)
print(updated.updated_time)

Timelog queries with filters

entries = await client.timelogs.get_by_user(user_id=987654321, from_date="2024-01-01", to_date="2024-01-31")
total_hours = sum(entry.hours for entry in entries)
print(total_hours)

Explore the timelogs, tasks, issues, and other service modules for more endpoint-specific helpers. They follow the same async pattern documented above.

Ready-to-run scripts

Architecture

graph TD
    subgraph User Application
        A[Your App]
    end

    subgraph zoho-projects-sdk
        B[ApiClient]
        C[API Modules]
        D[Pydantic Models]
        E[ZohoOAuth2Handler]
        F[Custom Exceptions]
        G[Configuration]
    end

    subgraph External
        H[Zoho Projects API]
        I[.env file]
    end

    A --> B
    B -- Uses --> E
    B -- Makes Calls To --> C
    C -- Interacts with --> H
    C -- Parses to/from --> D
    B -- Raises --> F
    E -- Raises --> F
    G -- Reads from --> I
    E -- Uses Config from --> G

Key components:

  • ZohoProjects client: User-facing façade exposing resource-specific services.
  • ApiClient: Internal HTTP wrapper providing retry logic, default headers, and auth injection.
  • ZohoOAuth2Handler: Refreshes tokens and handles credential loading.
  • models/: Pydantic schemas for the Zoho Projects domain.
  • api/: One module per resource grouping, each delegating network concerns to ApiClient.
  • exceptions.py: Rich error metadata for diagnosing failures.
  • utils/logger.py: Centralized logging setup for consistent formatting.@src/zoho_projects_sdk/utils/logger.py#1-36

Implemented API Modules

The following resource modules are currently available (more coming soon):

  • Attachments
  • Baselines
  • Business Hours
  • Clients
  • Comments
  • Contacts
  • Events
  • Issues
  • Milestones
  • Phases
  • Portals
  • Projects
  • Roles
  • Tags
  • Tasklists
  • Tasks
  • Timelogs
  • Users

See src/zoho_projects_sdk/api for endpoint-level details.

Error Handling & Logging

  • API failures raise APIError with status details and payload context.
  • Network-level problems (timeouts, connectivity, rate limits) are retried automatically up to three times with exponential backoff before surfacing.
  • Configure logging via zoho_projects_sdk.utils.get_logger to feed SDK logs into your existing observability pipeline.

Development Workflow

  1. Clone the repository:

    git clone https://github.com/carlospaiva/zoho-projects-sdk.git
    cd zoho-projects-sdk
    
  2. Install dependencies (production + development):

    uv pip install -e .[dev]
    
  3. Keep code formatted and linted:

    uv run format
    uv run lint
    uv run type-check
    
  4. Run the aggregated quality gate:

    uv run check
    

Testing Strategy

We target 100% line and branch coverage across unit, integration, and end-to-end suites.

  • Run everything:

    uv run test
    
  • Unit tests only:

    uv run pytest tests/unit
    
  • Integration tests (requires live credentials):

    uv run pytest tests/integration
    

Integration suites expect a populated .env so they can hit the live Zoho Projects API responsibly.

Contributing

We welcome issues and pull requests. Please:

  1. Follow the Conventional Commits specification for commit messages.
  2. Ensure uv run check and uv run test both pass before opening a PR.
  3. Include tests and documentation updates covering your changes.
  4. Provide clear reproduction steps when reporting bugs.

Support & Resources

For security-sensitive disclosures, please use responsible reporting practices rather than filing a public issue.

License

Distributed under the MIT License. See LICENSE 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

zoho_projects_sdk-0.1.4.tar.gz (158.7 kB view details)

Uploaded Source

Built Distribution

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

zoho_projects_sdk-0.1.4-py3-none-any.whl (50.4 kB view details)

Uploaded Python 3

File details

Details for the file zoho_projects_sdk-0.1.4.tar.gz.

File metadata

  • Download URL: zoho_projects_sdk-0.1.4.tar.gz
  • Upload date:
  • Size: 158.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for zoho_projects_sdk-0.1.4.tar.gz
Algorithm Hash digest
SHA256 7353c2ffba867d313f5558c84ae4728732016d002e6797488096d62dcff1715e
MD5 32e884134fa7b47a84702a7573ff087e
BLAKE2b-256 1f9c83229f24c7110471f1477dc01c90b00f033bd762685f797c6db3dde212e3

See more details on using hashes here.

File details

Details for the file zoho_projects_sdk-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for zoho_projects_sdk-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fd1e4967027b67b0eb6791a3555f2f699eeafccbd59e605d186b59cb6f4e6268
MD5 0d80baf3127d57385719c9b042427cc3
BLAKE2b-256 ee6f174afa16b0f8ba474f688e819dcdca7b09a439d8fb66acbe9f8a3499e66f

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