{ "info": { "author": "Opal Symes", "author_email": "python@opal.codes", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "# A Python port of GitHub's [Octicons](https://octicons.github.com/) for [Django](https://www.djangoproject.com/).\n\nOcticons version: [v9.1.0](https://github.com/primer/octicons/releases/tag/v9.1.0)\n\nInstall this package from [PyPI](https://pypi.org/project/octicons/) using `pip` or your favorite Python package manager:\n\n```\n$ pip install octicons\n```\n\n## API\n\nThis package comes with the Octicons `data.json` built-in but you are not limited to using it.\n\n### `octicons.store.default_store`\n\nThis is an `OcticonsStore` instance that loads the built-in data set. Use this unless you *really* need to use another.\n\n### `octicons.octicons.OcticonStore`\n\nThis object handles creating and aliasing individual `Octicons`. You won't need to create an instance of this unless you have a special use-case, or are loading your own `data.json` file. \n\n- `OcticonStore.from_file(file=None)`(classmethod) -- Create an `OcticonsStore` instance by loading the given file(or the built-in file in `file` is not given). \n- `OcticonStore(data_dict, *, Octicon=Octicon)` -- Create an `OcticonsStore` instance using the `data_dict` given. Here you can also override the `Octicons` class used to create each icon instance. \n\n- `store.get_icon(name)`, `store[name]` -- Get the octicon with the name or alias of `name`. Returns an `Octicons` instance.\n- `store.get_as_html(name, **opts)` -- A convenience method which gets the icon's instance; then calls `as_html` on that instance; passing any keyword arguments through to that call.\n\n### `octicons.octicons.Octicon`\n\nThis is an instance of a single icon. Instances are built as part of the `__init__` method of `OcticonsStore`.\n\n- `Octicons(data)` -- Create an icon instance using the information contained in the `data` dictionary.\n\n- `icon.width`, `icon.height` -- The floating-point width and height the output SVG should be.\n- `icon.path` -- A string representing the SVG path that creates the icon.\n- `icon.name` -- Used to construct the correct `class` when generating the HTML.\n- `icon.keywords` -- A list of the supported icon aliases.\n- `icon.size_ratio` -- The ratio(`width/height`) between the width and the height of the icon. This is used when only one of `width` or `height` are specified to `as_html`.\n\n- `icon.as_html(**opts)` -- Build HTML from the icon's information and the given options:\n - `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.\n - `class`, `classes` -- Either a string or an iterable of strings to *append* to the default classes(`octicons` and `octicons-{self.name}`)\n - `aria_label` -- Makes the icon visible to screen-readers and changes the icon's role to `img`.\n - All other arguments will have `_`s replaced with `-` and added to the `` tag\n\nExamples(paths snipped for brevity):\n```\n>>> from octicons.store import default_store\n>>> default_store.get_as_html('like', id=\"my-like-button\")\n''\n>>> default_store.get_as_html('like', classes=\"special\", width=200)\n''\n>>> default_store.get_as_html('like', width=20, height=400, aria_label=\"Tall like button\")\n''\n```\n\n## Django API\n\nTo use, add `'octicons'` to your `INSTALLED_APPS` list; then in your templates:\n\n```\n{% load octicons %}\n\n{% octicon 'check' %}\n
\n{% octicon 'like' width=100 color=\"blue\" class=\"facebook-like\" %}\n
\n{% octicon 'gift' height=\"10\" aria_label='This is a gift for you <3' %}\n```\n\nThis is exactly equivalent to importing the `default_store` and calling `get_as_html`. Check that method's documentation for information on how it handles arguments.\n\n## Overriding the default `data.json` file\n\nThere may be circumstances where the built-in data file is not what you're after. In that case you can use `OpticonStore.from_file` to load another `data.json` file. To get the `data.json` file for a specific version of Octicons you can copy it from the `build/data.json` of the [`octicons` npm package](https://www.npmjs.com/package/octicons). Have a look at the `update_data_json.sh` file for how to do that.\n\n## Extending\n\nObviously 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:\n\n```\n{\n \"plus\": {\n \"name\": \"plus\",\n \"keywords\": [\"add\", \"new\", \"more\"],\n \"width\":12,\n \"height\":16,\n \"path\":\"\"\n },\n ...\n}\n```\n\n## Versioning\n\nThis 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.PATCH`\n\nBreaking changes such as changing either the Django or Python API will increment the `MAJOR` version. As will upgrading Octicons to a new major version(e.g. Octicons 9.x.x). The `MINOR.PATCH` will 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.\n\nIf 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.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/leesdolphin/octicons", "keywords": "", "license": "LGPLv3+", "maintainer": "", "maintainer_email": "", "name": "octicons", "package_url": "https://pypi.org/project/octicons/", "platform": "", "project_url": "https://pypi.org/project/octicons/", "project_urls": { "Homepage": "https://github.com/leesdolphin/octicons" }, "release_url": "https://pypi.org/project/octicons/2.1.0/", "requires_dist": null, "requires_python": ">=3.4", "summary": "A Python port of GitHub's Octicons, with Django support", "version": "2.1.0" }, "last_serial": 5422774, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "b628f6dc5d68c58a1e696088fed9f2c7", "sha256": "9a5be41ef2ab69e7a944a93c7d1760258d5023f5e0fed16ea3845d557132be4e" }, "downloads": -1, "filename": "octicons-0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b628f6dc5d68c58a1e696088fed9f2c7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.4", "size": 29924, "upload_time": "2018-08-28T06:55:46", "url": "https://files.pythonhosted.org/packages/4f/3a/82fc0d7b93d0576f2a7810cac9bf45eb3dd8a9a8c7c0bd7e2df8b4d54a43/octicons-0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4ea0fd03fe67df36dc5e7042e54f6b63", "sha256": "19f5d6367921627eb8ac706a6f2296fc26ff49e23fd5dc21cb9fc0e3d48484f9" }, "downloads": -1, "filename": "octicons-0.1.tar.gz", "has_sig": false, "md5_digest": "4ea0fd03fe67df36dc5e7042e54f6b63", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 29625, "upload_time": "2018-08-28T06:55:48", "url": "https://files.pythonhosted.org/packages/25/c9/53f3dcec106d89490b3776b63c302dde8ae312b2755423c930f693015afd/octicons-0.1.tar.gz" } ], "1.4.2": [ { "comment_text": "", "digests": { "md5": "844d195cade877bb128d4f72faaf7395", "sha256": "a3396dbc8676e312fa3853baea7ffaac811f7865c19dedd4c9738cc1f9b5db5b" }, "downloads": -1, "filename": "octicons-1.4.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "844d195cade877bb128d4f72faaf7395", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.4", "size": 32537, "upload_time": "2019-02-21T06:47:42", "url": "https://files.pythonhosted.org/packages/26/17/430a40d313eca07628a24e65b03bf8898ff4f5c6435db8b96b7e9fc09aa1/octicons-1.4.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a908443766bfe2aee533819c0a52b657", "sha256": "2a1a3041c9a3e450123940d25486e66f1e1f3d1de0b439c64709d3c8b2e4849a" }, "downloads": -1, "filename": "octicons-1.4.2.tar.gz", "has_sig": false, "md5_digest": "a908443766bfe2aee533819c0a52b657", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 34917, "upload_time": "2019-02-21T06:47:44", "url": "https://files.pythonhosted.org/packages/01/f1/6dfcc5a9ffd53494dd719542a0288647bcdfdcc5c3ddf5f806ec246d5141/octicons-1.4.2.tar.gz" } ], "2.1.0": [ { "comment_text": "", "digests": { "md5": "fc3333717913eb389ad486fcd10f66b0", "sha256": "f9b79045431bf99ada579b1778ec1588f2a6e8baa5ad6a4d3ae0c55c2e5cd00d" }, "downloads": -1, "filename": "octicons-2.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "fc3333717913eb389ad486fcd10f66b0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.4", "size": 33404, "upload_time": "2019-06-19T21:31:27", "url": "https://files.pythonhosted.org/packages/a9/d2/1ec3250adee5c554ba44cd752319a56812a9684ed5c770df096f8f25c5bc/octicons-2.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f8d165555bbfc7ea99ad3e74c9005e9f", "sha256": "0ecb592a60c78e40d21d81d66966088e8f308e53cc018c6d66bd208932418c35" }, "downloads": -1, "filename": "octicons-2.1.0.tar.gz", "has_sig": false, "md5_digest": "f8d165555bbfc7ea99ad3e74c9005e9f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 35622, "upload_time": "2019-06-19T21:31:29", "url": "https://files.pythonhosted.org/packages/6e/11/0d80044db76476431e38a0d1c0f95dd165321c8094eb32a11217be7ff6ae/octicons-2.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fc3333717913eb389ad486fcd10f66b0", "sha256": "f9b79045431bf99ada579b1778ec1588f2a6e8baa5ad6a4d3ae0c55c2e5cd00d" }, "downloads": -1, "filename": "octicons-2.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "fc3333717913eb389ad486fcd10f66b0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.4", "size": 33404, "upload_time": "2019-06-19T21:31:27", "url": "https://files.pythonhosted.org/packages/a9/d2/1ec3250adee5c554ba44cd752319a56812a9684ed5c770df096f8f25c5bc/octicons-2.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f8d165555bbfc7ea99ad3e74c9005e9f", "sha256": "0ecb592a60c78e40d21d81d66966088e8f308e53cc018c6d66bd208932418c35" }, "downloads": -1, "filename": "octicons-2.1.0.tar.gz", "has_sig": false, "md5_digest": "f8d165555bbfc7ea99ad3e74c9005e9f", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 35622, "upload_time": "2019-06-19T21:31:29", "url": "https://files.pythonhosted.org/packages/6e/11/0d80044db76476431e38a0d1c0f95dd165321c8094eb32a11217be7ff6ae/octicons-2.1.0.tar.gz" } ] }