Saravanan666/pypi-org huggingface dataset:
Package: jsonpycraft
JSONPyCraftJsonPyCraft - A Fusion of Python and JSON, symbolizing the toolkit's capability to manage intricate JSON data structures.DescriptionJsonPyCraft is a specialized Python toolkit designed for efficient and structured JSON management. This toolkit offers a range of functionalities from basic JSON file handling to advanced operations, making it ideal for developers looking to manage JSON data in Python applications with precision and ease.FeaturesRobust JSON file handling (load, save, backup).Advanced JSON structure manipulation (mapping and list templates).Nested JSON data management.Pythonic, easy-to-use interface with detailed documentation.JSONPyCraft DocumentationWelcome to the JSONPyCraft documentation! Explore detailed documentation on key aspects of JSONPyCraft:Core Components:Learn about custom error handling, the Singleton pattern, core types, and more.JSON Templates:Understand JSON templates, I/O operations, list templates, and map templates.Managers:Discover theConfigurationManagerclass for managing configuration data.PlantUML Diagrams:Visual representations of key components.For more detailed information, check out thefull documentation index.OpenAI GPT SupportJsonPyCraft supports integration with OpenAI GPT if you have an OpenAI Plus subscription. You can chat withJSONPyCraftfor more information.InstallationYou can install JsonPyCraft using eitherpiporpoetry. Follow the instructions below based on your preferred method.Using pip:Create a virtual environment (optional but recommended for isolation):virtualenv.venvActivate the virtual environment:source.venv/bin/activateInstall JSONPyCraft using PyPI:pipinstalljsonpycraftUsing poetry:Initialize a new Poetry project. If you haven't already installed Poetry, you can do so withpip:pipinstallpoetryNavigate to your project directory and run:poetryinitFollow the prompts and add any necessary packages to your project.Activate the Poetry shell:poetryshellAdd JsonPyCraft to your project using the following command, specifying the URL to the wheel file:poetryaddjsonpycraftUsageHere's a quick start guide to using JsonPyCraft:fromjsonpycraftimportJSONMapTemplate,JSONListTemplate# Example of using JSONMapTemplatemap_template=JSONMapTemplate('map_data.json')map_template.create('key','value')# Example of using JSONListTemplatelist_template=JSONListTemplate('list_data.json')list_template.append({'id':1,'name':'JsonPyCraft'})Contributing, Support, and ContactFor support, feature requests, or contributions, feel free to open an issue or pull request.LicenseLICENSE: JsonPyCraft is released under the GNU Affero General Public License.
Package: jsonpyd
jsonpydGenerate related pydantic class with any json type.JsonPydJsonPyd is a tool that automatically generates Pydantic models from JSON schemas.InstallationYou can easily install it via pip:pipinstalljsonpydUsageTerminal UsageJsonPyd can be used as a command-line tool:jsonpyd/path/to/schema.json--force-optionalTrueThis command will generate a.pyfile containing Python classes based on the specified JSON schema. Optionally,--force-optionalparameter can be used to make all fields in the schema optional.CommandsThe tool's command-line interface allows you to specify options for generating Pydantic models using the following parameters:# Specify the path to the JSON schema fileschema_path<path_to_schema># Option to apply snake_case to variable names--apply_snake_case[true|false]# Option to force all variables to be optional--force_optional[true|false]# Set the name for the output file, default is the current date in 'dd-mm-yyyy_schema' format--file_name<file_name>These parameters can be used to customize the behavior of the model generation to fit your project requirements.Usage within a ProjectJsonPyd can also be used within Python files in a project:fromjsonpydimportJsonPydmy_schema='''{"id": "1NW2ZvKYlo2CPkIVYDHw","object": "payment_method","price": 35.5312,"price_str": null,"billing_details": {"address": {"city": null,"country": "TR","line1": null},"email": "jenny@example.com"}}'''# Create models using JsonPydpkg=JsonPyd(schema=my_schema,options={"force_optional":True})# You can get Pydantic model by calling .model attribute.pkg.model# Or you can create .py filepkg.convert_to_py()This creates Pydantic models based on the specified JSON schema and converts them into a.pyfile.FeaturesAutomatic Model Generation: Automatically generates Pydantic models based on JSON schema.Optional Fields: Allows making all fields optional within a specific schema structure.Pydantic Integration: The generated models can leverage all features provided by Pydantic.Contribution and FeedbackFor any contributions and feedback, please visit my GitHub page or reach me via email.
Package: jsonpyes
json-py-esAlexander LiuTo import raw JSON data files to ElasticSearch in one line of commandsVery fast -- 4 to 10 times faster when processing big data.Installationpip install jsonpyesNotice: Before usingpipto installjsonpyes, firstly you need to installpython-pipon your system. ( Supports Python Python2.7, 3.3, 3,4, 3.5, 3.6 )jsonpyesInstructions:There are 3 proccesses of importing raw JSON data to ElasticSearch
1. Only validating raw JSON data
2. Without validating ,just import data to ElasticSearch
3. After validating successfully, then import data to ElasticSearch

A valid JSON file here refers to a JSON file stacked with many lines of data

file valid_data.json and its content

{"key1": "valueA", "key2": {"sub_key1": "value2A", "sub_key2": ["Good", "Morning"]}}
{"key1": "valueB", "key2": {"sub_key1": "value2B", "sub_key2": ["Good", "Afternoon"]}}
...
{"key1": "valueC", "key2": {"sub_key1": "value2C", "sub_key2": ["Good", "Evening"]}}Functions included1. Validating JSON format datajsonpyes --data raw_data.json --checkIf the json data file is valid:If the json data file is invalid:2. Only importing without validatingjsonpyes --data raw_data.json --bulk http://localhost:9200 --import --index myindex2 --type mytype2Notice: If the raw JSON data file is invalid,jsonpyeswill not import it.Or enable multi-threadsjsonpyes --data raw_data.json --bulk http://localhost:9200 --import --index myindex2 --type mytype2 --thread 8jsonpyessupports multi-threads when importing data to elasticsearchMulti-threads comparisonNo multi-threadsWith 8 threads andjsonpyescuts files into pieces, then destributes to workers fairlyAs you can see these two containers have same docs loaded, if we use--thread 8it could be several times faster, usually 5 to 10 times faster.
That really depends on your computer/server resources.
This was tested on a 4GB RAM / 2.4Ghz intel i5 Linux x64 laptop system.And it works.3. Both validating and importingjsonpyes --data raw_data.json --bulk http://localhost:9200 --import --index myindex1 --type mytype1 --checkAnd it works.ReferenceAlgorithm handwrittingHappy hacking!
Package: json-pyformatter
json-pyformatterPython logging outputs as JSON.This JsonFormatter is written in Pure Python.Installationpipinstalljson-pyformatterUsageimportloggingfromjson_pyformmatterimportJsonFormatterlogger=logging.getLogger(__name__)logger.setLevel(logging.INFO)handler=logging.StreamHandler()fields=('levelname','filename','message')handler.setFormatter(JsonFormatter(fields=fields))logger.addHandler(hander)logger.info('hello')default fields is ('asctime', 'levelname', 'message')Other supported fields are:field namedescriptionnameName of the logger (logging channel)levelnoNumeric logging level for the message(DEBUG, INFO, WARNING, ERROR, CRITICAL)levelnameText logging level for the message("DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL")pathnameFull pathname of the source file where the logging call was issuedfilenameFilename portion of pathnamemoduleModule (name portion of filename)linenoSource line number where the logging call was issuedfuncNameFunction namecreatedTime when the LogRecord was created (time.time()return value)asctimeTextual time when the LogRecord was createdmsecsMillisecond portion of the creation timerelativeCreatedTime in milliseconds when the LogRecord was created, relative to the time the logging module was loaded (typically at application startup time)threadThread IDthreadNameThread nameprocessProcess IDmessageThe result of record.getMessage(), computed just as the record is emittedIn details, please refere tologrecord-attributesOutput{"levelname":"INFO","filename":"test_formatter.py","message":"hello"}If specify indent option as 2, the result is as follows:{"levelname":"INFO","filename":"test_formatter.py","message":"hello"}When exc_info is True, the result includes traceback infomation as follows:{'asctime':'2019-12-01 13:58:34','levelname':'ERROR','message':'error occurred !!','traceback':['Traceback (most rec...ll last):','File "/example/test..._exc_info','raise TypeError(message)','TypeError: error occurred !!']}Logging message type is dict:{'asctime':'2019-12-01 23:34:32','levelname':'INFO','message':{'id':'001','msg':'This is test.','name':'test'}}
Package: jsonpython
JsonpythonA package to deserialize and serialize json.Installing:pipinstalljsonpythonExample:data.json{"name":"Alex","age":23,"car":{"model":"Tesla X","cost":40000,"company":{"name":"Tesla"}}}main.pyfromjsonpythonimport*jobj=get_json_object("data.json")print(jobj['name'])# Alexprint(jobj['car']['model'])# Tesla XclassCompany:name:strclassCar:model:strcost:intcompany:CompanyclassPerson:age:intname:strcar:Carperson=from_file(Person,"data.json")print(person.car.model)# Tesla X
Package: json-python-flatten
json_flattenFlatten/unflatten the JSON object in python.Installationpipinstalljson_flattenUsagesFlatten# Input Dictinput_dict={"abc":{"a":24,"b":{"b1":{"size":3,"out":"Nope"},"size":True}},"xyz":{"x":{"word":8},"y":-1,"z":26},"pqr":{"pq":[0,None,2.0,3.0],"r":None}}fromjson_python_flattenimportflattenprint(flatten(dictionary=input_dict)){"abc[a]":24,"abc[b][b1][size]":3,"abc[b][b1][out]":"Nope","abc[b][size]":True,"xyz[x][word]":8,"xyz[y]":-1,"xyz[z]":26,"pqr[pq][0]":0,"pqr[pq][1]":"None","pqr[pq][2]":2.0,"pqr[pq][3]":3.0,"pqr[r]":"None"}Un-Flattenjson_dict={"columns[0][data]":"0","columns[0][name]":"","columns[0][searchable]":"true","columns[0][orderable]":"false","columns[0][search][value]":"","columns[0][search][regex]":"false","order[0][column]":"1","order[0][dir]":"asc","start":"0","length":"13","search[value]":"jenkins","search[regex]":"false","searchPanes[group][0]":"Group 1","searchPanes[platform][0]":"Window"}fromjson_python_flattenimportunflattenprint(unflatten(json_dict=json_dict)){"columns":[{"data":"0","name":"","searchable":"true","orderable":"false","search":{"value":"","regex":"false"}}],"order":[{"column":"1","dir":"asc"}],"start":"0","length":"13","search":{"value":"jenkins","regex":"false"},"searchPanes":{"group":["Group 1"],"platform":["Window"]}}
Package: jsonQ
jsonQInstallationpipinstalljsonQExample main.pyimport json
from jquery import Query
a = [
    {
        "name":{
            "first": "Thor",
            "last": "Odinson"
        },
        "age": 1500,
        "gender":"M",
        "family": "Avengers",
        "favorite":{
            "food": ["banana","pizza"]
        }
    },
    {
        "name":{
            "first": "Loki",
            "last": "Odinson"
        },
        "age": 1054,
        "gender": "M",
        "family": "Avengers",
        "favorite":[{
            "food": ["peas","pizza"]
        }]
    },
    {
        "name":{
            "first": "Thanos",
            "last": None,
        },
        "age": 1000,
        "gender": "M",
        "family": "Avengers",
        "favorite":{
            "food": ["peas","banana"],
            "movie": ["infinity-war"]
        }

    }
]


out = Query(a)
food = "peas"
out = out.where("gender == M").where(f"{food} in favorite.food").where("age == 1000").tolist()

print(json.dumps(out,indent=4))Output➜  python3  main.py
[
    {
        "name": {
            "first": "Thanos",
            "last": null
        },
        "age": 1000,
        "gender": "M",
        "family": "Avengers",
        "favorite": {
            "food": [
                "peas",
                "banana"
            ],
            "movie": [
                "infinity-war"
            ]
        }
    }
]out.where("favorite.*.food == eggos").tolist()
out.where("beer in favorite.*.food").tolist()
out.where("food in favorite.*.food").get("age")
out.where("food in favorite.food").get("name.first")
Package: json-queries
json-queriesNowadays, communication between API infrastructures commonly uses JSON data.This library aims to emulate the behavior of the Django ORM, exporting such functionality to JSON objects.Installationpip install json-queriesSimple case of use>> import jsonutils as js
   from datetime import datetime

>> json_data = js.JSONObject(
    {
        "data": [
            {
                "name": "Dan",
                "birthday": "1991-01-02 09:00:00",
                "publications": 15
            },
            {
                "name": "Mar",
                "birthday": "1991-03-02 12:30:00",
                "publications": 13
            },
            {
                "name": "Carl",
                "birthday": "1950-06-02 16:00:00",
                "publications": 36
            },
            {
                "name": "Vic",
                "birthday": "1986-07-02 16:00:00",
                "publications": None
            },
        ]
    }
)

# now we can navegate through this object by attribute accesion

>> json_data.data._1.name
    'Mar'

# or we can make queries as django's ORM

>> result = json_data.query(birthday__lt=datetime(1985,1,1))

>> result
    <QuerySet ['1950-06-02 16:00:00']>

>> result.first().parent
    {'name': 'Carl', 'birthday': '1950-06-02 16:00:00', 'publications': 36}

# retrieving the path of a node object

>> result.first().jsonpath
    data/2/

# testing environment

We have developed a Docker container with all the configuration options, modules and variables already setted up, so that you can test the behaviour of the package, just by typing:

```bash build.sh```
Then, on Ipython terminal, you can access `test` variable with some json data, or create new a JSONObject

# executing within docker

```docker build -t json-queries .``` To build the image
```docker run --name json-queries -it json-queries``` To run a new container instance of the image
```docker start json-queries``` To run the container, if it is stopped
```docker exec -it json-queries ipython --profile=template``` Open an Ipython session in a running container

# utils
```docker images -a | tail -n +2 | wc -l``` Count the total number of docker images
Package: json-reader
JSON ReaderRead JSON and it's variants from a char stream.Installpip install -U json-readerUsageSeejson_reader/test_scanner.pycat example.log | python -m json_readercat example.log | json_readerEnvironemntsJSON_INDENT: specify the output indent in integer.BY_LINES: flag to read stdin line by line, then JSON content must NOT spand cross multiple lines.
Package: jsonreadwrite
Read Write JSONLoad JSON Settings from fileWrite JSON Settings to file- Read settings file from json format and return it
- Write settings file from json format
- Interactive write in json settings with save option
- Write out json file if file is missing
    - values
        - string, int, float
        - [list], {"dict":"value"}pip install jsonreadwriteTodo: Write proper documentationfromjsonreadwriteimportJsonReadWritetestlist=["test1","test2","test3"]testdict={"test1":"test1","test2":"test2","test3":"test3"}testint=1testfloat=1.1testbool=Truetestnone=Nonetestblank=""test=JsonReadWrite("test.json",allowempty=True)test.set("testlist",testlist)test.set("testdict",testdict)test.set("testint",testint)test.set("testfloat",testfloat)test.set("testbool",testbool)test.set("testnone",testnone)test.set("testblank",testblank)asserttest.get("testlist")==testlistasserttest.get("testdict")==testdictasserttest.get("testint")==testintasserttest.get("testfloat")==testfloatasserttest.get("testbool")==testboolasserttest.get("testnone")==testnoneasserttest.get("testblank")==testblank{"testlist":["test1","test2","test3"],"testdict":{"test1":"test1","test2":"test2","test3":"test3"},"testint":1,"testfloat":1.1,"testbool":true,"testnone":null,"testblank":""}
Package: jsonref
jsonrefjsonrefis a library for automatic dereferencing ofJSON
Referenceobjects for Python (supporting Python 3.7+).This library lets you use a data structure with JSON reference objects,
as if the references had been replaced with the referent data.>>>frompprintimportpprint>>>importjsonref>>># An example json document>>>json_str="""{"real": [1, 2, 3, 4], "ref": {"$ref": "#/real"}}""">>>data=jsonref.loads(json_str)>>>pprint(data)# Reference is not evaluated until here{'real':[1,2,3,4],'ref':[1,2,3,4]}FeaturesReferences are evaluated lazily. Nothing is dereferenced until it is
used.Recursive references are supported, and create recursive python data
structures.References objects are actually replaced by lazy lookup proxy objects
which are almost completely transparent.>>>data=jsonref.loads('{"real": [1, 2, 3, 4], "ref": {"$ref": "#/real"}}')>>># You can tell it is a proxy by using the type function>>>type(data["real"]),type(data["ref"])(<class'list'>, <class 'jsonref.JsonRef'>)>>># You have direct access to the referent data with the __subject__>>># attribute>>>type(data["ref"].__subject__)<class'list'>>>># If you need to get at the reference object>>>data["ref"].__reference__{'$ref':'#/real'}>>># Other than that you can use the proxy just like the underlying object>>>ref=data["ref"]>>>isinstance(ref,list)True>>>data["real"]==refTrue>>>ref.append(5)>>>delref[0]>>># Actions on the reference affect the real data (if it is mutable)>>>pprint(data){'real':[2,3,4,5],'ref':[2,3,4,5]}
Package: jsonref-ap
jsonrefis a library for automatic dereferencing ofJSON Referenceobjects for Python (supporting 2.6+ including Python 3).This library lets you use a data structure with JSON reference objects, as if
the references had been replaced with the referent data.>>>frompprintimportpprint>>>importjsonref>>># An example json document>>>json_str="""{"real": [1, 2, 3, 4], "ref": {"$ref": "#/real"}}""">>>data=jsonref.loads(json_str)>>>pprint(data)# Reference is not evaluated until here{'real':[1,2,3,4],'ref':[1,2,3,4]}FeaturesReferences are evaluated lazily. Nothing is dereferenced until it is used.Recursive references are supported, and create recursive python data
structures.References objects are actually replaced by lazy lookup proxy objects which are
almost completely transparent.>>>data=jsonref.loads('{"real": [1, 2, 3, 4], "ref": {"$ref": "#/real"}}')>>># You can tell it is a proxy by using the type function>>>type(data["real"]),type(data["ref"])(<class'list'>, <class 'jsonref.JsonRef'>)>>># You have direct access to the referent data with the __subject__>>># attribute>>>type(data["ref"].__subject__)<class'list'>>>># If you need to get at the reference object>>>data["ref"].__reference__{'$ref':'#/real'}>>># Other than that you can use the proxy just like the underlying object>>>ref=data["ref"]>>>isinstance(ref,list)True>>>data["real"]==refTrue>>>ref.append(5)>>>delref[0]>>># Actions on the reference affect the real data (if it is mutable)>>>pprint(data){'real':[2,3,4,5],'ref':[2,3,4,5]}
Package: json-ref-dict
JSONSchema Ref DictPython dict-like object which abstracts resolution of JSONSchema references.fromjson_ref_dictimportRefDictschema=RefDict("https://json-schema.org/draft-07/schema#/")Nested items containing"$ref"will be resolved lazily when accessed,
meaning the dictionary can be treating as a single, continuous (and
possibly infinite) document.Remote references are supported, and will be resolved relative to the current
document.If no scheme is provided, it is assumed that the document is present on the
local filesystem (seeExamplebelow).IfPyYAMLis installed, then loading of YAML documents will be supported, otherwise only JSON documents may be loaded.ExampleGiven the following related schemas:master.yamldefinitions:foo:type:stringlocal_ref:$ref:'#/definitions/foo'remote_ref:$ref:'other.yaml#/definitions/bar'backref:$ref:'other.yaml#/definitions/baz'other.yamldefinitions:bar:type:integerbaz:$ref:'master.yaml#/definitions/foo'We can parse these as a single object as follows:fromjson_ref_dictimportRefDictschema=RefDict("master.yaml#/definitions")print(schema)>>>{'foo':{'type':'string'},'local_ref':{'$ref':'#/definitions/foo'},'remote_ref':{'$ref':'other.yaml#/definitions/bar'},'backref':{'$ref':'other.yaml#/definitions/baz'}}print(schema["local_ref"])>>>{'type':'string'}print(schema["remote_ref"])>>>{'type':'integer'}print(schema["backref"])>>>{'type':'string'}Materializing documentsIf you don't want the lazy behaviour, and want to get all of the IO out of the way up front, then you can "materialize" the dictionary:fromjson_ref_dictimportmaterialize,RefDictschema=materialize(RefDict("https://json-schema.org/draft-04/schema#/"))assertisinstance(schema,dict)A materializedRefDictis just a regular dict, containing a document with all references resolved. This is useful if, for example, you want to cache/persist the entire schema. Be aware that if there are cyclical references in the schema, these will be present on the materialized dictionary.Thematerializehelper also supports some basic transformation options, as performing global transformations on infinite documents is non-trivial:include_keys- an iterable of keys to include in the materialized document.exclude_keys- an iterable of keys to exclude from the materialized document.value_map- an operation to apply to the values of the document (not lists or dictionaries).RequirementsThis package is currently tested for Python 3.6.InstallationThis project may be installed usingpip:pip install json-ref-dictDevelopmentClone the repository:git clone git@github.com:jacksmith15/json-ref-dict.git && cd json-ref-dictInstall the requirements:pip install -r requirements.txt -r requirements-test.txtRunpre-commit installRun the tests:bash run_test.sh -c -aThis project uses the following QA tools:PyTest- for running unit tests.PyLint- for enforcing code style.MyPy- for static type checking.Travis CI- for continuous integration.Black- for uniform code formatting.LicenseThis project is distributed under the MIT license.
Package: json_reference
.. image:: https://drone.io/bitbucket.org/eodolphi/json-reference/status.png:target: https://drone.io/bitbucket.org/eodolphi/json-reference/latestJSON Reference=============Simple implementation of the json-pointer spec:http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-00Usage------------JSON reference makes it possible to retrieve (parts of) json-objects>>> import json_reference>>> json_reference.Reference('http://json-schema.org/draft-04/schema#/definitions').get()It is also possible to register references for offline access>>> json_reference.register('http://localhost/test', {'test': 'bli'})>>> json_reference.Reference('http://localhost/test').get(){'test': 'bli'}
Package: jsonreg
JSONregjson reg is a python module to quickly create json keys to store dataExamplesSimple json keymain.pyimportjsonregjsonreg.create("test.json","Test","This is test data")test.json{"name":"Test","id":408557195864,"data":"This is test data"}Json key in an external foldermain.pyimportjsonregjsonreg.create("reg/test.json","Test","This is test data")Note: Theregfolder must exist and should look like this.
├── main.py
└── regreg/test.json{"name":"Test","id":408557195864,"data":"This is test data"}