semvec/pypi-packages huggingface dataset:
MqttLibPy 1.5.2
A small example package
Requires Python: >=3.7

# Mqtt common library

### Usage

```py
from MqttLibPy.client import MqttClient
# from MqttLibPy.serializer import Serializer

# Both prefix and postfix are optional
client = MqttClient('myhost.com', 1883, prefix="myprefix")

# This function will be  called when a message is received in the myprefix/myendpoint topic  
@client.endpoint("myendpoint", force_json=True)
def myendpoint(mqtt_client, _, json_body):
    print(json_body)
    my_field = json_body["some_field"]
    # Do stuff with my_field
    # ..
    # Return a response
    my_response = {"another_field": "Ok!"}
    # Sends message to topic "myendpoint"
    client.send_message_serialized(my_response, "myendpoint", valid_json=True)
```

#### Send file
Sender
```py
from MqttLibPy.client import MqttClient

client = MqttClient("myhost.com", 1883)
client.send_file("test_bytes", "/path/to/my/file/myfile.")
```

listener
```py
from MqttLibPy.client import MqttClient

client = MqttClient("myhost.com", 1883)

@client.endpoint("test_bytes", is_file=True)
def get_file(client, user_data, file):
    with open(f"/path/to/save/file/{file['data'][0]['filename']}", 'wb+') as f:
        f.write(file['bytes'])
        f.close()

threading.Thread(target=client.listen).start()
```


### Changelog

1.5.0
* Return error codes on message sent

1.1.6
* Fix bug where the same file couldnt be received multiple times

1.1.0
* Add optional metadata to file transfers

1.0.3
* Fix bug where file metadata would get overwritten if metadata arrived after the file

1.0.2
* Fix bug that caused bytes to be empty if metadata arrived after the file

1.0.1
* Fix serializer crash with json objects

1.0.0
* Adds send file method
quforge 0.3.5
QuForge: a library for qudit simulation
Requires Python: >=3.10

![QuForge Logo](https://github.com/tiago939/QuForge/blob/main/logo.png)

# QuForge v0.3.5
QuForge is a Python-based quantum simulator designed for qudits, extending quantum computing capabilities beyond traditional qubits. It facilitates the simulation of quantum circuits with customizable qudit dimensions, supporting both dense and sparse operations for efficient computation. Built on the differentiable framework PyTorch, QuForge enables execution on accelerating devices such as GPUs and TPUs, enhancing simulation speed.

For detailed documentation, visit [quforge.readthedocs.io](https://quforge.readthedocs.io).

# Installation

Install QuForge using pip:

```bash
pip install quforge
```

To install the latest version directly from the source:


```bash
# Clone the repository
git clone https://github.com/tiago939/QuForge.git

# Navigate to the project directory
cd QuForge

# Install the package
pip install .
```

Ensure that your environment meets the necessary dependencies listed in requirements.txt.

# Usage

Here's an example of how to create and execute a simple quantum circuit using QuForge:

```bash

import quforge.quforge as qf

# Initialize a 2-level (qubit) circuit with 2 wires
circuit = qf.Circuit(dim=2, wires=2)

# Add gates to the circuit
circuit.H(index=[0])           # Hadamard gate on wire 0
circuit.CNOT(index=[0, 1])   # CNOT gate with control wire 0 and target wire 1

# Initialize the state
state = qf.State('0-0', dim=2)

# Execute the circuit
result = circuit(state)

print(result)
```

This script sets up a quantum circuit with a Hadamard gate and a CNOT gate, then executes it on an initial state.


# Directory Structure

The QuForge repository is organized as follows:

```bash
QuForge/
├── docs/                   # Documentation files
├── examples/               # Example scripts demonstrating QuForge usage
├── quforge/                # Main source code for the QuForge library
│   ├── __init__.py         # Initializes the quforge package
│   └── ...                 # Other source files
├── .gitignore              # Specifies files and directories to ignore in Git
├── .readthedocs.yaml       # Configuration for Read the Docs documentation hosting
├── LICENSE                 # License information (Apache-2.0)
├── README.md               # Overview and instructions for the project
├── logo.png                # QuForge logo image
├── requirements.txt        # List of Python dependencies
└── setup.py                # Installation script for the QuForge package
```

# Contributions and Support

We are continuously working on optimizing the library. Please reach out if you have any suggestions or questions!


# Citation

If you use QuForge in your research, please cite our work:

```
@misc{2024quforge,
      title={QuForge: A Library for Qudits Simulation},
      author={Tiago de Souza Farias and Lucas Friedrich and Jonas Maziero},
      year={2024},
      eprint={2409.17716},
      archivePrefix={arXiv},
      primaryClass={quant-ph},
      url={https://arxiv.org/abs/2409.17716},
}
```