semvec/pypi-packages huggingface dataset:
securetar 2026.2.0
Python module to handle tarfile backups.
License: Apache-2.0
Requires Python: >=3.11.0

# Secure Tar

Secure Tarfile library

It's a streaming wrapper around python tarfile and allow secure handling files and support encryption.

```python
from securetar import SecureTarFile, atomic_contents_add
from pathlib import Path

path_to_add = Path(".")

with SecureTarFile("test.tar", "w") as tar_file:
    atomic_contents_add(
        tar_file,
        path_to_add,
        file_filter=lambda _: False,
        arcname=".",
    )

with SecureTarFile("test.tar", "w", b"AES128_KEY_SIZE") as tar_file:
    atomic_contents_add(
        tar_file,
        path_to_add,
        file_filter=lambda _: False,
        arcname=".",
    )
```

A common pattern is to create an outer uncompressed tarfile that contains
a variety of inner tar files. This can be accomplished without writing
out multiple files with the following pattern.

```python
from securetar import SecureTarFile, atomic_contents_add
from pathlib import Path

path_1 = Path("path1")
path_2 = Path("path2")

outer_secure_tar_file = SecureTarFile("pkg.tar", "w", gzip=False)

with outer_secure_tar_file as outer_tar_file:
    with outer_secure_tar_file.create_inner_tar(
        "./backup1.tar.gz", gzip=True
    ) as inner_tar_file:
        atomic_contents_add(
            inner_tar_file,
            path_1,
            file_filter=lambda _: False,
            arcname=".",
        )

    with outer_secure_tar_file.create_inner_tar(
        "./backup2.tar.gz", gzip=True
    ) as inner_tar_file:
        atomic_contents_add(
            inner_tar_file,
            path_2,
            file_filter=lambda _: False,
            arcname=".",
        )

```
strands-env 0.2.0
Standardizing environment infrastructure with Strands Agents — step, observe, reward.
License: Apache-2.0
Requires Python: >=3.10

# strands-env

[![CI](https://github.com/horizon-rl/strands-env/actions/workflows/test.yml/badge.svg)](https://github.com/horizon-rl/strands-env/actions/workflows/test.yml)
[![PyPI](https://img.shields.io/pypi/v/strands-env.svg)](https://pypi.org/project/strands-env/)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)

Standardizing environment infrastructure with [Strands Agents](https://github.com/strands-agents/sdk-python) — step, observe, reward.

## Features

This package treats each `env.step()` as a **full agent loop** `(prompt → (tool_call, tool_response)* → response)`, not a single model call.

- **Define Environments** — Subclass `Environment`, add `@tool` functions, plug in `RewardFunction`
- **RL Training** — Token-level observations for on-policy training with [strands-sglang](https://github.com/horizon-rl/strands-sglang)
- **Benchmarking** — CLI and `Evaluator` with checkpointing, resume, and custom metrics

## Install

```bash
pip install strands-env
```

For development:

```bash
git clone https://github.com/horizon-rl/strands-env.git && cd strands-env
pip install -e ".[dev]"
```

## Quick Start

### Define an Environment

Subclass `Environment` and add tools as `@tool`-decorated functions:

```python
from strands import tool
from strands_env.core import Environment

@tool
def calculator(expression: str) -> str:
    """Evaluate a math expression."""
    return str(eval(expression))

class MathEnv(Environment):
    def get_tools(self):
        return [calculator]
```

### Run It

```python
env = MathEnv(model_factory=factory, reward_fn=reward_fn)
result = await env.step(Action(message="What is 2^10?", task_context=TaskContext(ground_truth="1024")))

result.observation.final_response   # "The answer is 1024"
result.reward.reward                # 1.0
result.termination_reason           # TerminationReason.TASK_COMPLETE
```

See [`examples/calculator_demo.py`](examples/calculator_demo.py) for a complete example.

### Run Evaluations

```bash
strands-env eval aime-2024 \
    --env examples/envs/calculator_env.py \
    --backend sglang \
    --base-url http://localhost:30000 \
    --n-samples-per-prompt 8 \
    --max-concurrency 30
```

> **Tip:** For a non-agentic benchmark (no tool use), simply don't override `get_tools()` in your environment — the base class returns `[]` by default.

## Documentation

- [Evaluation Guide](docs/evaluation.md) — CLI reference, hook files, custom evaluators
- [RL Training Integration](docs/rl-training.md) — slime integration, token observations

## Development

```bash
# Lint
ruff check src/ && ruff format --check src/

# Unit tests
pytest tests/unit/ -v

# Integration tests (requires running SGLang server)
pytest tests/integration/ -v --sglang-base-url=http://localhost:30000
```

Or if using Claude Code, just use `/run-unit-tests` and `/run-integration-tests` slash commands.

## License

Apache License 2.0 — see [LICENSE](LICENSE).