Skip to main content

Standard PIP Package for GCP integration apps.

Project description

brownLlama Pip Package

Overview

brownllama-pip (or brownllama when imported in Python) is a utility library designed to provide common functionalities and standardized components for VNP's Python projects. It aims to reduce code duplication and promote best practices across different projects.

Modules

The package currently includes the following modules:

  • bigquery.py:

    • Provides the BigQueryController class for simplified interaction with Google BigQuery.
    • Supports creating tables, checking table existence, loading data from JSON, loading data from Google Cloud Storage (GCS), and executing queries.
    • Offers methods for schema inference from JSON data and efficient data loading via GCS staging.
  • logger.py:

    • Provides the get_logger function for obtaining configured logger instances.
    • Standardizes logging format and setup across projects.
    • Configures both root logger and common third-party library loggers to ensure consistent logging behavior.
  • secret_manager.py

    • Provides the get_secret function for retrieving secrets from Google Secret Manager.
    • Enables to get, create, delete and lists the secrets.
  • storage.py:

    • Provides the StorageManager class for managing Google Cloud Storage operations.
    • Supports uploading data (dictionaries, lists of dictionaries, Pandas DataFrames) to GCS as JSON files.
    • Includes functionality for deleting files from GCS.

Building and Publishing

To build and publish the package, follow these steps:

  1. Install build dependencies:

    uv add build twine
    
  2. Change the version number in pyproject.toml file

    version = "0.1.XXX"
    
  3. Build the package:

    uv build
    
  4. Publish the package in PyPI

    uvx twine upload --verbose dist/*
    

    NOTE: PyPI is public and should not be used for sensitive information. Also, you need to setup ~/.pypirc with your PyPI credentials.

Versioning Error:

If there is some error on versioning, then you simply delete dist directory and run uv build again.

Usage

After installation, you can import and use the modules and classes provided by brownllama in your Python projects.

Example (using BigQueryController):

from brownllama.bigquery import BigQueryController


bq_controller = BigQueryController(bigquery_payload=bigquery_payload, key_path=key_path)

# Example: Export JSON data to BigQuery via GCS
gcs_uri = bq_controller.export_to_bq_via_gcs(json_data=data)
print(f"Data loaded to BigQuery via GCS: {gcs_uri}")

Refer to the individual module files (bigquery.py, logger.py, storage.py) for detailed class and function documentation and usage examples.

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

brownllama-0.1.36.tar.gz (60.2 kB view details)

Uploaded Source

Built Distribution

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

brownllama-0.1.36-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file brownllama-0.1.36.tar.gz.

File metadata

  • Download URL: brownllama-0.1.36.tar.gz
  • Upload date:
  • Size: 60.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for brownllama-0.1.36.tar.gz
Algorithm Hash digest
SHA256 a7bab9c2de02f6a2153dcdde56b834ae4e87b02d784a27322be1e8c1424d3706
MD5 ecb3f65656edd1a4d97c6a40926c5dea
BLAKE2b-256 9780b8361ba8dec390e79b768ae484e167c46b4ed67965cf22fd4af711dbe34f

See more details on using hashes here.

File details

Details for the file brownllama-0.1.36-py3-none-any.whl.

File metadata

  • Download URL: brownllama-0.1.36-py3-none-any.whl
  • Upload date:
  • Size: 19.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for brownllama-0.1.36-py3-none-any.whl
Algorithm Hash digest
SHA256 95938a00569860a05625df61b05f6e5b3f19b7db34d06c14b90c79a0392104a2
MD5 3ee59f91b6ff0a2876c5b247c61e016c
BLAKE2b-256 ba42e1d1dbb9cd00227de065aff1f8472e6517e362fc5cd16c4c1ff87e1138d7

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