Skip to main content

Cledar Python SDK

Project description

Cledar Python SDK

Project Description

Cledar Python SDK is a git submodule that contains shared services (S3, kafka service, dlq service, monitoring service) redy for use across projects. It is used by multiple workers to ensure consistency and compatibility between different components.

Installation and Setup

  1. Clone the Repository

    git clone git@github.com:Cledar/cledar-python-sdk.git
    
  2. Install Dependencies

    uv sync
    
  3. How to use this repo in your project To use this repo in your project, you can add it as a submodule like this:

    git submodule add <submodule_url> [optional_path]
    

    Then you can import the services in your project like this:

    from common_services.kafka_service.kafka_producer import KafkaProducer
    

    etc.

Testing

Unit tests are implemented using pytest and unittest.

  1. Run tests:

    uv run pytest
    
  2. Adding tests: Place your tests in the *_service/tests folder or as files with the _test.py suffix in */tests folder.

Code Quality

  • pydantic - settings management
  • ruff, mypy - Linting, formatting, and static type checking
  • pre-commit - Pre-commit file checks

Linting

If you want to run linting or type checker manually, you can use the following commands. Pre-commit will run these checks automatically before each commit.

uv run ruff format .
uv run ruff check .
uv run mypy .

Pre-commit setup

To get started follow these steps:

  1. Install pre-commit by running the following command:

    pip install pre-commit
    
  2. Once pre-commit is installed, set up the pre-commit hooks by running:

    pre-commit install
    
  3. Pre-commit hooks will analyze only commited files. To analyze all files after installation run the following:

    pre-commit run --all-files
    

Automatic Fixing Before Commits:

pre-commit will run Ruff (format + lint) and mypy during the commit process:

git commit -m "Describe your changes"

To skip pre-commit hooks for a single commit, use the --no-verify flag:

```bash
git commit -m "Your commit message" --no-verify
```

Technologies and Libraries

Main Dependencies:

  • python = "3.12.7"
  • pydantic-settings = "2.3.3"
  • confluent-kafka = "2.4.0"
  • fastapi = "^0.112.3"
  • prometheus-client = "^0.20.0"
  • uvicorn = "^0.30.6"

Developer Tools:

  • uv - Dependency and environment management
  • pydantic - settings management
  • ruff - Linting and formatting
  • mypy - Static type checker
  • pytest, unittest - Unit tests
  • pre-commit - Code quality hooks

Commit conventions

We use Conventional Commits for our commit messages. This helps us to create a better, more readable changelog.

Example of a commit message:

refactor(XXX-NNN): spaghetti code is now a carbonara

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

cledar_sdk-1.0.1.tar.gz (41.5 kB view details)

Uploaded Source

Built Distribution

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

cledar_sdk-1.0.1-py3-none-any.whl (58.6 kB view details)

Uploaded Python 3

File details

Details for the file cledar_sdk-1.0.1.tar.gz.

File metadata

  • Download URL: cledar_sdk-1.0.1.tar.gz
  • Upload date:
  • Size: 41.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.7

File hashes

Hashes for cledar_sdk-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e31955aac9c1b78e6e25231ce906524b4f11385bc2f6f6c7aac91efd058dce14
MD5 fc8d580c2c5b0f04cc4866e321d31597
BLAKE2b-256 daf2f792db511abbfb08bd9b672054ebedd54c99f4dcdc89803d7669794d79e9

See more details on using hashes here.

File details

Details for the file cledar_sdk-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: cledar_sdk-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 58.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.7

File hashes

Hashes for cledar_sdk-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 617a64dcbeb30aef15c5f7ccf5133b94cf859be18960567e80e9740cb935f9fb
MD5 61d2872480e78e467477bf0c85768d94
BLAKE2b-256 fb5ebe68e865c640cab157b8d180fa7bee21da544965b4cdf3b54a75805e49cf

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