Skip to main content

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.

Metadata

Release files for brownllama 0.1.50

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for brownllama 0.1.50
File Size Uploaded
brownllama-0.1.50.tar.gz 76.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for brownllama 0.1.50
File Interpreter ABI Platform
brownllama-0.1.50-py3-none-any.whl Python 3 none any Details

Total release size: 97.6 kB

Release files / brownllama-0.1.50.tar.gz

Download URL brownllama-0.1.50.tar.gz
Size 76.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a9cc7323bbc349431631afb57815a15fc7b1a0c8624fdb3fa0357fcc27390e0a
BLAKE2b-256 checksum
How to use checksums
5a385e8c9e98bf4d370b758d210a2b45f8d8b1a343200072206bae8520e3b8bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Release files / brownllama-0.1.50-py3-none-any.whl

Download URL brownllama-0.1.50-py3-none-any.whl
Size 20.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3efb2c0bd2c6d231de4bc59f1c3ebc2ebc309140711e1d20aeab5682aa1c7496
BLAKE2b-256 checksum
How to use checksums
75a5dbb589f82527fe8bae61ab0ef0081b86fdc7cb00786ebf5a7c970b2e5e09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.1.50 This release

2 release files

0.1.49

2 release files

0.1.48

2 release files

0.1.47

2 release files

0.1.41

2 release files

0.1.40

2 release files

0.1.39

2 release files

0.1.38

2 release files

0.1.37

2 release files

0.1.36

2 release files

0.1.35

2 release files

0.1.34

2 release files

0.1.33

2 release files

0.1.32

2 release files

0.1.31

2 release files

0.1.29

2 release files

0.1.28

2 release files

0.1.27

2 release files

0.1.26

2 release files

0.1.19

2 release files

0.1.18

2 release files

0.1.17

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page