{"id":19724355,"url":"https://github.com/jungerm2/jupyterlazyloader","last_synced_at":"2026-05-15T14:31:17.567Z","repository":{"id":83530272,"uuid":"336122572","full_name":"jungerm2/JupyterLazyLoader","owner":"jungerm2","description":"Lazy module importer for Jupyter","archived":false,"fork":false,"pushed_at":"2021-02-11T23:24:47.000Z","size":7,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T01:13:44.166Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/jungerm2.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":"2021-02-05T00:44:10.000Z","updated_at":"2023-04-05T15:44:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"49ab32f2-f010-408b-a284-4dd92242c1fa","html_url":"https://github.com/jungerm2/JupyterLazyLoader","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jungerm2/JupyterLazyLoader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jungerm2%2FJupyterLazyLoader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jungerm2%2FJupyterLazyLoader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jungerm2%2FJupyterLazyLoader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jungerm2%2FJupyterLazyLoader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jungerm2","download_url":"https://codeload.github.com/jungerm2/JupyterLazyLoader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jungerm2%2FJupyterLazyLoader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33069754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-11T23:25:35.373Z","updated_at":"2026-05-15T14:31:17.551Z","avatar_url":"https://github.com/jungerm2.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JupyterLazyLoader\n\n![Python Version](https://img.shields.io/badge/python-3.8%2B-blue?style=flat-square)\n\nI often have a ton of standard imports which slow down startup time. As a matter of style, I usually import all of these at once at the start of the notebook. This allows me to quickly see all relevant imports and not move imports around as needed. But this is wasteful as I don't usually need all of them to be loaded immediatly. Therefore it would be ideal if the modules where lazy loaded. \n\nTo my surprise the only \"solution\" to this is [this project](https://github.com/8080labs/pyforest) which I dislike for a few reasons:\n - There's a lot of modules it can implicitely import for you, but you need to know which ones these are or configure extra modules yourself\n - When you import a module, it automatically edits a jupyter cell. This is horrible for version control and seems like a bad idea overall.\n - The way it installs is quite invasive (it auto enables itself by default) and it's hard to uninstall fully.\n \n So here's an alternative that is much simpler (less than 50 loc) and works like so:\n \n ```python \n%%lazyimport\n\nfrom functools import (\n    partial, \n    lru_cache\n)\n\nfrom collections import defaultdict, OrderedDict, deque\nimport numpy as np\nimport pandas as pd \nimport matplotlib.pyplot as plt\n```\n\nThis will create placeholders instead of actually importing the module, and as soon as you interact with the module or use it in ay way, it will be dynamically imported. Simple! An added side effect is that if you don't end up using one of the packages it won't get imported!\n\nTo use it, you'll need to either load the extension:\n\n```python\n%load_ext lazyimport\n```\n\nor place it in jupyter's startup directory which you can find by running the following: \n\n```python\nget_ipython().profile_dir.startup_dir\n```\n\n\u003e _**Note:**_ This does not work with wildcard imports such as `from sklearn import *`. This is due to python's import dynamics, and besides, wildcard imports are usually a bad idea.\n\n_*Remark:*_ Yes, this extensions actually adds the modules to `builtins` instead of to `__main__`'s globals. This is simply because globals aren't shared between modules so the lazy importer cannot access them. Let me know if you know a more elegant solution!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjungerm2%2Fjupyterlazyloader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjungerm2%2Fjupyterlazyloader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjungerm2%2Fjupyterlazyloader/lists"}