crazyimports

Treat your data as your code


Keywords
crazy-imports, import, package, pypi, python
License
MIT
Install
pip install crazyimports==0.0.2

Documentation

Crazy Imports - treat your data as your code

CI/CD Code style: black CodeFactor codecov PyPI Downloads PyPI - Python Version PyPI - Implementation PyPI - License

crazyimports module allows you to use your data files as if it was python modules

Simple example

Install crazyimports module

pip install -U crazyimports

Create example.json file with this content

{"number": 42}

Than in the same directory create test.py file

import crazyimports
import example

print(example.number)

Then when you run python test.py you would see 42 output in your command line

You can find more examples in examples section of documentation

Supported file extensions

  • .json for JSON files
  • .sqlite3 and .sqlite for SQLite3 database files
  • .csv for CSV (Comma Separated Values) files
  • .yaml and .yml for YAML files
  • .pickle for pickle files
  • .toml for toml files

Credits

Heavily inspired by this talk by @bobuk