Skip to content

Commit

Permalink
Merge branch 'main' into examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Agent-Hellboy authored Oct 20, 2024
2 parents 9f84d7f + 51b85e4 commit 0e8681d
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 102 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/docs.yml

This file was deleted.

22 changes: 3 additions & 19 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,11 @@ For development
- python -m venv .venv
- source .venv/bin/activate

Example
=======
Documentation
=============

For more details, you can refer to the `documentation <https://agent-hellboy.github.io/trace-dkey/>`_.

you can use the library as ``python3 -m trace_dkey --file=test.json --key=name``, test.json is

A JSON file containing name as key

.. code:: py
>>> from trace_dkey import trace
>>> l={'a':{'b':{'c':{'d':{'e':{'f':1}}}}}}
>>> print(trace(l,'f'))
[['a', 'b', 'c', 'd', 'e', 'f']]
Now you can query it as l['a']['b']['c']['d']['e']['f']
>>> l['a']['b']['c']['d']['e']['f']
1
refer `Tests_ <https://github.com/Agent-Hellboy/trace-dkey/tree/main/tests/>`_. for other examples

General Info
============
Expand Down
29 changes: 28 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,37 @@ trace-dkey is a simple tool for tracing keys in nested dictionaries.

## Installation

You can install Trace DKey using pip:
You can install trace-dkey using pip:


```bash
pip install trace-dkey
```

## Usage

### As a Command-Line Tool
You can use trace-dkey as a command-line tool:

```bash
python -m trace_dkey --file=test.json --key=name
```

### As a Python Library

You can use trace-dkey in your Python code as follows:

```python
from trace_dkey import trace

data = {'a': {'b': {'c': {'d': {'e': {'f': 1}}}}}}
path = trace(data, 'f')
print(path) # Output: [['a', 'b', 'c', 'd', 'e', 'f']]
```







25 changes: 0 additions & 25 deletions docs/usage.md

This file was deleted.

18 changes: 0 additions & 18 deletions mkdocs.yml

This file was deleted.

2 changes: 0 additions & 2 deletions requirements-dev.txt

This file was deleted.

11 changes: 10 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def read(fname):
setup(
name="trace-dkey",
author="Prince Roshan",
version='0.0.7',
version='0.0.8',
author_email="princekrroshan01@gmail.com",
url="https://github.com/Agent-Hellboy/trace-dkey",
description=("Python library to trace path of a particular key inside a nested dict"),
Expand All @@ -32,4 +32,13 @@ def read(fname):
"Operating System :: OS Independent",
],
include_package_data=True,
entry_points={
'console_scripts': [
'trace-dkey=trace_dkey.cli:main',
],
},
package_data={
'trace_dkey': ['images/*', 'README.rst'],
},
)

0 comments on commit 0e8681d

Please sign in to comment.