Metadata-Version: 2.4
Name: cozycosmos
Version: 0.1.1
Summary: A small convenience wrapper for Azure Cosmos DB CRUD operations.
Author: rhcproc
License-Expression: MIT
Project-URL: Homepage, https://github.com/rhcproc/cozycosmos
Project-URL: Repository, https://github.com/rhcproc/cozycosmos
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: azure-cosmos>=4.7.0
Dynamic: license-file

# cozycosmos

A small convenience wrapper for Azure Cosmos DB CRUD operations.

## Installation

```bash
pip install cozycosmos
```

For local development from this repository:

```bash
python -m pip install -e .
```

## Usage

Set your Cosmos DB credentials:

```bash
export COSMOS_URL="https://your-account.documents.azure.com:443/"
export COSMOS_KEY="your-cosmos-key"
```

Use the package:

```python
from cozycosmos import CosmosStore

store = CosmosStore(
    database_name="prototype-db",
    container_name="documents",
    partition_key_path="/partitionKey",
)

item = store.write(
    {
        "id": "1",
        "partitionKey": "default",
        "name": "name1",
        "city": "Christchurch",
    }
)

print(item)
```

## Command Line

After installing the package, use the `cozycosmos` command:

```bash
ezcosmos \
  --database prototype-db \
  --container documents \
  read 1
```

You can also pass credentials directly instead of using `COSMOS_URL` and
`COSMOS_KEY`:

```bash
ezcosmos \
  --url "https://your-account.documents.azure.com:443/" \
  --key "your-cosmos-key" \
  --database prototype-db \
  --container documents \
  write '{"id": "1", "partitionKey": "default", "name": "name1"}'
```

You can also run the sample in `examples/basic_usage.py`:

```bash
python examples/basic_usage.py
```

## Build

Install build tooling:

```bash
python -m pip install build twine
```

Build the package:

```bash
python -m build
```

Check the package metadata:

```bash
python -m twine check dist/*
```

Upload to TestPyPI:

```bash
python -m twine upload --repository testpypi dist/*
```

Upload to PyPI:

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