semvec/pypi-packages huggingface dataset:
pyzmij 0.1.0
Python binding for vitaut/zmij float formatting library
Requires Python: >=3.10

# pyzmij

Python C extension for fast formatting of Python float values using vitaut/zmij.

## API

```python
import pyzmij

# Format a single float
s = pyzmij.format_finite(3.141592653589793)

# General formatter (optional JSON compatibility)
s2 = pyzmij.format(1.0, json_compatible=True)  # "1.0"

# Batch formatter (returns list[str])
items = pyzmij.format_many([1.0, -0.0, 3.14], json_compatible=True)

# Batch formatter (returns one joined string)
line = pyzmij.format_join([1.0, -0.0, 3.14], sep=",", json_compatible=True)

# Batch format and get total output length (sequence input)
total_len = pyzmij.format_many_len([1.0, 2.0, 3.0])
```

## Practical Use Cases

```python
import pyzmij

values = [1.0, -0.0, 3.141592653589793]

# 1) JSON payload fragment
json_numbers = "[" + ",".join(pyzmij.format_many(values, json_compatible=True)) + "]"

# 2) CSV row
csv_row = pyzmij.format_join(values, sep=",")

# 3) Structured logs
log_text = "sensor_values=" + pyzmij.format_join(values, sep=",", json_compatible=True)

# 4) Direct stream write (file/socket-like object with write(str))
with open("out.txt", "w", encoding="utf-8") as f:
    pyzmij.write_many(f, values, sep=",", end="\n", json_compatible=True)
```

`pyzmij` is applied only when you explicitly call `pyzmij.format*` APIs.
This package intentionally does not replace Python's built-in `print()` behavior.

## Semantics

`format_finite(x)` returns the **shortest** correctly-rounded decimal representation for finite Python float values.
In particular, integer-valued floats may not include a trailing `.0` (e.g. `1.0` may format as `"1"`).

Input contract:
- `format(x, *, json_compatible=False, allow_non_finite=False)` accepts a Python `float`.
- `format_finite(x)` accepts a Python `float` only (rejects `int`, `str`, `None`, NaN, and Inf).
- `format_many(seq, *, json_compatible=False, allow_non_finite=False)` returns `list[str]`.
- `format_join(seq, *, sep=",", json_compatible=False, allow_non_finite=False)` returns `str`.
- `format_many_len(seq)` accepts a sequence (for example `list` or `tuple`) whose items are all `float`.
- `format_many_len` returns only total formatted length (`int`).
- `write_many(file, seq, *, sep=",", end="\n", json_compatible=False, allow_non_finite=False)` writes once via `file.write(...)`.
- `bench_format_many(seq)` remains available as a compatibility alias.

`json_compatible` means "match JSON float text conventions":
- finite integer-looking values keep a decimal point (`1.0` -> `"1.0"`)
- negative zero keeps its sign (`-0.0` -> `"-0.0"`)
- if `allow_non_finite=True`, non-finite values use JSON tokens (`NaN`, `Infinity`, `-Infinity`)

## Building

```bash
uv pip install -e .
```

This package vendors its `vitaut/zmij` dependency under `third_party/` (no git submodule required).
funfile 1.0.24
funfile
Requires Python: >=3.7

# funfile

一个实用的 Python 文件操作工具库，提供带进度条的压缩/解压、并发写入、pickle 序列化等功能的增强封装。

## 特性

- 带进度条的 tar/zip 压缩与解压，用法与标准库一致
- 线程安全的并发文件写入，支持断点续写
- pickle 序列化/反序列化的便捷封装
- 常用文件系统操作（创建目录、删除、复制）

## 安装

```bash
pip install funfile
```

## 依赖

- Python >= 3.7
- [funutil](https://pypi.org/project/funutil/) >= 1.0.15
- [tqdm](https://pypi.org/project/tqdm/) >= 4.66.5

## 使用

### tar 压缩/解压（带进度条）

用法与标准库 `tarfile` 一致，自动显示进度条：

```python
from funfile import tarfile

# 压缩
with tarfile.open("results.tar", "w|xz") as tar:
    tar.add("a.txt")

# 解压
with tarfile.open("results.tar", "r|xz") as tar:
    tar.extractall("local")
```

也可以使用快捷函数：

```python
from funfile.compress.tarfile import file_entar, file_detar

# 一键压缩
file_entar("mydir", "mydir.tar")

# 一键解压
file_detar("mydir.tar", "output")
```

### zip 解压

```python
from funfile import zipfile

with zipfile.ZipFile("archive.zip") as zf:
    zf.extractall("output")
```

### 通用解压

根据文件后缀自动选择解压方式，支持 `.zip`、`.tar`、`.tar.gz`、`.tgz`、`.tar.bz2`、`.tar.xz`、`.txz`：

```python
from funfile.compress.allfile import extractall

extractall("archive.tar.gz", "output")
```

### 并发文件写入

线程安全的异步写入，适用于多线程场景。支持指定偏移量写入，并在写入过程中自动记录进度，异常中断后可断点续写：

```python
from funfile import ConcurrentFile

with ConcurrentFile("output.txt", mode="w") as fw:
    fw.write("hello, funfile.")
    fw.write("another line.")
```

支持指定偏移量的随机写入：

```python
with ConcurrentFile("output.bin", mode="wb") as fw:
    fw.write(b"chunk1", offset=0)
    fw.write(b"chunk2", offset=1024)
```

### pickle 序列化

便捷的 pickle 读写封装：

```python
from funfile.pickle import dump, load, dumps, loads

# 写入文件
dump({"key": "value"}, "data.pkl")

# 从文件读取
data = load("data.pkl")

# 序列化为 bytes
raw = dumps({"key": "value"})

# 从 bytes 反序列化
obj = loads(raw)
```

### 文件系统工具

```python
from funfile.funos import makedirs, delete

# 递归创建目录（已存在不报错）
makedirs("path/to/dir")

# 递归删除目录
delete("path/to/dir")
```

```python
from funfile.file import copy

# 复制文件
copy("src.txt", "dst.txt")
```

### 获取文件/目录大小

```python
from funfile import get_size

# 获取文件大小（字节）
size = get_size("large_file.bin")

# 递归获取目录大小
size = get_size("mydir", recursive=True)
```

## 项目结构

```
src/funfile/
├── __init__.py            # 顶层导出
├── funos.py               # 文件系统工具（makedirs, delete）
├── file/
│   ├── core.py            # 文件复制
│   └── concurrent.py      # 并发文件写入
├── compress/
│   ├── utils.py           # 进度条、文件大小计算
│   ├── tarfile.py         # 带进度条的 tar 操作
│   ├── zipfile.py         # zip 操作封装
│   └── allfile.py         # 通用解压
└── pickle/
    └── core.py            # pickle 序列化封装
```

## 许可证

[Apache License 2.0](LICENSE)
smime-email 1.0.2
A Python library to generate a signed email
Requires Python: <4,>=3.10

# python-smime-email

<a href="https://pypi.org/project/smime-email/"><img alt="PyPI" src="https://img.shields.io/pypi/v/smime-email"></a>
<a href="https://pepy.tech/project/smime-email"><img alt="Downloads" src="https://pepy.tech/badge/smime-email"></a>

Generate x509 SMIME signed emails with ease!

## Usage

1. Generate the email raw content

    ```python
    import smime_email

    data = b"Hello!"
    SMIME_KEY = smime_email.load_key("key_path.pem")
    SMIME_INTERMEDIATE = smime_email.load_certificates("intermediate_path.pem")
    SMIME_CERT = smime_email.load_certificates("cert_path.pem")[0]
    email_raw_bytes = smime_email.get_smime_attachment_content(data, SMIME_KEY, SMIME_INTERMEDIATE, SMIME_CERT)
    ```

1. Send it using any email library you like. Here is an example as Django email backend

    ```python
    email_raw_bytes = smime_email.get_smime_attachment_content(data, SMIME_KEY, SMIME_INTERMEDIATE, SMIME_CERT)
    # ...
    class EmailBackend(BaseEmailBackend):
        def send_messages(self, message) -> int:
            with smtplib.SMTP(settings.EMAIL_HOST, settings.EMAIL_PORT) as server:
                server.sendmail(message.from_email, message.to, email_raw_bytes)
            return 1
    ```

## Development

The code is formatted with **ruff** and checked with various linters.
To run the whole linting and formatting process, run `uv run poe all`.

## License

Code and documentation copyright 2024-2025 Siemens AG.

See [LICENSE.md](LICENSE.md).