Metadata-Version: 2.1
Name: bencoder.pyx
Version: 2.0.0
Summary: Yet another bencode implementation in Cython
Home-page: https://github.com/whtsky/bencoder.pyx
Author: whtsky
Author-email: whtsky@gmail.com
License: BSDv3
Keywords: bencoding,encode,decode,bittorrent,bencode,bencoder,cython
Platform: POSIX
Platform: Windows
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Other Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Cython
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities

Bencoder.pyx
============

A fast bencode implementation in Cython supports both Python2 & Python3 .

.. image:: https://img.shields.io/travis/whtsky/bencoder.pyx/master.svg?maxAge=3600&label=macOS
    :alt: macOS Test Status
    :target: https://travis-ci.org/whtsky/bencoder.pyx
.. image:: https://img.shields.io/appveyor/ci/whtsky/bencoder-pyx/master.svg?maxAge=3600&label=Windows
    :alt: Windows Test Status
    :target: https://ci.appveyor.com/project/whtsky/bencoder-pyx
.. image:: https://img.shields.io/circleci/ci/whtsky/bencoder-pyx/master.svg?maxAge=3600&label=Linux
    :alt: Linux Test Status
    :target: https://circleci.com/gh/whtsky/bencoder.pyx
.. image:: https://img.shields.io/pypi/l/bencoder.pyx.svg
    :alt: PyPI License
    :target: https://pypi.org/project/bencoder.pyx/
.. image:: https://codecov.io/gh/whtsky/bencoder.pyx/branch/master/graph/badge.svg
    :alt: Codecov Coverage
    :target: https://codecov.io/gh/whtsky/bencoder.pyx
.. image:: https://pypistats.com/badge/bencoder-pyx.svg
    :alt: bencoder-pyx PyPI Downloads
    :target: https://pypistats.com/package/bencoder-pyx

Install
-------


.. code-block:: bash

    pip install bencoder.pyx


Usage
-----


.. code-block:: python

    from bencoder import bencode, bdecode, bdecode2

    assert bencode("WWWWWW") == b'6:WWWWWW'
    assert bencode(233) == b'i233e'

    with open("debian-8.3.0-amd64-netinst.iso.torrent", "rb") as f:
        torrent = bdecode(f.read())
        print(torrent['announce'])

    decoded, length = bdecode2(b'6:WWWWWWi233e')
    assert decoded == b'WWWWWW'
    assert length == 8

ChangeLog
----------

Version 2.0.0
~~~~~~~~~~~~~~~

+ Use built-in dict instead of OrderedDict on Python >= 3.7
+ Drop support for Python 3.3
+ Fix bytes parsing when used with python-future `#41 <https://github.com/whtsky/bencoder.pyx/pull/41>`_

Version 1.2.1
~~~~~~~~~~~~~~~

+ Drop support for Python 2.6
+ Performance boost for `bencode` method. `#7 <https://github.com/whtsky/bencoder.pyx/issues/7>`_

Version 1.2.0
~~~~~~~~~~~~~~~

+ Add `bdecode2` method. `#6 <https://github.com/whtsky/bencoder.pyx/pull/6>`_

Version 1.1.3
~~~~~~~~~~~~~~~

+ Performance Improvement
+ Fix package metainfo `#3 <https://github.com/whtsky/bencoder.pyx/issues/3>`_

Version 1.1.2
~~~~~~~~~~~~~~~

+ Support encode large int

Version 1.1.0
~~~~~~~~~~~~~~~

+ Use OrderedDict instaed of dict
+ Support encoding subclasses of dict


