semvec/pypi-packages huggingface dataset:
simple-exr 0.0.0
A simple library for reading and writing EXR files
Requires Python: >=3.8

# Simple EXR

A simple Python library for reading and writing OpenEXR files using numpy arrays.

## Installation

```bash
pip install simple-exr
```

## Quick Start

### Reading EXR Files

```python
import simple_exr
import numpy as np

# Read an EXR file
image = simple_exr.read_exr("path/to/image.exr")
print(f"Image shape: {image.shape}")  # (height, width, channels)
print(f"Image dtype: {image.dtype}")  # float32
```

### Writing EXR Files

```python
import simple_exr
import numpy as np

# Create a sample RGB image
height, width = 512, 512
rgb_image = np.random.rand(height, width, 3).astype(np.float32)

# Write to EXR file
simple_exr.write_exr("output.exr", rgb_image)

# Create a sample RGBA image
rgba_image = np.random.rand(height, width, 4).astype(np.float32)

# Write RGBA to EXR file
simple_exr.write_exr("output_rgba.exr", rgba_image)
```

## API Reference

### `read_exr(path: str) -> np.ndarray`

Read an EXR file and return it as a numpy array.

**Parameters:**
- `path` (str): Path to the EXR file

**Returns:**
- `np.ndarray`: Image data as (H, W, C) array where C is 3 (RGB) or 4 (RGBA)

**Raises:**
- `ValueError`: If no RGB(A) channels are found in the EXR file
- `FileNotFoundError`: If the file doesn't exist

### `write_exr(path: str, img: np.ndarray)`

Write a numpy array to an EXR file as RGB or RGBA depending on channel count.

**Parameters:**
- `path` (str): Output path for the EXR file
- `img` (np.ndarray): Image data with shape (H, W, 3) or (H, W, 4), dtype float32 or float64

**Raises:**
- `ValueError`: If img doesn't have 3 or 4 channels
xurls 1.4.1
Python URL Library
Requires Python: <4.0,>=3.10

![PythonSupport](https://img.shields.io/static/v1?label=python&message=%203.8|%203.9|%203.10|%203.11&color=blue?style=flat-square&logo=python)
![PyPI version](https://badge.fury.io/py/xurls.svg?)

## Documentation

A high-level `Url` class to make parsing, looking at and manipulating
urls much easier.

Also allows for easily composable urls.

Everything is subject to change!

**[📄 Detailed Documentation](https://joshorr.github.io/xurls/latest/)** | **[🐍 PyPi](https://pypi.org/project/xurls/)**

## Getting Started

```shell
poetry install xurls
```

or

```shell
pip install xurls
```

Very basic example:

```python
from xurls import Url

url = Url("http://www.google.com/some/path?some_key=some-value")
assert url.host == "www.google.com"

url.host = "apple.com"
assert str(url) == "http://apple.com/some/path"

assert url['some_key'] == 'some-value'

```

You can also compose urls:

```python
from xurls import Url

base_url = Url(host='www.example.com')
url_to_append = Url(path='hello/today')

# Append url; paths will append to end, queries merged together.
# Other components like host will be replaced if there is a value in the appended url.
final_url = base_url.copy().append_url(url_to_append)

assert str(final_url) == 'www.example.com/hello/today'

```