semvec/pypi-packages huggingface dataset:
gnu-mo-files 0.0.1.1
Read and write GNU MO files
Requires Python: >=3.9

# GNU MO Files

Read and write GNU MO files.

Created using [The Format of GNU MO Files](https://www.gnu.org/software/gettext/manual/html_node/MO-Files.html) article.

To the contrary of what's written there, **the file revision** is totally ignored.
The reason is that the difference between the revisions is not clear.

**The hash table** does not get written and ignored while reading, for Python dictionary uses its own hashing anyway.

Requires `Python >= 3.9` and no additional packages.
The code can be easily ported to older Python version, but I have no intention to.
persistedstate 25.1
Ultra fast persistent store for small states in mapped YAML file
Requires Python: >=3.9

# PersistedState

Simple and fast solution for persisting small states:

```python
from persistedstate import PersistedState

STATE = PersistedState("example.state", last_id=0)

for current_id in range(STATE.last_id + 1, 100_001):
    print(f"Processing item #{current_id}")
    STATE.last_id = current_id

print("Processing DONE.")
```

You can interrupt this script, and next time it will continue from the first unprocessed item.
As another example see [perftest.py](perftest.py).

## Mapped YAML state file

The use case is persisting small amount of data which can be edited easily with a text editor.
The database is an UTF-8 encoded YAML file, so it can be highlighted and edited manually if needed.
(It also uses YAML stream file format for journal.)
The YAML file is fully mapped to Python objects, so every change is synchronized to disk immediately. E.g. you can do this:

```python
STATE = PersistedState("state.yaml", processed_items=[])
STATE.setdefault("key", {})
STATE["key"].setdefault("nested", 2)

STATE.processed_items.append("<some item>")
STATE["key"]["nested"] += 1
```

## Failure tolerance

It uses Write-Ahead-Logging and atomic vacuum, so there will be no data loss.

## Thread safe

Changing the state is thread safe. You also can use the `._thread_lock` attribute to make atomic changes:


```python
def atomic_increment():
    with STATE._thread_lock:
        STATE.counter += 1
```

## Performance

For its use case it outperforms existing key-value store modules.
For example incrementing a counter (for the details see [perftest.py](perftest.py)):

```python
state.counter = 0
for _ in range(COUNT_TO):
    state.counter += 1
```

Counting to 10,000 (using Windows and Python 3.11):

```
PersistedState   0.193 sec
DiskCache        1.222 sec
SqliteDict       3.089 sec
PickleDb         8.251 sec
Lmdb            14.944 sec
Shelve          39.771 sec
```

The example seems to be silly, but this is very close to the use case it was developed for. For complex data structures or big amount of data I suggest using other libraries, like [DiskCache](https://grantjenks.com/docs/diskcache/). (The rule of thumb is when your state file is too big to be edited easily in your favorite text editor, you may think about using another key-value store library.)
locarc 0.2.2
A simple Python tools that aims to emulate EventArc behavior locally
Requires Python: >=3.13

# Loc(al event) arc.

[![PyPI - Version](https://img.shields.io/pypi/v/locarc)](https://pypi.org/project/locarc/)

`locarc` is a tiny tool that aims to emulate an event driven stack locally for
testing and integration. It was primarily designed to reproduce an
[EventArc](https://cloud.google.com/eventarc/docs) use case where messages
are transiting from a [PubSub](https://cloud.google.com/pubsub/docs) topic to
an external service.

## Getting started

You can either run `locarc` by installing it with any Python package manager:

```bash
$ pip install locarc
```

or using the associated [Docker]() image from [DockerHub]():

```bash
$ docker run --rm -v /path/to/arc.yml:/locarc/arc.yml opsiedev/locarc --arcfile=/locarc/arc.yml
```

## The Arc file

> TBD