Skip to main content

Utility library for python

Project description

Tracktolib

Python versions Latest PyPI version CircleCI

Utility library for python

Installation

You can choose to not install all the dependencies by specifying the extra parameter such as:

poetry add tracktolib@latest -E pg-sync -E tests --group dev 

Here we only install the utilities using psycopg (pg-sync) and deepdiff (tests) for the dev environment.

Utilities

  • log

Utility functions for logging.

import logging
from tracktolib.logs import init_logging

logger = logging.getLogger()
formatter, stream_handler = init_logging(logger, 'json', version='0.0.1')
  • pg

Utility functions for asyncpg

  • pg-sync

Utility functions based on psycopg such as fetch_one, insert_many, fetch_count ...

To use the functions, create a Connection using psycopg: conn = psycopg2.connect()

fetch_one

from tracktolib.pg.pg_sync import (
    insert_many, fetch_one, fetch_count, fetch_all
)

data = [
    {'foo': 'bar', 'value': 1},
    {'foo': 'baz', 'value': 2}
]
insert_many(conn, 'public.test', data)  # Will insert the 2 dict
query = 'SELECT foo from public.test order by value asc'
value = fetch_one(conn, query, required=True)  # Will return {'foo': 'bar'}, raise an error is not found
assert fetch_count(conn, 'public.test') == 2
query = 'SELECT * from public.test order by value asc'
assert fetch_all(conn, query) == data
  • tests

Utility functions for testing

  • s3-minio

Utility functions for minio

  • s3

Utility functions for aiobotocore

  • logs

Utility functions to initialize the logging formatting and streams

  • http

Utility functions using httpx

  • api

Utility functions using fastapi

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tracktolib-0.49.1.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

tracktolib-0.49.1-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file tracktolib-0.49.1.tar.gz.

File metadata

  • Download URL: tracktolib-0.49.1.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.7 Linux/5.15.0-1057-aws

File hashes

Hashes for tracktolib-0.49.1.tar.gz
Algorithm Hash digest
SHA256 49191c52e9135876b1b3b167e0806dc25db365bf525cf149e1e06108177db763
MD5 77aa3dfba74296f72646d817b2dc8c6e
BLAKE2b-256 32716584527d8773bc2ad6a49fd80830b3f317e6dd2865a7c4d0ab6cc8abe6e8

See more details on using hashes here.

File details

Details for the file tracktolib-0.49.1-py3-none-any.whl.

File metadata

  • Download URL: tracktolib-0.49.1-py3-none-any.whl
  • Upload date:
  • Size: 22.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.7 Linux/5.15.0-1057-aws

File hashes

Hashes for tracktolib-0.49.1-py3-none-any.whl
Algorithm Hash digest
SHA256 be879c8ef1269507ccad448c3c9356b262cf80b0a815635e70e957a865c65ef7
MD5 1eda01f264c8087f55643931105364cb
BLAKE2b-256 94d04af46825e55192b335e2f3017244a80f954a533e5110b76e734d37055d96

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page