semvec/pypi-packages huggingface dataset:
amqmonitoring 0.2.1
RabbitMQ exchange monitoring tool with CLI and GUI interfaces
Requires Python: >=3.11

# Advanced Message Queuing Monitoring

A ver simple and silly tool to monitor queues messages received by our fantastic AMQP.

The tool is designed to work reading the **traces** queue, to enable those traces
I recommend following [this guide](https://github.com/MarcialRosales/rabbitmq-tracing-guide).

Once you have a queue to receive the messages you want to track, then you can run `amqmonitoring` command to
start monitoring.

## Configurations

A brief summary how to configure this tool to connect to your AMQP.

### Environment variables

Good method to configure the tool as a daemon process or run by some background process. 

| key               | Description                                     | Default   |
|-------------------|-------------------------------------------------|-----------|
| RABBITMQ_HOST     | RabbitMQ **server host** to be connected.       | localhost |
| RABBITMQ_PORT     | RabbitMQ **server port** to be connected.       | 5672      |
| RABBITMQ_USER     | RabbitMQ **client user** to be logged with.     | guest     |
| RABBITMQ_PASSWORD | RabbitMQ **client password** to be logged with. | guest     |

And you can run it as `RABBITMQ_USER=MyUser amqmonitoring` for example,
try to avoid saving password on your terminal history.

### Commandline arguments

A rapid method to configure is via arguments. Easiest way to start with this is running
the help command.

```bash
$ amqmonitoring amqmonitoring --help

usage: amqmonitoring [-h] [-f INSTRUCTIONS_PATH] [-s STORE] [-q QUEUE]

Monitor AMQP traces

options:
  -h, --help            show this help message and exit
  -f INSTRUCTIONS_PATH, --find-by-dict INSTRUCTIONS_PATH
                        Path to the json instructions
  -s STORE, --store STORE
                        Path where the JSON messages outputs will be stored
  -q QUEUE, --queue QUEUE
                        Name of the queue to listen
```

And you can run it as `amqmonitoring -f examples/instructions_file.json` for example,
try to avoid saving password on your terminal history.

## Development

Use UV to prepare your environment using `uv sync`. This will make the venv folder with the python and required
dependencies to start the development.

### Run local AMQP

I have prepared a `docker-compose.yml` ready to run a server for development purposes. Run `docker compose up -d`
and it will be listening on port 5672 on your machine with the default settings as this tool has.

### Mock messages

To help developing this cool you can run `.venv/bin/python examples/message_sender.py` to mock them.

### Enable AMQP traces

Run this `docker compose exec rabbitmq rabbitmqctl trace_on` and it will be activated,
then go to http://localhost:15672/ and setup the traces to the right queue.

### Build

First make sure you are increasing the version number in the `pyproject.toml`. Then use `uv build` and you will
see a folder named `dist` with the package inside.

### Publish

Also using `uv publish` with your own credentials, using token is highly recommended.
kv-cache 0.3.3
A fast key-value store using SQLite for CLI tools
Requires Python: >=3.7
Keywords: cache, cli, key-value, sqlite

# KV_Cache

A fast key-value store using SQLite as a backend, designed specifically for CLI tools needing persistent cache storage.

## Features

- 🚀 Fast SQLite-based storage
- ⏰ Built-in TTL support
- 🔒 Thread-safe operations
- 🧹 Automatic cleanup of expired entries

## Installation

```bash
pip install kv-cache
```

## Quick Start

```python
from kv_cache import KVStore

# Initialize the store
store = KVStore("cache.db")

# Store a value with 1-hour TTL
store.set("my_key", {"data": "value"}, ttl=3600)

# Retrieve the value
value = store.get("my_key")
print(value)  # {'data': 'value'}

# Delete when done
store.delete("my_key")
```

## Usage with CLI Autocomplete

Perfect for caching slow remote calls in CLI tools:

```python
import time
from kv_cache import KVStore, scache

# directly use the store
def get_autocomplete_suggestions(prefix: str) -> list:
    store = KVStore("~/.mycli/store.db")
    
    # Try cache first
    store_key = f"auto:{prefix}"
    results = store.get(store_key)
    
    if results is None:
        # Cache miss - fetch from remote
        results = fetch_from_remote_server(prefix)  # Slow remote call
        store.set(store_key, results, ttl=3600)  # Cache for 1 hour
    
    return results

# or use the `scache` decorator to easily cache the function result
@scache(ttl=3600, KVStore("~/.mycli/store.db"))
def long_function_call(arg1, arg2, arg3=None):
    time.sleep(1)

long_function_call(1, 2, arg3='test') # will take 1 seconds
long_function_call(1, 2, arg3='test') # instant

```

## API Reference

### KVStore

```python
class KVStore:
    def __init__(self, db_path: str, table_name: str = "key_value_store"):
        """Initialize the store with database path and optional table name."""
        
    def set(self, key: str, value: Any, ttl: Optional[int] = None):
        """Set a value with optional TTL in seconds."""
        
    def get(self, key: str, default: Any = None) -> Any:
        """Get a value or return default if not found."""
        
    def delete(self, key: str):
        """Delete a key from the store."""
        
    def clear(self):
        """Clear all entries from the store."""
        
    def close(self):
        """Close the database connection."""

    def __enter__(self):
    def __exit__(self):
        """ Context manager to use with `with` """
```

## Development

### Setup

```bash
# Clone the repository
git clone https://github.com/lcances/kv_cache.git
cd fast-kv

# Create virtual environment
python -m venv venv
source venv/bin/activate  # or `venv\Scripts\activate` on Windows

# Install development dependencies
pip install -e ".[dev]"
```

### Running Tests

```bash
pytest tests/
```

### Code Style

The project uses `black` for code formatting and `isort` for import sorting:

```bash
# Format code
black src/ tests/

# Sort imports
isort src/ tests/
```

## License

MIT License - see LICENSE file for details.