semvec/pypi-packages huggingface dataset:
autoopen 0.1.0
Automatically compress or decompress files on open by filename.
License: MIT
Requires Python: >=3.9,<4.0

# autoopen

_autoopen_ is a small drop-in replacement for the most common use cases of Python’s built-in open() function that will automatically handle compressed files based on the filename.

## Usage

For example:

```python
from autoopen import autoopen

filename = "example.txt.xz"
with autoopen(filename, "rt", encoding="utf-8") as file:
    contents = file.read()
```

`autoopen` will check the given filename’s last suffix. If it indicates one of the supported compressors, the corresponding compressor or decompressor will be used, otherwise it falls back to built-in `open`. 

Support for .gz, .bz2, .xz, .lzma, and .zst/.zstd is built-in (the latter requires the [python-zstandard](https://pypi.org/project/zstandard/) package). The special filename `-` indicates reading from stdin or writing to stdout.
gfx2cuda 0.0.2
Fast graphics texture to cuda transfer
License: MIT
Requires Python: >=3.6
Keywords: Screen Capture,Screenshot,Computer Vision

# Gfx2Cuda - Graphics to CUDA interoperability

_Gfx2Cuda_ is a python implementation of CUDA's graphics interopability methods for DirectX, OpenGL, etc.
The main usage is for quick transfer of images rendered with for example Godot or Unity to CUDA memory buffers such as 
pytoch tensors, without needing to transfer the image to cpu and back to gpu.

For now only DirectX 11 is supported. This can be useful for implementing CUDA ipc (interprocess-communication) for 
Windows, since that functionality is not available in vanilla CUDA for Windows. 
You would use a DirectX texture as buffer that can be seen by multiple processes without having to download any gpu data
to cpu and back.

### Example

**Render to texture and copy to pytorch tensor**

```python
import gfx2cuda
import torch

# Shape: [height, width, channels]
shape = [480, 640, 4]
tensor1 = torch.ones(shape).contiguous().cuda()
tensor2 = torch.zeros(shape).contiguous().cuda()

# Create copy of a tensor but as a texture
tex = gfx2cuda.texture(tensor1)

with tex as ptr:
    tex.copy_to(tensor2)

print(tensor2.data)
# pytorch tensor should now contain a copy of the texture data
```

**Share texture between process, write on one process and see results in the other**

```python
from multiprocessing import Process

import gfx2cuda
import torch

shape = [4, 4, 4]

def f(handle):
    tex = gfx2cuda.open_ipc_texture(handle)
    # Received and opened the texture
    print(tex)
    # >> Texture with format TextureFormat.RGBA32FLOAT (4 x 4)
    tensor1 = torch.ones(shape).contiguous().cuda()
    with tex:
        tex.copy_from(tensor1)

if __name__ == "__main__":
    tensor = torch.zeros(shape).contiguous().cuda()
    # Initialize as all zeros
    tex = gfx2cuda.texture(tensor)

    p = Process(target=f, args=(tex.ipc_handle,))
    p.start()
    p.join()

    with tex:
        tex.copy_to(tensor)

    print(tensor.data)
    # See all ones
```