semvec/pypi-packages huggingface dataset:
matplatex 0.9.6
A package to save matplotlib figures for easy inclusion in LaTeX.
Requires Python: >=3.10
Keywords: LaTeX, matplotlib, pdf_tex

# MatpLaTeX

MatpLaTeX lets you save a matplotlib `Figure` as a combination of a pdf file containing the graphics and a LaTeX file containing the text. With this, text in the figure will automatically use the typeface, size and other settings of the surrounding text.

## Installation

MatpLaTeX is on PyPI, simply
```
pip install matplatex
```

### Python requirements:
- python >= 3.10 (If someone asks I may add support for earlier versions.)
- matplotlib >= 3.5
- beartype

### LaTeX requirements:
- tikz
- graphicx

## Basic Usage

To save a figure, simply use
```
matplatex.save(fig, "myfig")
```
this will create two files named `myfig.pdf` and `myfig.pdf_tex`.

In your LaTeX document, define the width of the figure with
```
\newlength{\figurewidth}
\setlength{\figurewidth}{<your desired width>}
```
and include the figure as such:
```
\input{myfig.pdf_tex}
```
LaTeX commands such as `\small` and `\textbf{}` will affect the text in the expected way.

## Options

_Note: this is still under development and may change in future versions._

`matplatex.save` accepts the following keyword options:
- `widthcommand`: string  
Command used to set the width of the figure. Default: `\figurewidth`.
- `draw_anchors`: bool  
Mark the text anchors in the figure. Useful for debugging. Default: `False`.
- `verbose`: bool  
Print message upon successful save. Default: `True`.
rstypes 0.1.1
Thread-safe async-aware types for Python written in Rust
Requires Python: >=3.10


# rstypes

`rstypes` is a minimal Python package providing **thread-safe**, **async-aware** data types implemented in **Rust**. It is designed for high-performance concurrent and asynchronous programming in Python.

This library is ideal for building:
- ✅ **Global or shared dictionaries** across threads or async tasks
- ✅ **In-memory async-aware caches** with TTL support

Internally, each instance uses a single **mutex**, not per-key locks, which keeps the locking semantics simple and predictable.

## Features

- 🧵 **Thread-safe**: Types that can be safely used across multiple threads.
- ⚡ **Async-aware**: Compatible with `asyncio` and async/await patterns
- 🚀 **Rust-powered**: Built with [PyO3](https://github.com/PyO3/pyo3) for blazing-fast native performance
- 🔐 **Default value support**: Behaves like `collections.defaultdict`

## Installation

```bash
pip install rstypes
```

## Example Usage

### 🔹 Minimal Example

```python
import asyncio

from rstypes import RMap

async def main():
    d = RMap()
    await d.set(key="hello", value=123)
    val = await d.get("hello")
    assert val == 123

    await d.set(key=7, value="answer")
    await d.pop(7)
    val = await d.get(7)
    assert val is None
    
asyncio.run(main())
```

### 🔹 Async `defaultdict` Behavior

```python
import asyncio

from rstypes import RMap

async def main():
    rlock = RMap(asyncio.Lock) # like defaultdict(asyncio.Lock)
    
    async with await rlock.get("mykey"):
        print("Inside an asyncio.Lock")

asyncio.run(main())
```

### 🔹 Memory Cache with TTL

```python
import asyncio
from typing import NamedTuple

from rstypes import RCacheMap

class Foo(NamedTuple):
    name: str
    age: int

async def main():
    cache = RCacheMap()

    await cache.set(key="hello", value=123, ttl=1.0)  # 1 second TTL
    await cache.set(key="user", value=Foo(name="Alice", age=30), ttl=2.0)  # 2 seconds TTL

    await cache.pop("hello")
    assert await cache.get("hello") is None

    user = await cache.get("user")
    assert isinstance(user, Foo)

    await asyncio.sleep(2.1)
    await cache.pop_expired()
    assert await cache.get("user") is None

asyncio.run(main())
```

## License

`rstypes` is licensed under the MIT License. See [LICENSE](LICENSE) for more information.