semvec/pypi-packages huggingface dataset:
omie-market-data 0.1.0
Python library to fetch electricity market data from OMIE
License: MIT
Requires Python: >=3.7
Keywords: omie, electricity, market, spain, iberian, energy

# omie-data

Python library to fetch electricity market data from OMIE (Operador del Mercado Ibérico de Energía).

## Installation

```bash
pip install omie-market-data
```

Or install from source:

```bash
git clone https://github.com/yourusername/omie-data.git
cd omie-data
pip install -e .
```

## Usage

```python
from datetime import datetime
from omie_data import get_omie_data, get_omie_url

# Fetch data for a specific date
date = datetime(2025, 10, 1)
df = get_omie_data(date)

if df is not None:
    print(df.head())
    # Columns: start_period, end_period, plus one column per metric (prices, power, etc.)
else:
    print("Data not available for this date")

# Get the URL used for a date (useful for debugging)
url = get_omie_url(date)
print(url)
```

## Data format

The returned DataFrame is **period-based** (one row per 15-minute interval):

| Column         | Description |
|----------------|-------------|
| `start_period` | Start of the 15-min interval (datetime) |
| `end_period`   | End of the 15-min interval (datetime)   |
| *metric columns* | One column per metric (e.g. marginal price Spanish/Portuguese, total power buy/sell, etc.) |

- **96 rows per day** (24 hours × 4 quarters).  
- Intervals follow OMIE quarters: H1Q1 = 00:00–00:15, H1Q2 = 00:15–00:30, …, H24Q4 = 23:45–24:00.

## API

- **`get_omie_data(date: datetime) -> Optional[pd.DataFrame]`**  
  Fetches data for the given date. Returns `None` if the file is not available (e.g. 404).

- **`get_omie_url(date: datetime) -> str`**  
  Returns the OMIE URL used for that date (for debugging or manual download).

## Examples

See `test_omie_data.ipynb` for a full Jupyter notebook with:

- Fetching and exploring the period-based DataFrame  
- Plotting prices and other metrics  
- Converting to hourly averages  
- Exporting to CSV/Excel  

## Requirements

- Python 3.7+
- pandas

## For maintainers: publishing to PyPI

See [PUBLISHING.md](PUBLISHING.md) for step-by-step instructions to publish the package to PyPI so anyone can run `pip install omie-market-data`.

## License

MIT License
provable-sdk 0.0.7
Provable SDK for Python
License: MIT
Requires Python: >=3.8
Keywords: provable, kayros, keccak256, hash, blockchain

# Provable SDK for Python

A Python SDK for interacting with the Provable Kayros API.

## Installation

```bash
pip install provable-sdk
```

## Usage

```python
from provable_sdk import (
    keccak256,
    keccak256_str,
    sha256,
    sha256_str,
    prove_single_hash,
    get_record_by_hash,
    prove_data,
    prove_data_str,
    verify,
    KayrosEnvelope,
)

# Hash bytes (keccak256)
data = b'\x01\x02\x03\x04'
data_hash = keccak256(data)

# Hash string (sha256 - default)
text = "Hello, Provable!"
str_hash = sha256_str(text)

# Prove a hash
proof = prove_single_hash(data_hash)

# Get a record by hash
record = get_record_by_hash(proof["data"]["computed_hash_hex"])

# Prove data directly
data_proof = prove_data(data)

# Prove string data directly
str_proof = prove_data_str(text)

# Create and verify a KayrosEnvelope
envelope = KayrosEnvelope(
    data={"message": "Hello, Provable!"},
    kayros={
        "hash": str_hash,
        "hashAlgorithm": "sha256",
        "timestamp": {
            "service": "kayros",
            "response": proof,
        },
    },
)

result = verify(envelope)
if result["valid"]:
    print("Verification successful!")
else:
    print(f"Verification failed: {result['error']}")
```

## API

### Hash Functions

- `keccak256(data: bytes) -> str` - Compute keccak256 hash of bytes
- `keccak256_str(s: str) -> str` - Compute keccak256 hash of a UTF-8 string
- `sha256(data: bytes) -> str` - Compute SHA-256 hash of bytes
- `sha256_str(s: str) -> str` - Compute SHA-256 hash of a UTF-8 string
- `hash` / `hash_str` - Aliases for keccak256 functions

### Prove Functions

- `prove_single_hash(data_hash: str) -> ProveSingleHashResponse` - Prove a hash via Kayros API
- `prove_data(data: bytes) -> ProveSingleHashResponse` - Hash and prove bytes
- `prove_data_str(s: str) -> ProveSingleHashResponse` - Hash and prove a string

### Record Functions

- `get_record_by_hash(record_hash: str) -> GetRecordResponse` - Get Kayros record by hash

### Verify Function

- `verify(envelope: KayrosEnvelope) -> VerifyResult` - Verify data against Kayros proof

## KayrosEnvelope

The `KayrosEnvelope` class wraps data with Kayros proof metadata:

```python
envelope = KayrosEnvelope(data=my_data, kayros=kayros_metadata)

# Helper methods
envelope.get_data()           # Get data as bytes (decodes base64 for V0)
envelope.get_data_hash()      # Get the data hash (data_item_hex)
envelope.get_data_type()      # Get the data type (data_type_hex)
envelope.get_kayros_hash()    # Get the Kayros hash (computed_hash_hex)
envelope.get_time_uuid()      # Get the time UUID (timeuuid_hex)
envelope.get_hash_algorithm() # Get hash algorithm (defaults to 'sha256')
envelope.is_v0()              # Check if V0 format (legacy, for email proofs)
```

### Envelope Formats

- **V1 (default)**: Hash stored in `kayros["hash"]`, data is plain string or object
- **V0 (legacy)**: Hash in `kayros["data"]["data_item_hex"]`, data is base64-encoded bytes (used for email proofs)

## License

MIT