dim-python
is a Python implementation of dim (Data Installation Manager): Manage open data in your projects, like a package manager.
We are looking for members to develop together as an open source community.
- Install the dim
https://github.com/c-3lab/dim#install-the-dim
- Install the dim-python
$ pip install dim-python
- Initialize the project for dim
$ dim init
Also can initialize the project using dim-python.
- Use the dim-python
import dim
dim.install('https://example.com/xxx.json', 'example_name', ['encode utf-8'])
print(dim.list())
print(dim.load_data('example_name', 'json'))
dim.load_data('name', 'csv')
- name(requrire)
- Specify the data name
- file_type(option)
- Specify 'text' or 'json' or 'csv'
- default: 'text'
- dim_file_path(option)
- Specify a file path existing dim.json and dim-lock.json, data_files
- default: './'
- encoding(option)
- Specify encoding of data
- default: 'utf-8'
Return type each file_type
- text: str
- csv : csv.DictReader object
- json: dict
dim.fetch_data('name')
- name(requrire)
- Specify the data name
- dim_file_path(option)
- Specify a file path existing dim.json and dim-lock.json, data_files
- default: './'
requests.Response object
dim.load_dim_json()
- dim_file_path(option)
- Specify a file path existing dim.json and dim-lock.json, data_files
- default: './'
- encoding(option)
- Specify encoding of data
- default: 'utf-8'
dict
dim.load_dim_lock_json()
- dim_file_path(option)
- Specify a file path existing dim.json and dim-lock.json, data_files
- default: './'
- encoding(option)
- Specify encoding of data
- default: 'utf-8'
dict
dim.init()
boolean
dim.install()
- source(require)
- name(require)
- postprocesses(option)
- default: []
- from_file(option)
- default: False
- force(option)
- default: False
- async_install(option)
- default: False
boolean
dim.uninstall('name')
- name(require)
boolean
dim.update('name')
- name(require)
- async_install(option)
- default: False
boolean
dim.list()
- simple(option)
- default: False
str
dim.search()
- keyword(require)
- number(option)
- default: 10
str
Install Python 3.8+.
Then, install poetry
1.2.0+ as follows.
Windows:
# Linux, macOS, Windows (WSL)
curl -sSL https://install.python-poetry.org | python3 -
# Windows (Powershell)
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
Install dependencies with poetry
.
poetry install
import dim
dim.__version__
Refer to MIT License.