brownllama 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,40 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+ .ruff_cache
9
+ .venv
10
+
11
+ # Aider
12
+ .aider*
13
+
14
+ # Keys and Secrets
15
+ *.pem
16
+ *.key
17
+ *.crt
18
+ development_gcp_service_account_key.json
19
+ id_rsa
20
+ id_rsa.pub
21
+ terraform_service_account_key.json
22
+ *service_account*
23
+ *credential*
24
+ .env
25
+
26
+ # Local Deployment Scripts
27
+ *run-podman.sh
28
+ *run-terraform.sh
29
+
30
+ # Test Scripts and logs
31
+ test-scripts
32
+ logs/
33
+
34
+ # Terraform
35
+ .terraform
36
+ .terraform.lock.hcl
37
+ terraform.tfstate
38
+
39
+ # Extras
40
+ .DS_Store
@@ -0,0 +1,43 @@
1
+ ---
2
+ repos:
3
+ - repo: https://github.com/pre-commit/pre-commit-hooks
4
+ rev: v5.0.0
5
+ hooks:
6
+ - id: check-yaml
7
+ - id: end-of-file-fixer
8
+ - id: trailing-whitespace
9
+ - id: requirements-txt-fixer
10
+ - id: detect-private-key
11
+ - id: check-added-large-files
12
+ - id: check-json
13
+ - id: check-toml
14
+ - id: check-shebang-scripts-are-executable
15
+
16
+ - repo: https://github.com/astral-sh/ruff-pre-commit
17
+ rev: v0.11.11
18
+ hooks:
19
+ - id: ruff
20
+ args: [--fix, --show-fixes]
21
+ - id: ruff-format
22
+
23
+ - repo: https://github.com/astral-sh/uv-pre-commit
24
+ rev: 0.7.8
25
+ hooks:
26
+ - id: uv-lock
27
+
28
+ - repo: https://github.com/terrencepreilly/darglint
29
+ rev: v1.8.1
30
+ hooks:
31
+ - id: darglint
32
+
33
+ - repo: https://github.com/antonbabenko/pre-commit-terraform
34
+ rev: v1.99.0
35
+ hooks:
36
+ - id: terraform_fmt
37
+ - id: terraform_validate
38
+ - id: terraform_docs
39
+
40
+ - repo: https://github.com/detailyang/pre-commit-shell
41
+ rev: 1.0.5
42
+ hooks:
43
+ - id: shell-lint
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 brownLlama
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,90 @@
1
+ Metadata-Version: 2.4
2
+ Name: brownllama
3
+ Version: 0.1.0
4
+ Summary: Standard PIP Package for GCP integration apps.
5
+ Author-email: Sanu Maharjan <inbox.sanu@gmail.com>
6
+ License-File: LICENSE
7
+ Classifier: Programming Language :: Python :: 3 :: Only
8
+ Classifier: Programming Language :: Python :: 3.12
9
+ Classifier: Programming Language :: Python :: 3.13
10
+ Requires-Python: >=3.12
11
+ Requires-Dist: google-cloud-bigquery>=3.34
12
+ Requires-Dist: google-cloud-secret-manager>=2.23.3
13
+ Requires-Dist: google-cloud-storage>=3.1
14
+ Requires-Dist: pandas>=2.2.3
15
+ Requires-Dist: pydantic>=2.11.5
16
+ Description-Content-Type: text/markdown
17
+
18
+ # brownLlama Pip Package
19
+
20
+ ## Overview
21
+
22
+ `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.
23
+
24
+ ## Modules
25
+
26
+ The package currently includes the following modules:
27
+
28
+ - **bigquery.py**:
29
+
30
+ - Provides the `BigQueryController` class for simplified interaction with Google BigQuery.
31
+ - Supports creating tables, checking table existence, loading data from JSON, loading data from Google Cloud Storage (GCS), and executing queries.
32
+ - Offers methods for schema inference from JSON data and efficient data loading via GCS staging.
33
+
34
+ - **logger.py**:
35
+
36
+ - Provides the `get_logger` function for obtaining configured logger instances.
37
+ - Standardizes logging format and setup across projects.
38
+ - Configures both root logger and common third-party library loggers to ensure consistent logging behavior.
39
+
40
+ - **secret_manager.py**
41
+
42
+ - Provides the `get_secret` function for retrieving secrets from Google Secret Manager.
43
+ - Enables to get, create, delete and lists the secrets.
44
+
45
+ - **storage.py**:
46
+ - Provides the `StorageManager` class for managing Google Cloud Storage operations.
47
+ - Supports uploading data (dictionaries, lists of dictionaries, Pandas DataFrames) to GCS as JSON files.
48
+ - Includes functionality for deleting files from GCS.
49
+
50
+ ## Building and Publishing
51
+
52
+ To build and publish the package, follow these steps:
53
+
54
+ 1. Install build dependencies:
55
+
56
+ ```bash
57
+ uv add build twine
58
+ ```
59
+
60
+ 2. Build the package:
61
+
62
+ ```bash
63
+ uv build
64
+ ```
65
+
66
+ 3. Publish the package in PyPI
67
+
68
+ ```bash
69
+ uv run twine upload --verbose dist/*
70
+ ```
71
+
72
+ NOTE: PyPI is public and should not be used for sensitive information. Also, you need to setup `~/.pypirc` with your PyPI credentials.
73
+
74
+ ## Usage
75
+
76
+ After installation, you can import and use the modules and classes provided by `brownllama` in your Python projects.
77
+
78
+ **Example (using BigQueryController):**
79
+
80
+ ```python
81
+ from brownllama.bigquery import BigQueryController
82
+
83
+ bq_controller = BigQueryController(bigquery_payload=bigquery_payload, key_path=key_path)
84
+
85
+ # Example: Export JSON data to BigQuery via GCS
86
+ gcs_uri = bq_controller.export_to_bq_via_gcs(json_data=data)
87
+ print(f"Data loaded to BigQuery via GCS: {gcs_uri}")
88
+ ```
89
+
90
+ Refer to the individual module files (`bigquery.py`, `logger.py`, `storage.py`) for detailed class and function documentation and usage examples.
@@ -0,0 +1,73 @@
1
+ # brownLlama Pip Package
2
+
3
+ ## Overview
4
+
5
+ `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.
6
+
7
+ ## Modules
8
+
9
+ The package currently includes the following modules:
10
+
11
+ - **bigquery.py**:
12
+
13
+ - Provides the `BigQueryController` class for simplified interaction with Google BigQuery.
14
+ - Supports creating tables, checking table existence, loading data from JSON, loading data from Google Cloud Storage (GCS), and executing queries.
15
+ - Offers methods for schema inference from JSON data and efficient data loading via GCS staging.
16
+
17
+ - **logger.py**:
18
+
19
+ - Provides the `get_logger` function for obtaining configured logger instances.
20
+ - Standardizes logging format and setup across projects.
21
+ - Configures both root logger and common third-party library loggers to ensure consistent logging behavior.
22
+
23
+ - **secret_manager.py**
24
+
25
+ - Provides the `get_secret` function for retrieving secrets from Google Secret Manager.
26
+ - Enables to get, create, delete and lists the secrets.
27
+
28
+ - **storage.py**:
29
+ - Provides the `StorageManager` class for managing Google Cloud Storage operations.
30
+ - Supports uploading data (dictionaries, lists of dictionaries, Pandas DataFrames) to GCS as JSON files.
31
+ - Includes functionality for deleting files from GCS.
32
+
33
+ ## Building and Publishing
34
+
35
+ To build and publish the package, follow these steps:
36
+
37
+ 1. Install build dependencies:
38
+
39
+ ```bash
40
+ uv add build twine
41
+ ```
42
+
43
+ 2. Build the package:
44
+
45
+ ```bash
46
+ uv build
47
+ ```
48
+
49
+ 3. Publish the package in PyPI
50
+
51
+ ```bash
52
+ uv run twine upload --verbose dist/*
53
+ ```
54
+
55
+ NOTE: PyPI is public and should not be used for sensitive information. Also, you need to setup `~/.pypirc` with your PyPI credentials.
56
+
57
+ ## Usage
58
+
59
+ After installation, you can import and use the modules and classes provided by `brownllama` in your Python projects.
60
+
61
+ **Example (using BigQueryController):**
62
+
63
+ ```python
64
+ from brownllama.bigquery import BigQueryController
65
+
66
+ bq_controller = BigQueryController(bigquery_payload=bigquery_payload, key_path=key_path)
67
+
68
+ # Example: Export JSON data to BigQuery via GCS
69
+ gcs_uri = bq_controller.export_to_bq_via_gcs(json_data=data)
70
+ print(f"Data loaded to BigQuery via GCS: {gcs_uri}")
71
+ ```
72
+
73
+ Refer to the individual module files (`bigquery.py`, `logger.py`, `storage.py`) for detailed class and function documentation and usage examples.
@@ -0,0 +1,2 @@
1
+ # This file makes the directory a Python package
2
+ # It can be left empty or can include imports to expose specific modules