This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

This script allows you to easily download the open issues of a GitHub Repository and store them in a offline browsable, single standalone html file.

The name

I chose the name, because the obvious pun name “tissues” was already taken. It also fits, because being offline is somewhat oldfashioned, just like the word handkerchief.

There are three ways to set handkerchief up:

Using pip

This is the easiest way and probably the right choice for most people. Make sure you have pip installed and type

pip install handkerchief

into your terminal to install handkerchief and all dependencies onto your computer. This might require admin access.

You can now invoke handkerchief from everywhere using

handkerchief

In a virtualenv

If a system wide installation with pip is too intrusive for you, and you need handkerchief only in a certain environment, you can try virtualenv. Within the activated virtualenv, just type

pip install handkerchief

You can then invoke handkerchief while you are in the virtualenv by typing

handkerchief

As standalone script

You can take just the handkerchief.py from the repository and put it where you need it. No installation required. From there you can invoke it with

python handkerchief.py --remote-layouts

From repository

You can also clone the repository to some place on your computer and use it from there. Depending on your system, you might want to make it available from everywhere by putting the repo in your PATH, define an alias or something else.

For example, if you are on a mac you can optionally add the following to your ~/.bash_profile.

function handkerchief {
  # change this path to the location of handkerchief.py
  hand=~/handkerchief/handkerchief.py
  if [[ $1 != "" ]] ; then
    python $hand --remote-layouts $1
     else
    repo=$(git remote -v | head -n1 | awk '{print $2}' | sed -e 's,.*:\(.*/\)\?,,' -e 's/\.git$//')
    if [[ $repo == *https://* ]] ; then
      python $hand ${repo#https://github.com/}
    elif [[ $repo == *git@github.com* ]] ; then
      python $hand ${repo#git@github.com:}
    else
      echo "Provide parameter"
    fi
  fi
}

Specifying repositories

The simplest way to use handkerchief is to call it with the user or organisation and repository name

handkerchief jreinhardt/tissues

If you are calling handkerchief from within a git repository, it tries to figure out a GitHub repo for it

cd /path/to/repository
handkerchief

Or if you have one or many .html files generated by handkerchief in a directory, it extracts the repositories to check from them.

cd /path/to/directory/with/handkerchief/htmls
handkerchief

Commandline parameters

There are a few options available, for example to choose a layout, specify how to authenticate (to avoid GitHubs rate limits) and much more.

For details see

handkerchief --help`.

Layouts

Handkerchief offers a simple way to modify the visual appearance and functionality of the resulting offline html file, by changing to a different layout.

Handkerchief ships with a default layout that is available when installing with pip. For developing layouts it is convenient to ask handkerchief to search for layouts in a specific place using the –layout-dir. When using handkerchief as a standalone script, it can look layouts up at the handkerchief GitHub repository using the –remote-layouts option.

A layout consists of a parameter and a template file, and a number of javascript and css files, which reside in a subfolder of the layouts folder in the handkerchief repository. To produce the output file, the template file gets populated with the data, and the javascript and css files are inlined. If not told otherwise, handkerchief will fetch layouts from the handkerchief GitHub repository, so that always the most up to date version of the layout is used.

The parameter file is a json file with the same name as the subfolder in which it resides. It contains an associative array with three keys:

  • html: the file name of the template file
  • css: a list of filenames of stylesheets to inline
  • js: a list of filenames of javascript files to inline

The template is processed by Jinja2, and the following variables are available:

  • reponame: a string with the name of the repository in the form username/reponame
  • repo: a dictionary containing information about the repository, see GitHub API docs (1)
  • issues: a list of dictionaries containing issue data, see GitHub API docs (2). Each issue has an additional field: - ‘labelnames’ with a list of all labels for this issue
    • ‘comments_list’ with a list of all comments for this issue (see GitHub API docs (3)). The comment data is augmented by a string in comment[‘user’][‘avatar_class’] which contains a css class that sets the avatar of the user as background image of the element.
    • issue[‘user’][‘avatar_class’] which works in the same way as in comments.
  • labels: a list of dictionaries containing label data, see GitHub API docs (4)
  • milestones: a list of dictionaries containing milestone data, see GitHub API docs (5)
  • assignees: a list of dictionaries contining information about assigness, see GitHub API docs (6)
  • javascript: a list of dictionaries with the names and contents of the javascript files.
  • stylesheets: a list with the contents of the stylesheets. Additionally it contains a stylesheet that defines classes of the form avatar_username that set the avatar of a user as background image of an element.

If you have created a new layout or improved a existing one, feel free to open a pull request, contributions are always welcome!

Dependencies

Requires Python 2.7, the Jinja2 template system and the requests library.

For most Linux distributions, these should be available via the package manager. On MacOS you can install the dependencies by:

# using homebrew
brew install python
# using pip
pip install -r requirements.txt

For Windows there is an installer for Python available from the Python Website, and the rest can be installed via pip:

pip install -r requirements.txt

Contributors

There are a few people that contributed to handkerchief and therefore deserve to credit:

  • lukasoppermann turned the initial HTML template from horrible to beauti- and useful
  • laurentj contributed several small layout fixes
  • DonnchaC added code for authenticating by token
  • philfreo contributed a requirements.txt

License

Handkerchief is licensed under the MIT license

The MIT License (MIT)

Copyright (c) 2013 Johannes Reinhardt <jreinhardt@ist-dein-freund.de>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Release History

Release History

0.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
handkerchief-0.2-py2-none-any.whl (752.6 kB) Copy SHA256 Checksum SHA256 py2 Wheel Mar 10, 2016
handkerchief-0.2.tar.gz (748.7 kB) Copy SHA256 Checksum SHA256 Source Mar 10, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting