{ "info": { "author": "Mohit Solanki", "author_email": "mohit@deepsource.io", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "
\n \n
\n Documentation |\n Get Started |\n Developer Chat\n
\n\n\n DeepSource helps you ship good quality code.\n
\n\n\n\n---\n\n# import-x\n\nAn ext-tensible loader to import anything like it is a python module.\n\nSupports Python **3.6+**.\n\n## Installation\n\n```\npip install import-x\n```\n\n## Usage\n\nExample json file in your path ``foo.json``:\n\n```json\n {\n \"why\": \"not\",\n }\n```\n\n```python\n # Extend the ExtensionLoader and implement 'handle_module' method\n # where you will get a module object and the path to that module.\n\n >>> from import_x import ExtensionLoader\n\n >>> class JsonLoader(ExtensionLoader):\n extension = '.json'\n\n auto_enable = False\n\n @staticmethod\n def handle_module(module, path):\n \"\"\"\n Load the json file and set as `data` attribute of the module.\n \"\"\"\n json_file = Path(path)\n content = json_file.read_text()\n try:\n data = json.loads(content)\n except (json.JSONDecodeError, ValueError):\n data = {}\n module.data = data\n\n >>> json_imports = JsonLoader()\n >>> with json_imports:\n import foo\n >>> foo.data\n >>> {\"why\": \"not\"}\n```\n\nIf you want to enable imports automatically without the context_manager then just\ndo ``auto_enable = True`` in your loader.\n\nThis Example ``JsonLoader`` can be used directly by importing\n\n```python\n from import_x.loaders.json_loader import JsonLoader\n```\n\nand you are ready to import all the json files.\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/deepsourcelabs/import-x", "keywords": "import machinary,import hook,import-x", "license": "MIT", "maintainer": "Mohit Solanki", "maintainer_email": "mohit@deepsource.io", "name": "import-x", "package_url": "https://pypi.org/project/import-x/", "platform": "", "project_url": "https://pypi.org/project/import-x/", "project_urls": { "Documentation": "https://github.com/deepsourcelabs/import-x", "Homepage": "https://github.com/deepsourcelabs/import-x", "Repository": "https://github.com/deepsourcelabs/import-x" }, "release_url": "https://pypi.org/project/import-x/0.1.1/", "requires_dist": null, "requires_python": ">=3.6,<4.0", "summary": "Import non-python files", "version": "0.1.1" }, "last_serial": 5832753, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "eec747eb41b783d9cfbeee797f6890a9", "sha256": "77d7477301edc2ef52e272578d8630882bc6fd6849b913de19869f3424d51748" }, "downloads": -1, "filename": "import_x-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "eec747eb41b783d9cfbeee797f6890a9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 4079, "upload_time": "2019-04-29T15:20:37", "url": "https://files.pythonhosted.org/packages/f4/59/168396b38b48e5acd8a79f3255c0d5f58b7d6b8de0c303292b331e30165b/import_x-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "27f2241a44c3182b6b4d303d1aa05069", "sha256": "fe4bb774d65dd97470cc32f5427479397a028a430891de7d24cc418e66c2363e" }, "downloads": -1, "filename": "import-x-0.1.0.tar.gz", "has_sig": false, "md5_digest": "27f2241a44c3182b6b4d303d1aa05069", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 3573, "upload_time": "2019-04-29T15:20:05", "url": "https://files.pythonhosted.org/packages/33/31/ff5f100f2ef7725b350f66b8570ae5e369c9fd830c7015523dd188c6ebeb/import-x-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "6f2056dd73bf7ddab6e7c6f481de739c", "sha256": "cfd7c9503b0aeb95d23fb80193964b7874fd5c2bf24f136a4a92f4c03b391990" }, "downloads": -1, "filename": "import_x-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "6f2056dd73bf7ddab6e7c6f481de739c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 4337, "upload_time": "2019-09-15T18:29:49", "url": "https://files.pythonhosted.org/packages/06/26/4535a64bb032bab4866e1d08be609152736e05691c2f852d0ca5d17944e0/import_x-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ef39dafdc93b1b93a23041bf95a059c3", "sha256": "9b9b603b280f553eb075a01f877b9f1afa1de045b41d10508b667c2311324e2d" }, "downloads": -1, "filename": "import-x-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ef39dafdc93b1b93a23041bf95a059c3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 3887, "upload_time": "2019-09-15T18:29:46", "url": "https://files.pythonhosted.org/packages/aa/b3/8322b911337b4ad4a8c31a6679afcb9050b1086e1bbab4163525fec51c5f/import-x-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6f2056dd73bf7ddab6e7c6f481de739c", "sha256": "cfd7c9503b0aeb95d23fb80193964b7874fd5c2bf24f136a4a92f4c03b391990" }, "downloads": -1, "filename": "import_x-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "6f2056dd73bf7ddab6e7c6f481de739c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 4337, "upload_time": "2019-09-15T18:29:49", "url": "https://files.pythonhosted.org/packages/06/26/4535a64bb032bab4866e1d08be609152736e05691c2f852d0ca5d17944e0/import_x-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ef39dafdc93b1b93a23041bf95a059c3", "sha256": "9b9b603b280f553eb075a01f877b9f1afa1de045b41d10508b667c2311324e2d" }, "downloads": -1, "filename": "import-x-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ef39dafdc93b1b93a23041bf95a059c3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 3887, "upload_time": "2019-09-15T18:29:46", "url": "https://files.pythonhosted.org/packages/aa/b3/8322b911337b4ad4a8c31a6679afcb9050b1086e1bbab4163525fec51c5f/import-x-0.1.1.tar.gz" } ] }