{"id":13398249,"url":"https://github.com/kragniz/json-sempai","last_synced_at":"2025-05-15T18:05:45.114Z","repository":{"id":25196590,"uuid":"28620211","full_name":"kragniz/json-sempai","owner":"kragniz","description":"Use JSON files as if they are python modules","archived":false,"fork":false,"pushed_at":"2021-09-26T12:14:02.000Z","size":39,"stargazers_count":1250,"open_issues_count":12,"forks_count":54,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-05-08T20:46:54.034Z","etag":null,"topics":["don-t","python","stupid","this","use"],"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/kragniz.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-30T06:24:41.000Z","updated_at":"2025-03-14T05:42:42.000Z","dependencies_parsed_at":"2022-07-09T14:30:34.892Z","dependency_job_id":null,"html_url":"https://github.com/kragniz/json-sempai","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kragniz%2Fjson-sempai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kragniz%2Fjson-sempai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kragniz%2Fjson-sempai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kragniz%2Fjson-sempai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kragniz","download_url":"https://codeload.github.com/kragniz/json-sempai/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254394719,"owners_count":22063984,"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":["don-t","python","stupid","this","use"],"created_at":"2024-07-30T19:00:20.973Z","updated_at":"2025-05-15T18:05:45.077Z","avatar_url":"https://github.com/kragniz.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"===========\njson-sempai\n===========\n\n.. image:: https://travis-ci.org/kragniz/json-sempai.svg?branch=master\n    :target: https://travis-ci.org/kragniz/json-sempai\n\n.. image:: https://img.shields.io/pypi/v/json-sempai.svg\n    :target: https://pypi.python.org/pypi/json-sempai\n\nHave you ever been kept awake at night, desperately feeling a burning desire to\ndo nothing else but directly import JSON files as if they were python modules\n[#]_? Now you can!\n\nThis abomination allows you to write\n\n.. code:: python\n\n     import some_json_file\n\nand if ``some_json_file.json`` can be found, it will be available as if it is a\npython module.\n\nUsage\n-----\n\nSlap a json file somewhere on your python path. ``tester.json``:\n\n.. code:: json\n\n    {\n        \"hello\": \"world\",\n        \"this\": {\n            \"can\": {\n                \"be\": \"nested\"\n            }\n        }\n    }\n\nNow import jsonsempai and your json file!\n\n.. code:: python\n\n    \u003e\u003e\u003e from jsonsempai import magic\n    \u003e\u003e\u003e import tester\n    \u003e\u003e\u003e tester\n    \u003cmodule 'tester' from 'tester.json'\u003e\n    \u003e\u003e\u003e tester.hello\n    u'world'\n    \u003e\u003e\u003e tester.this.can.be\n    u'nested'\n    \u003e\u003e\u003e\n\nAlternatively, a context manager may be used (100% less magic):\n\n.. code:: python\n\n    \u003e\u003e\u003e import jsonsempai\n    \u003e\u003e\u003e with jsonsempai.imports():\n    ...     import tester\n    \u003e\u003e\u003e tester\n    \u003cmodule 'tester' from 'tester.json'\u003e\n\n\nPython packages are also supported:\n\n.. code:: bash\n\n    $ tree\n    .\n    └── python_package\n        ├── file.json\n        ├── __init__.py\n        └── nested_package\n            ├── __init__.py\n            └── second.json\n\n.. code:: python\n\n    \u003e\u003e\u003e from jsonsempai import magic\n    \u003e\u003e\u003e from python_package import file\n    \u003e\u003e\u003e file\n    \u003cmodule 'python_package.file' from 'python_package/file.json'\u003e\n    \u003e\u003e\u003e import python_package.nested_package.second\n    \u003e\u003e\u003e python_package.nested_package.second\n    \u003cmodule 'python_package.nested_package.second' from 'python_package/nested_package/second.json'\u003e\n\n\nInstalling\n----------\n\nInstall from pip:\n\n.. code:: bash\n\n    $ pip install json-sempai\n\nor clone this repo and install from source:\n\n.. code:: bash\n\n    $ python setup.py install\n\nTo purge this horror from your machine:\n\n.. code:: bash\n\n    $ pip uninstall json-sempai\n\n.. [#] Disclaimer: Only do this if you hate yourself and the rest of the world.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkragniz%2Fjson-sempai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkragniz%2Fjson-sempai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkragniz%2Fjson-sempai/lists"}