Package: octicons
A Python port of GitHub'sOcticonsforDjango.Octicons version:v9.1.0Install this package fromPyPIusingpipor your favorite Python package manager:$ pip install octiconsAPIThis package comes with the Octiconsdata.jsonbuilt-in but you are not limited to using it.octicons.store.default_storeThis is anOcticonsStoreinstance that loads the built-in data set. Use this unless youreallyneed to use another.octicons.octicons.OcticonStoreThis object handles creating and aliasing individualOcticons. You won't need to create an instance of this unless you have a special use-case, or are loading your owndata.jsonfile.OcticonStore.from_file(file=None)(classmethod) -- Create anOcticonsStoreinstance by loading the given file(or the built-in file infileis not given).OcticonStore(data_dict, *, Octicon=Octicon)-- Create anOcticonsStoreinstance using thedata_dictgiven. Here you can also override theOcticonsclass used to create each icon instance.store.get_icon(name),store[name]-- Get the octicon with the name or alias ofname. Returns anOcticonsinstance.store.get_as_html(name, **opts)-- A convenience method which gets the icon's instance; then callsas_htmlon that instance; passing any keyword arguments through to that call.octicons.octicons.OcticonThis is an instance of a single icon. Instances are built as part of the__init__method ofOcticonsStore.Octicons(data)-- Create an icon instance using the information contained in thedatadictionary.icon.width,icon.height-- The floating-point width and height the output SVG should be.icon.path-- A string representing the SVG path that creates the icon.icon.name-- Used to construct the correctclasswhen generating the HTML.icon.keywords-- A list of the supported icon aliases.icon.size_ratio-- The ratio(width/height) between the width and the height of the icon. This is used when only one ofwidthorheightare specified toas_html.icon.as_html(**opts)-- Build HTML from the icon's information and the given options:width/height-- If none are given; then use the icons width/height. If one is given; use it to calculate the missing dimension such that it maintains the aspect ratio. If both are given then use those values exactly.class,classes-- Either a string or an iterable of strings toappendto the default classes(octiconsandocticons-{self.name})aria_label-- Makes the icon visible to screen-readers and changes the icon's role toimg.All other arguments will have_s replaced with-and added to the<svg>tagExamples(paths snipped for brevity):>>> from octicons.store import default_store
>>> default_store.get_as_html('like', id="my-like-button")
'<svg version="1.1" width="16" height="16" viewBox="0 0 16 16" class="octicon octicon-thumbsup" aria-hidden="true" id="my-like-button"><path ...snip.../></svg>'
>>> default_store.get_as_html('like', classes="special", width=200)
'<svg version="1.1" width="200" height="200.0" viewBox="0 0 16 16" class="octicon octicon-thumbsup special" aria-hidden="true"><path ...snip.../></svg>'
>>> default_store.get_as_html('like', width=20, height=400, aria_label="Tall like button")
'<svg version="1.1" width="20" height="400" viewBox="0 0 16 16" class="octicon octicon-thumbsup" aria-label="Tall like button" role="img"><path ...snip.../></svg>'Django APITo use, add'octicons'to yourINSTALLED_APPSlist; then in your templates:{% load octicons %}

{% octicon 'check' %}
<br />
{% octicon 'like' width=100 color="blue" class="facebook-like" %}
<br />
{% octicon 'gift' height="10" aria_label='This is a gift for you <3' %}This is exactly equivalent to importing thedefault_storeand callingget_as_html. Check that method's documentation for information on how it handles arguments.Overriding the defaultdata.jsonfileThere may be circumstances where the built-in data file is not what you're after. In that case you can useOpticonStore.from_fileto load anotherdata.jsonfile. To get thedata.jsonfile for a specific version of Octicons you can copy it from thebuild/data.jsonof theocticonsnpm package. Have a look at theupdate_data_json.shfile for how to do that.ExtendingObviously the name and the naming scheme implies tight integration with Octicons; however this is not necessarily the case. All that is needed is a JSON file with a dictionary of icons, for example:{
  "plus": {
    "name": "plus",
    "keywords": ["add", "new", "more"],
    "width":12,
    "height":16,
    "path":"<path fill-rule=\"evenodd\" d=\"M12 9H7v5H5V9H0V7h5V2h2v5h5v2z\"/>"
  },
  ...
}VersioningThis project follows Semantic versioning, ish. Due to the need to track 2 separate versions, the API and the Octicons themselves, versioning will be as follows:MAJOR.OCTICONS_MINOR.OCTICONS_PATCH.PATCHBreaking changes such as changing either the Django or Python API will increment theMAJORversion. As will upgrading Octicons to a new major version(e.g. Octicons 9.x.x). TheMINOR.PATCHwill use the Octicons minor and patch as that is the most useful information. The final field will be added when bug-fixes or patches are made that don't change the Octicons version.If you have a better solution feel free to open an issue/PR. Chances are it'll be better than this franken-versioning scheme I came up with.