I spent most of this past weekend (a long weekend in Canada, thanks to our royal heritage) writing documentation for the DebTorrent code. The original BitTornado code was seriously lacking in this area, having only 670 lines of comments out of almost 20,000 total lines of code, which is 3.5% if you're counting. (In fairness, this may be due in part to it being based on the original bittorrent client.)

Since Python is supposed to be known for it's well-documented code, I decided to tackle this shortcoming sooner rather than later. It's also a good opportunity for me to become familiar with all of the code. I'm only about halfway there, but the end result of my weekend's worth of work is this diffstat:

DebTorrent/BT1/Choker.py         |   99 ++++++++
DebTorrent/BT1/Connecter.py      |  313 +++++++++++++++++++++++++++
DebTorrent/BT1/Downloader.py     |  448 ++++++++++++++++++++++++++++++++++++++-
DebTorrent/BT1/Storage.py        |  418 ++++++++++++++++++++++++++++++++++--
DebTorrent/BT1/__init__.py       |    9
DebTorrent/BT1/btformats.py      |   47 ++++
DebTorrent/BTcrypto.py           |  147 ++++++++++++
DebTorrent/ConfigDir.py          |  248 +++++++++++++++++++++
DebTorrent/ConnChoice.py         |   12 -
DebTorrent/CurrentRateMeasure.py |   69 +++++-
DebTorrent/__init__.py           |   14 +
DebTorrent/bencode.py            |  193 ++++++++++++++++
DebTorrent/bitfield.py           |   89 +++++++
DebTorrent/clock.py              |   53 ++++
DebTorrent/download_bt1.py       |  380 ++++++++++++++++++++++++++++++++-
DebTorrent/inifile.py            |   70 ++++--
btcompletedir.py                 |   25 ++
btcopyannounce.py                |   20 +
btdownloadheadless.py            |  111 +++++++++
btlaunchmany.py                  |   56 ++++
btmakemetafile.py                |   19 +
btreannounce.py                  |    6
btrename.py                      |   11
btsethttpseeds.py                |    6
btshowmetainfo.py                |    6
bttrack.py                       |    6
setup.py                         |   20 +
27 files changed, 2809 insertions(+), 86 deletions(-)

I've also started using the epydoc program to automatically generate some documentation web pages for easy browsing of the code. So far it's worked out great! So well that I decided to use some of the new features available in a recent beta release that was not yet in the debian archive. The packaging seemed simple enough, so I created my own package containing the new upstream version, which is now available in my repository.