Metadata-Version: 2.4
Name: pyfetchy
Version: 0.1.0
Summary: A fast, open-source download manager with parallel segments and resume support
Project-URL: Homepage, https://github.com/Uruskus/fetchy
Project-URL: Issues, https://github.com/Uruskus/fetchy/issues
Author: fetchy contributors
License: MIT
License-File: LICENSE
Keywords: cli,download,manager,parallel,resume
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27.0
Requires-Dist: rich>=13.0.0
Requires-Dist: typer>=0.12.0
Description-Content-Type: text/markdown

# fetchy

> A fast, open-source CLI download manager — a free alternative to IDM.

[![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue)](https://python.org)
[![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)
[![PyPI](https://img.shields.io/pypi/v/fetchy)](https://pypi.org/project/fetchy)

fetchy splits files into parallel segments using HTTP Range Requests, giving you faster downloads and the ability to resume interrupted transfers — right from your terminal.

---

## Features

- **Parallel downloads** — splits files into N segments downloaded simultaneously
- **Resume support** — interrupted downloads continue from where they left off
- **Live progress** — per-segment bars with speed and ETA
- **Retry logic** — transient errors are retried automatically with exponential backoff
- **Cross-platform** — works on Windows, macOS, and Linux
- **Zero config** — sensible defaults, fully configurable via flags

---

## Installation

```bash
pip install fetchy
```

Or install from source:

```bash
git clone https://github.com/yourusername/fetchy.git
cd fetchy
pip install -e .
```

---

## Usage

```bash
# Basic download (4 segments by default)
fetchy get https://example.com/largefile.zip

# Save to a specific directory or filename
fetchy get https://example.com/largefile.zip -o ~/Downloads/
fetchy get https://example.com/largefile.zip -o ~/Downloads/myfile.zip

# Use 8 parallel segments
fetchy get https://example.com/largefile.zip -s 8

# Disable resume (start fresh even if a state file exists)
fetchy get https://example.com/largefile.zip --no-resume

# Show version
fetchy --version
```

**Resuming:** if you press `Ctrl+C` during a download, fetchy saves a `.fetchy` state file next to the output file. Run the same command again to resume automatically.

---

## How it works

1. fetchy sends a `HEAD` request to check the file size and whether the server supports `Range` requests.
2. If supported, the file is split into N equally-sized byte ranges.
3. Each segment is downloaded in parallel using async HTTP (httpx).
4. Segments are written directly to their correct offset in the pre-allocated output file — no temp files to merge.
5. Progress and speed are tracked per segment and shown in a live Rich display.
6. On completion the `.fetchy` state file is deleted automatically.

---

## Options

| Flag | Default | Description |
|---|---|---|
| `-o`, `--output` | `.` (current dir) | Output file or directory |
| `-s`, `--segments` | `4` | Number of parallel segments |
| `-r`, `--retries` | `5` | Max retries per segment |
| `--resume / --no-resume` | `--resume` | Resume interrupted downloads |

---

## Development

```bash
# Install with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run a local download test
fetchy get https://speed.hetzner.de/100MB.bin -s 8
```

### Project structure

```
fetchy/
├── src/
│   └── fetchy/
│       ├── __init__.py      # version
│       ├── cli.py           # Typer CLI entry point
│       ├── downloader.py    # core engine (segments, resume, retry)
│       └── progress.py      # Rich progress display
├── tests/
│   └── test_downloader.py
├── pyproject.toml
└── README.md
```

---

## Contributing

Contributions are welcome! Please open an issue first to discuss what you'd like to change.

1. Fork the repo
2. Create a feature branch (`git checkout -b feature/your-feature`)
3. Commit your changes
4. Open a pull request

---

## License

MIT — see [LICENSE](LICENSE).
