semvec/pypi-packages huggingface dataset:
q-logger-py 0.0.3
Pure Python 3 logging library that use queues for handling log.
Requires Python: >=3.9

# q-logger-py

**q-logger-py** is a pure Python 3 logging library that use queues for handling log messages. 

It is thread-based, which makes it faster than standard file logging.

![](https://github.com/minwook-shin/q-logger-py/blob/main/speed_benchmark_figure.png?raw=true)

## Installation

```bash
pip install q-logger-py
```

## Usage

first need to create a `QueueHandler` and a `ThreadWorker` (either `ThreadStdoutWorker` or `ThreadRotateFileWorker`). 

Then, add the `QueueHandler` to your logger and start the `ThreadWorker`.

```python
import logging
from q_logger_py import QueueHandler, ThreadStdoutWorker

queue_handler = QueueHandler()
thread_worker = ThreadStdoutWorker(queue_handler.log_queue)

logger = logging.getLogger(__name__)
logger.addHandler(queue_handler)
logger.setLevel(logging.DEBUG)

thread_worker.start()
logger.debug('This is a debug')
logger.info('This is a info')
logger.warning('This is a warning')
logger.error('This is an error')
thread_worker.end()
```

## Features

- **Thread-based**: uses threads to handle log messages, which makes it faster than standard file logging.
- **Queue-based**: uses queues to store log messages, which ensures that no log messages are lost.

## Custom Output

key features of q-logger-py is the ease of creating custom outputs. 

By inheriting from the `BaseThreadWorker` class, you can define `output` method to handle records in any way you want. 

```python
from q_logger_py.worker.base_thread_worker import BaseThreadWorker

class ThreadFileWorker(BaseThreadWorker):
    def __init__(self, log_queue, filename):
        super().__init__(log_queue)
        self.file = open(filename, 'a')

    def output(self):
        log_output = self.format(self.record)
        # add custom output here
        # self.file.write(log_output + '\n')
        # self.file.flush()
        print(log_output)
```

## License

q-logger-py is licensed under the Apache License.

## Project Links

- [Homepage](https://github.com/minwook-shin/q-logger-py)
- [Bug Tracker](https://github.com/minwook-shin/q-logger-py/issues)
laniakea-utils 0.2.0b3
Utilities for Laniakea applications
Requires Python: >=3.6

Laniakea Utils
==============

Laniakea utilites package

Api
---

test

start: gunicorn --workers 2 --bind 0.0.0.0:5001 --timeout 300 app:app

curl: curl -H 'Accept: application/json' -H "Authorization: Bearer ${TOKEN}" http://90.147.102.14:5000/valid_user/${SUB}

How to upload on pypi
---------------------

Create a new package:
```
python setup.py sdist
```

Upload on pypi with twine:
```
twine upload dist/*
```
tdigest-rs 0.1.0
Simple Python package to compute TDigests, implemented in Rust
Requires Python: >=3.10

# TDigest-rs

Simple Python package to compute TDigests, implemented in Rust.

## Introduction

TDigest-rs is a Python library with a Rust backend that implements the T-Digest algorithm, enhancing the estimation of quantiles in streaming data. For an in-depth exploration of the T-Digest algorithm, refer to [Ted Dunning and Otmar Ertl's paper](https://arxiv.org/abs/1902.04023) and the [G-Research blog post](https://www.gresearch.com/blog/article/approximate-percentiles-with-t-digests/).


## Usage

```shell
pip install tdigest-rs
```

The library contains a single ``TDigest`` class.

### Creating a TDigest object

```python

from tdigest_rs import TDigest

# Fit a TDigest from a numpy array (float32 or float64)
arr = np.random.randn(1000)
tdigest = TDigest.from_array(arr=arr, delta=100.0)  # delta is optional and defaults to 300.0
print(tdigest.means, tdigest.weights)

# Create directly from means and weights arrays
vals = np.random.randn(1000).astype(np.float32)
weights = np.ones(1000).astype(np.uint32)
tdigest = TDigest.from_means_weights(arr=vals, weights=weights)
```

### Computing quantiles

```python

# Compute a quantile
tdigest.quantile(0.1)

# Compute median
tdigest.median()

# Compute trimmed mean
tdigest.trimmed_mean(lower=0.05, upper=0.95)
```

### Merging TDigests

```python

arr1 = np.random.randn(1000)
arr2 = np.ones(1000)
digest1 = TDigest.from_array(arr=arr1)
digest2 = TDigest.from_array(arr=arr2)

merged_digest = digest1.merge(digest2, delta=100.0)  # delta again defaults to 300.0
```

### Serialising TDigests

The ``TDigest`` object can be converted to a dictionary and JSON-serialised and is also pickleable.

```python

# Convert and load to/from a python dict
d = tdigest.to_dict()
loaded_digest = TDigest.from_dict(d)

# Pickle a digest
import pickle

pickle.dumps(tdigest)
```


## Development workflow

```bash
pip install hatch

cd bindings/python

# Run linters
hatch run dev:lint

# Run tests
hatch run dev:test

# Run benchmark
hatch run dev:benchmark

# Format code
hatch run dev:format
```

## Contributing

Please read our [contributing](https://github.com/G-Research/tdigest-rs/blob/main/CONTRIBUTING.md) guide and [code of conduct](https://github.com/G-Research/tdigest-rs/blob/main/CODE_OF_CONDUCT.md) if you'd like to contribute to the project.

## Community Guidelines

Please read our [code of conduct](https://github.com/G-Research/tdigest-rs/blob/main/CODE_OF_CONDUCT.md) before participating in or contributing to this project.

## Security

Please see our [security policy](https://github.com/G-Research/tdigest-rs/blob/main/SECURITY.md) for details on reporting security vulnerabilities.

## License

TDigest-rs is licensed under the [Apache Software License 2.0 (Apache-2.0)](https://github.com/G-Research/tdigest-rs/blob/main/LICENSE)