Skip to content

Commit

Permalink
Merge pull request #41 from cl3wis/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
cl3wis authored Mar 15, 2018
2 parents 4c525fa + c956c93 commit c3c21da
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 46 deletions.
2 changes: 1 addition & 1 deletion JsonPydexer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__author__ = "Christian Bailey ([email protected])"
__version__ = "0.3.0"
__version__ = "0.3.1"

import os
import json
Expand Down
42 changes: 0 additions & 42 deletions README.md

This file was deleted.

55 changes: 55 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
JsonPydexer
===========

A (python) indexer for large collections of json files. In development
and probably not good for general use yet.

Installation
------------

``pip install JsonPydexer``

Usage
-----

Starting from zero
~~~~~~~~~~~~~~~~~~

.. code:: python
>>>from JsonPydexer import JsonPydexer
>>># initialize with the root directory containing your json files
>>>jp = JsonPydexer("test_data/3")
>>># index on your keys. provide a list of keynamess. keyname elements can be a string for a
>>># field at root level, or a list of strings for nested fields
>>>jp.index(["id", "name", ["field_in_root", "field_below"]])
Opening an existing index
~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python
>>># initialize with the root directory containing your json files and .jp.pkl
>>>jp = JsonPydexer("test_data/3")
>>># get all the files that match a search string for non-unique index
>>>search_string = "alice"
>>>for filename in jp.get_files(["name"], search_string):
>>> print(filename)
1.json
3.json
>>># get the file matching a search string for a unique index
>>>filename = jp.get_file(["id"], "id2")
>>>print(filename)
2.json
Added, removed, or modified JSON files? Update the index
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python
>>>jp = JsonPydexer("test_data/3")
>>>jp.update()
New files in the directory will be added to the index. Coming soon are:
removing files not present in the directory from the index, and checking
for modified files in the directory.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[metadata]
description-file = README.md
description-file = README.rst
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

here = path.abspath(path.dirname(__file__))

with open(path.join(here, "README.md"), encoding="utf-8") as f:
with open(path.join(here, "README.rst"), encoding="utf-8") as f:
long_desc = f.read()

setup(
Expand All @@ -27,5 +27,5 @@
packages=find_packages(),
install_requires=[],
python_requres=">=3",
py_modules=["JsonPydexer"]
py_modules=["JsonPydexer", "Index"]
)

0 comments on commit c3c21da

Please sign in to comment.