{"id":20333846,"url":"https://github.com/laurenzbeck/gists","last_synced_at":"2025-04-11T21:44:57.977Z","repository":{"id":246807322,"uuid":"823486760","full_name":"LaurenzBeck/gists","owner":"LaurenzBeck","description":"🐍📦 this Python package provides a very convenient way to import GitHub gists in a pythonic way using `import` statements.","archived":false,"fork":false,"pushed_at":"2024-07-03T07:42:40.000Z","size":78,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T17:49:25.927Z","etag":null,"topics":["deployment","gists","github","import","publishing","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LaurenzBeck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-03T06:06:54.000Z","updated_at":"2024-09-19T23:03:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"11d60305-b165-4e13-a5ab-113c04a02bc9","html_url":"https://github.com/LaurenzBeck/gists","commit_stats":null,"previous_names":["laurenzbeck/gists"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaurenzBeck%2Fgists","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaurenzBeck%2Fgists/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaurenzBeck%2Fgists/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaurenzBeck%2Fgists/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LaurenzBeck","download_url":"https://codeload.github.com/LaurenzBeck/gists/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248487509,"owners_count":21112187,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deployment","gists","github","import","publishing","python"],"created_at":"2024-11-14T20:33:29.534Z","updated_at":"2025-04-11T21:44:57.954Z","avatar_url":"https://github.com/LaurenzBeck.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg alt=\"treasure chest banner image\" src=\"https://github.com/LaurenzBeck/gists/blob/main/docs/artwork/isometric_chest_by_sephiroth_art_da0mr89-375w-2x.jpg?raw=true\"\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003e🐍📦 Python Gists Importing\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://pypi.org/project/python-gists-import/\"\u003e\u003cimg alt=\"Static Badge\" src=\"https://img.shields.io/badge/📦_version-1.0.2-blue\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.python.org/\"\u003e\u003cimg alt=\"Python\" src=\"https://img.shields.io/badge/Python-3.11-yellow?logo=python\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://python-poetry.org/\"\u003e\u003cimg alt=\"Poetry\" src=\"https://img.shields.io/badge/Poetry-1.8.3-blue?logo=Poetry\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/astral-sh/ruff\"\u003e\u003cimg alt=\"Ruff\" src=\"https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.repostatus.org/#active\"\u003e\u003cimg src=\"https://www.repostatus.org/badges/latest/active.svg\" alt=\"Project Status: Active – The project has reached a stable, usable state and is being actively developed.\" /\u003e\u003c/a\u003e\n    \u003cimg alt=\"Static Badge\" src=\"https://badges.frapsoft.com/os/v3/open-source.svg\"\u003e\n    \u003ca href=\"https://opensource.org/license/mit/\"\u003e\u003cimg alt=\"MIT\" src=\"https://img.shields.io/badge/🗝️_license-MIT-blue\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/LaurenzBeck/gists?tab=readme-ov-file#-usage\"\u003e📦 Usage\u003c/a\u003e •\n  \u003ca href=\"https://github.com/laurenzbeck/gists?tab=readme-ov-file#-installation\"\u003e🐍 Installation\u003c/a\u003e •\n  \u003ca href=\"https://github.com/laurenzbeck/gists?tab=readme-ov-file#-motivation\"\u003e💡 Motivation\u003c/a\u003e •\n  \u003ca href=\"https://github.com/laurenzbeck/gists?tab=readme-ov-file#-publishing-a-gist\"\u003e🆙 Publishing a Gist\u003c/a\u003e\n\u003c/p\u003e\n\n## 📦 Usage\n\nThis package provides a very convenient way to import [GitHub gists](https://docs.github.com/de/get-started/writing-on-github/editing-and-sharing-content-with-gists) directly from Python:\n\n```python\nfrom gists import \u003cgist_id\u003e\n```\n\nThe first time a gist is imported this way, it will be downloaded using GitHub's API and saved locally as `gists/\u003cgist_id\u003e.py` (The description of the gist will be saved as `gists/\u003cgist_id\u003e.md`). Every subsequent import will not require internet access, as the local copy of the gist will be used.\n\n## 🐍 Installation\n\nThe [package](https://pypi.org/project/python-gists-import/) is published on PyPi, so it can be installed with pip using:\n\n```sh\n$pip install python-gists-import\n```\n\n## 💡 Motivation\n\nDuring my PhD, I had many ideas and felt confident to work on a few full packages. I discovered that developing packages and everything that comes with them requires a lot of effort and diverse skills including:\n\n+ managing dependencies\n+ configuring linters, formatters, task runners ...\n+ setting up CI/CD, pre-commit\n+ writing technical documentation\n+ planning your code organization and namespaces\n+ implementing your ideas\n+ testing your implementation\n+ choosing evocative artwork and emojis 😉\n+ choosing a license\n+ preparing a repository for contributions by adhering to [community guidelines](https://docs.github.com/en/site-policy/github-terms/github-community-guidelines)\n\nOne also has to be creative and lucky in finding a short and fitting name, that is still available on PyPi.\n\nThat the motivation and energy for working on personal projects and ideas often comes in bursts, does not help either.\n\nWhile writing a proper Python package is without a doubt the appropriate way to implement and share your moderately complex ideas, smaller ideas suffer from a few problems:\n\n+ the package development overhead is too high\n+ bundling all of your ideas into one utility package can quickly become chaotic\n+ how do you properly name and advertise a package consisting of a single class or function?\n\n[GitHub gists](https://docs.github.com/en/get-started/writing-on-github/editing-and-sharing-content-with-gists/creating-gists#about-gists) provide a lightweight deployment alternative to building and publishing a package on PyPi. The user experience of creating and managing them is as easy as it can get (amazing work there 💖). Another big advantage is the guaranteed collision-free (though arguably un-relatable) \"package name\", you get from the gist id.\n\nNo one stops you from just downloading a gist manually and placing it in your codebase, but there are other alternatives. [`gist-import`](https://github.com/matteoferla/gist-import/tree/main) is a package very similar in functionality to this one (shout-out to https://github.com/matteoferla for his work on the package 💪). I even use it in the background because it already contained the gist fetching logic 😅. I recently watched a [PyCon talk](https://www.youtube.com/watch?v=ItOUx7zTcgo) where the Python import machinery was explained in detail, and I simply wanted to play around with the new concepts in my free time.\n\n## 🆙 Publishing a Gist\n\nGitHub has good [documentation on how to create and manage gists](https://docs.github.com/en/get-started/writing-on-github/editing-and-sharing-content-with-gists/creating-gists) 📖.\n\nI will give some additional considerations that are often overlooked.\n\n### 🗝️ Licensing\n\nWhen you want your gist to be used by as many people as possible, it is important to add a license to your gists.\n\n\u003e 🤚 If you want an uncomplicated license that gives your users a lot of freedom, the [MIT license](https://opensource.org/license/mit) is a good default choice.\n\nAccording to a [blog post](https://zebracatzebra.com/oss/getting-the-gist-of-github-gist-licensing/) from Jeff Luszcz there are two good options:\n\n+ state a default license in the README of your GitHub profile\n+ state the license in the gist itself\n\nBecause the full license text can be quite large, which would diminish the visual appeal of shorter gists, one can also just mention the name of the license with a copyright date and the copyright owner.\n\nI included an example of this approach in the [📝 Template](https://github.com/laurenzbeck/gists?tab=readme-ov-file#-template)\n\n### 📖 Referencing\n\nUnfortunately, [getting a DOI](https://docs.github.com/de/repositories/archiving-a-github-repository/referencing-and-citing-content) (document object identifier) from Zenodo only works with repositories.\n\nYou can, however, include a bibitem in the description of your gist (see the [📝 Template](https://github.com/laurenzbeck/gists?tab=readme-ov-file#-template)):\n\n```bibtex\n@misc{\u003cbibkey\u003e,\n  author={\u003cyour name\u003e},\n  title={\u003cthe title of your gist\u003e},\n  year={\u003cyear of publication\u003e},\n  url={https://gist.github.com/\u003cuser name\u003e/\u003cgist id\u003e},\n} \n```\n\n### 📝 Template\n\n#### Description\n\n````markdown\n# Title\n\n\u003e 🚮 feel free to delete any section that is not helpful for your description (including this message).\n\nShort description.\n\n## 📦 Usage\n\nHow to use the gist with code examples.\n\n## 🤔 Statement of Need\n\nDescribe why the code in your gist is needed.\n\n## 🐍 Installation\n\nThis gist can be installed using the [`python-gists-import`]() package:\n\n```sh\n$pip install python-gists-import\n``` \n\nAfter that, simply import the gist in your code via:\n\n```python\nfrom gists import \u003cgist id\u003e\n```\n\n### 📄 Requirements\n\nIf your gist depends on other Python packages, include a list of those dependencies here. Users have to manually make sure that they have these dependencies installed. I would suggest using version specifiers used by [poetry](https://python-poetry.org/docs/dependency-specification/):\n\n```toml\npython = \"^3.11\"\n```\n\n## 🗝️ License and Copyright ©️\n\nThe code inside this gist is licensed under the [MIT](https://opensource.org/license/mit) license.\n\nCopyright \u003cYEAR\u003e \u003cCOPYRIGHT HOLDER\u003e\n\n## 📝 Cite Me\n\n```bibtex\n@misc{\u003cbibkey\u003e,\n  author={\u003cyour name\u003e},\n  title={\u003cthe title of your gist\u003e},\n  year={\u003cyear of publication\u003e},\n  url={https://gist.github.com/\u003cuser name\u003e/\u003cgist id\u003e},\n}\n```\n\n````\n\n#### Code\n\n```python\n\"\"\"# module title\n\nmodule description.\n\"\"\"\n# Copyright \u003cYEAR\u003e \u003cCOPYRIGHT HOLDER\u003e\n#\n# Licensed under the [MIT](https://opensource.org/license/mit) license.\n\ndef hello(name: str = \"world\") -\u003e None:\n  \"\"\"🗣️ says hello to `name`.\"\"\"\n  print(f\"hello, {name}!\")\n```\n\n---\n\n## 🖼️ ©️ Banner Artwork Attribution\n\n\u003ca rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc-nd/3.0/\"\u003e\u003cimg alt=\"Creative Commons License\" style=\"border-width:0\" src=\"https://i.creativecommons.org/l/by-nc-nd/3.0/88x31.png\" /\u003e\u003c/a\u003e\u003cbr /\u003eThe art in the banner of this README is licensed under a [Creative Commons Attribution-NonCommercial-No Derivatives Works 3.0 License](https://creativecommons.org/licenses/by-nc-nd/3.0/). It was made by [sephiroth-art](https://www.deviantart.com/sephiroth-art). Check out his beautiful artwork ❤️\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaurenzbeck%2Fgists","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaurenzbeck%2Fgists","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaurenzbeck%2Fgists/lists"}