Metadata-Version: 2.1
Name: torrent-models
Version: 0.1.0
Summary: .torrent file parsing and creation with pydantic
Keywords: bittorrent,torrent,pydantic
Author-Email: sneakers-the-rat <sneakers-the-rat@protonmail.com>
License: EUPL-1.2
Classifier: Framework :: Pydantic
Classifier: Framework :: Pydantic :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Project-URL: repository, https://github.com/p2p-ld/torrent-models
Requires-Python: >=3.11
Requires-Dist: pydantic>=2.10.6
Requires-Dist: bencode-rs>=0.0.7
Requires-Dist: tqdm>=4.67.1
Requires-Dist: typing-extensions>=4.13.0; python_version < "3.12"
Requires-Dist: anyio>=4.9.0
Requires-Dist: rich>=14.0.0
Requires-Dist: nest-asyncio>=1.6.0
Provides-Extra: cli
Requires-Dist: click>=8.1.8; extra == "cli"
Requires-Dist: humanize>=4.12.2; extra == "cli"
Provides-Extra: libtorrent
Requires-Dist: libtorrent>=2.0.11; extra == "libtorrent"
Provides-Extra: mypy
Requires-Dist: torrent-models[cli]; extra == "mypy"
Requires-Dist: types-tqdm>=4.67.0.20250417; extra == "mypy"
Provides-Extra: tests
Requires-Dist: torrent-models[cli,libtorrent]; extra == "tests"
Requires-Dist: pytest>=8.3.5; extra == "tests"
Requires-Dist: pytest-cov>=6.0.0; extra == "tests"
Requires-Dist: pytest-codspeed>=3.2.0; extra == "tests"
Requires-Dist: torf>=4.3.0; extra == "tests"
Requires-Dist: pytest-profiling>=1.8.1; extra == "tests"
Provides-Extra: dev
Requires-Dist: torrent-models[mypy,tests]; extra == "dev"
Requires-Dist: ruff>=0.11.2; extra == "dev"
Requires-Dist: black>=25.1.0; extra == "dev"
Requires-Dist: mypy>=1.15.0; extra == "dev"
Requires-Dist: types-tqdm>=4.67.0.20250417; extra == "dev"
Requires-Dist: sphinx-autobuild>=2024.10.3; extra == "dev"
Provides-Extra: docs
Requires-Dist: torrent-models[cli]; extra == "docs"
Requires-Dist: sphinx>=8.2.3; extra == "docs"
Requires-Dist: furo>=2024.8.6; extra == "docs"
Requires-Dist: myst-parser>=4.0.1; extra == "docs"
Requires-Dist: autodoc-pydantic>=2.2.0; extra == "docs"
Requires-Dist: sphinx-design>=0.6.1; extra == "docs"
Requires-Dist: sphinxcontrib-mermaid>=1.0.0; extra == "docs"
Requires-Dist: myst-nb>=1.2.0; extra == "docs"
Requires-Dist: rich>=14.0.0; extra == "docs"
Requires-Dist: sphinx-click>=6.0.0; extra == "docs"
Description-Content-Type: text/markdown

# torrent-models

[![docs](https://readthedocs.org/projects/torrent-models/badge/)](https://torrent-models.readthedocs.io/en/latest/)

.torrent file parsing and creation with pydantic
(and models for other bittorrent things too)

While there are [many](#other-projects) other torrent packages, this one:

- Is simple and focused
- Can create and parse v1, v2, hybrid, and [other BEPs](./beps.md)
- Is focused on library usage (but does [cli things too](./usage/cli.md))
- Validates torrent files (e.g. when accepting them as user input!)
- Treats .torrent files as an *extensible* rather than fixed format
- Is performant! (and asyncio compatible when hashing!)
- Uses python typing and is mypy friendly

~ alpha software primarily intended for use with [sciop](https://codeberg.org/Safeguarding/sciop) ~


## See also

These are also good projects, and probably more battle tested
(but we don't know them well and can't vouch for their use):

- [`torrentfile`](https://alexpdev.github.io/torrentfile/)
- [`dottorrent`](https://dottorrent.readthedocs.io)
- [`torf`](https://github.com/rndusr/torf)
- [`torrenttool`](https://github.com/idlesign/torrentool)
- [`PyBitTorrent`](https://github.com/gaffner/PyBitTorrent)
- [`torrent_parser`](https://github.com/7sDream/torrent_parser)

Specifically
- `torf` has some notable performance problems, and doesn't support v2
- `torrentfile` is focused on the cli and doesn't appear to be able to validate torrent files, 
  and there is no dedicated method for parsing them, 
  e.g. editing [directly manipulates the bencoded dict](https://github.com/alexpdev/torrentfile/blob/d50d942dc72c93f052c63b443aaec38c592a14df/torrentfile/edit.py#L65)
  and [rebuilding requires the files to be present](https://github.com/alexpdev/torrentfile/blob/d50d942dc72c93f052c63b443aaec38c592a14df/torrentfile/rebuild.py)
- `dottorrent` can only write, not parse torrent files.
- `torrenttool` doesn't validate torrents
- `PyBitTorrent` doesn't validate torrents
- `torrent_parser` doesn't validate torrents and doesn't have a torrent file class