Skip to main content

badge image class

Project description

Install

$ [sudo] pip install badges

Features

  • md, rst support
  • autoformat strings with instance and class variables
  • minimalistic design, easy subclassing
  • CircleCI, Travis, ... badge classes

Examples

# format attributes - {attrname}
>>> class CustomBadge(badges.Badge):
    branch = "master"
    link = "https://site.com/{fullname}"
    image = "https://site.com/{fullname}?branch={branch}.svg"

>>> CustomBadge(fullname="owner/repo")
'[![](https://site.com/owner/repo?branch=master.svg)](https://site.com/owner/repo)'

# format @property - {0.propname}
>>> class CustomBadge(badges.Badge):
    branch = "master"
    link = "https://site.com/{0.fullname}"
    image = "https://site.com/{0.fullname}?branch={branch}.svg"

    @property
    def fullname(self):
        return "/".join(os.getcwd().split("/")[-2:])

>>> CustomBadge()
'[![](https://site.com/owner/repo?branch=master.svg)](https://site.com/owner/repo)'

Sources

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for badges, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size badges-0.0.1.tar.gz (3.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page