Metadata-Version: 2.4
Name: cart-snowflake-secrets
Version: 0.1.1
Summary: Fetch Snowflake credentials from Google Cloud Secret Manager.
Author-email: Victor Olade <victor.olade@cart.com>
License: Copyright (c) 2026 Cart.com. All rights reserved.
        
        This software and its source code are proprietary and confidential.
        
        Unauthorized copying, modification, distribution, or use of this software,
        via any medium, is strictly prohibited without the express prior written
        permission of Cart.com.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: credentials,gcp,pat,secret-manager,snowflake
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Requires-Dist: google-auth>=2.0.0
Requires-Dist: google-cloud-secret-manager>=2.0.0
Provides-Extra: dev
Requires-Dist: build; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: twine; extra == 'dev'
Description-Content-Type: text/markdown

# cart-snowflake-secrets

Fetch Snowflake credentials (PATs) stored as JSON in
[Google Cloud Secret Manager](https://cloud.google.com/secret-manager).

> **Proprietary** — Copyright (c) 2026 Cart.com. All rights reserved.

## Installation

```bash
pip install cart-snowflake-secrets
```

## Usage

```python
from cart_snowflake_secrets import SnowflakeSecretManager

# sa_key accepts any of: a JSON string, a path to a key file, or a dict.
manager = SnowflakeSecretManager(
    sa_key="/path/to/service-account.json",  # or a JSON string, or a dict
    project_id="your-gcp-project-id",         # required
    secret_id="snowflake-secrets",            # optional, this is the default
)

pat = manager.get_pat(env="gcp", username="some_user")
```

The secret payload is expected to be a JSON object shaped like:

```json
{
  "gcp": {
    "some_user": { "PAT": "..." }
  },
  "aws": {
    "another_user": { "PAT": "..." }
  }
}
```

`get_pat` raises `KeyError` if no PAT exists for the given environment/username.

## Development

```bash
pip install -e ".[dev]"   # install with dev tooling
pytest                    # run tests
python -m build           # build wheel + sdist into dist/
```

## Publishing

```bash
python -m build
twine upload dist/*
```
