hiku


Namehiku JSON
Version 0.7.2 PyPI version JSON
download
home_pageNone
SummaryLibrary to implement Graph APIs
upload_time2024-04-18 10:23:16
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseBSD-3-Clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Hiku
====

|project|_ |documentation|_ |version|_ |tag|_ |license|_

Hiku is a library to implement Graph APIs. Essential GraphQL support included.

Installation
~~~~~~~~~~~~

.. code-block:: shell

  $ pip3 install hiku

Bug fixes and new features are frequently published via release candidates:

.. code-block:: shell

  $ pip3 install --upgrade --pre hiku

Documentation
~~~~~~~~~~~~~

Read documentation_

Optional dependencies
~~~~~~~~~~~~~~~~~~~~~

* `graphql-core` - for GraphQL support
* `protobuf` - for Protobuf support
* `sqlalchemy` - for SQLAlchemy support as a data-source
* `aiopg` - for async PostgreSQL support with `aiopg`
* `asyncpg` - for async PostgreSQL support with `asyncpg`
* `prometheus-client` - for Prometheus metrics support
* `sentry-sdk` - for Sentry tracing support


Highlights
~~~~~~~~~~

* Not coupled to a single specific query language
* Flexibility in result serialization, including binary formats
* Natively uses normalized result representation, without data duplication
* All concurrency models supported: coroutines, threads
* Parallel query execution
* No data under-fetching or over-fetching between ``client<->server`` and
  between ``server<->database``
* No ``N+1`` problems by design
* Introduces a concept of `Two-Level Graph` in order to decouple data-sources
  and business-logic

Quick example
~~~~~~~~~~~~~

Graph definition:

.. code-block:: python

  from hiku.graph import Graph, Root, Node, Field, Link
  from hiku.types import String, Sequence, TypeRef

  def characters_data(fields, ids):
      data = {
          1: {'name': 'James T. Kirk', 'species': 'Human'},
          2: {'name': 'Spock', 'species': 'Vulcan/Human'},
          3: {'name': 'Leonard McCoy', 'species': 'Human'},
      }
      return [[data[i][f.name] for f in fields] for i in ids]

  def characters_link():
      return [1, 2, 3]

  GRAPH = Graph([
      Node('Character', [
          Field('name', String, characters_data),
          Field('species', String, characters_data),
      ]),
      Root([
          Link('characters', Sequence[TypeRef['Character']],
               characters_link, requires=None),
      ]),
  ])

Query:

.. code-block:: python

  from hiku.engine import Engine
  from hiku.builder import Q, build
  from hiku.executors.sync import SyncExecutor

  engine = Engine(SyncExecutor())

  result = engine.execute_query(GRAPH, build([
      Q.characters[
          Q.name,
          Q.species,
      ],
  ]))

  # use result in your code
  for character in result.characters:
      print(character.name, '-', character.species)

Output:

.. code-block:: text

  James T. Kirk - Human
  Spock - Vulcan/Human
  Leonard McCoy - Human

Contributing
~~~~~~~~~~~~

Use Tox_ in order to test and lint your changes.

.. _Tox: https://tox.readthedocs.io/
.. |project| image:: https://img.shields.io/badge/evo-company%2Fhiku-blueviolet.svg?logo=github
.. _project: https://github.com/evo-company/hiku
.. |documentation| image:: https://img.shields.io/badge/docs-hiku.rtfd.io-blue.svg
.. _documentation: https://hiku.readthedocs.io/en/latest/
.. |version| image:: https://img.shields.io/pypi/v/hiku.svg?label=stable&color=green
.. _version: https://pypi.org/project/hiku/
.. |tag| image:: https://img.shields.io/github/tag/evo-company/hiku.svg?label=latest
.. _tag: https://pypi.org/project/hiku/#history
.. |license| image:: https://img.shields.io/pypi/l/hiku.svg
.. _license: https://github.com/evo-company/hiku/blob/master/LICENSE.txt

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "hiku",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Vladimir Magamedov <vladimir@magamedov.com>, Maksym Kindritskyi <kindritskiy.m@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/7c/63/b959725d91f84257d7e65519030d641e85a79a5f2cf8bc106e4751c1be06/hiku-0.7.2.tar.gz",
    "platform": null,
    "description": "Hiku\n====\n\n|project|_ |documentation|_ |version|_ |tag|_ |license|_\n\nHiku is a library to implement Graph APIs. Essential GraphQL support included.\n\nInstallation\n~~~~~~~~~~~~\n\n.. code-block:: shell\n\n  $ pip3 install hiku\n\nBug fixes and new features are frequently published via release candidates:\n\n.. code-block:: shell\n\n  $ pip3 install --upgrade --pre hiku\n\nDocumentation\n~~~~~~~~~~~~~\n\nRead documentation_\n\nOptional dependencies\n~~~~~~~~~~~~~~~~~~~~~\n\n* `graphql-core` - for GraphQL support\n* `protobuf` - for Protobuf support\n* `sqlalchemy` - for SQLAlchemy support as a data-source\n* `aiopg` - for async PostgreSQL support with `aiopg`\n* `asyncpg` - for async PostgreSQL support with `asyncpg`\n* `prometheus-client` - for Prometheus metrics support\n* `sentry-sdk` - for Sentry tracing support\n\n\nHighlights\n~~~~~~~~~~\n\n* Not coupled to a single specific query language\n* Flexibility in result serialization, including binary formats\n* Natively uses normalized result representation, without data duplication\n* All concurrency models supported: coroutines, threads\n* Parallel query execution\n* No data under-fetching or over-fetching between ``client<->server`` and\n  between ``server<->database``\n* No ``N+1`` problems by design\n* Introduces a concept of `Two-Level Graph` in order to decouple data-sources\n  and business-logic\n\nQuick example\n~~~~~~~~~~~~~\n\nGraph definition:\n\n.. code-block:: python\n\n  from hiku.graph import Graph, Root, Node, Field, Link\n  from hiku.types import String, Sequence, TypeRef\n\n  def characters_data(fields, ids):\n      data = {\n          1: {'name': 'James T. Kirk', 'species': 'Human'},\n          2: {'name': 'Spock', 'species': 'Vulcan/Human'},\n          3: {'name': 'Leonard McCoy', 'species': 'Human'},\n      }\n      return [[data[i][f.name] for f in fields] for i in ids]\n\n  def characters_link():\n      return [1, 2, 3]\n\n  GRAPH = Graph([\n      Node('Character', [\n          Field('name', String, characters_data),\n          Field('species', String, characters_data),\n      ]),\n      Root([\n          Link('characters', Sequence[TypeRef['Character']],\n               characters_link, requires=None),\n      ]),\n  ])\n\nQuery:\n\n.. code-block:: python\n\n  from hiku.engine import Engine\n  from hiku.builder import Q, build\n  from hiku.executors.sync import SyncExecutor\n\n  engine = Engine(SyncExecutor())\n\n  result = engine.execute_query(GRAPH, build([\n      Q.characters[\n          Q.name,\n          Q.species,\n      ],\n  ]))\n\n  # use result in your code\n  for character in result.characters:\n      print(character.name, '-', character.species)\n\nOutput:\n\n.. code-block:: text\n\n  James T. Kirk - Human\n  Spock - Vulcan/Human\n  Leonard McCoy - Human\n\nContributing\n~~~~~~~~~~~~\n\nUse Tox_ in order to test and lint your changes.\n\n.. _Tox: https://tox.readthedocs.io/\n.. |project| image:: https://img.shields.io/badge/evo-company%2Fhiku-blueviolet.svg?logo=github\n.. _project: https://github.com/evo-company/hiku\n.. |documentation| image:: https://img.shields.io/badge/docs-hiku.rtfd.io-blue.svg\n.. _documentation: https://hiku.readthedocs.io/en/latest/\n.. |version| image:: https://img.shields.io/pypi/v/hiku.svg?label=stable&color=green\n.. _version: https://pypi.org/project/hiku/\n.. |tag| image:: https://img.shields.io/github/tag/evo-company/hiku.svg?label=latest\n.. _tag: https://pypi.org/project/hiku/#history\n.. |license| image:: https://img.shields.io/pypi/l/hiku.svg\n.. _license: https://github.com/evo-company/hiku/blob/master/LICENSE.txt\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "Library to implement Graph APIs",
    "version": "0.7.2",
    "project_urls": {
        "Documentation": "https://hiku.readthedocs.io/en/latest/",
        "Homepage": "https://github.com/evo-company/hiku",
        "Repository": "https://github.com/evo-company/hiku"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b1c8e3ed2f9e3762ecc82a6a101157d8694a6ecdc977977ada4e0dcc99476046",
                "md5": "783703dfd320502a7c75ffba62a1c3d3",
                "sha256": "ac75b5b7df9cb8bf1a486986bf428e61153e3db6fa890e3750056abfa1945266"
            },
            "downloads": -1,
            "filename": "hiku-0.7.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "783703dfd320502a7c75ffba62a1c3d3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 111400,
            "upload_time": "2024-04-18T10:23:13",
            "upload_time_iso_8601": "2024-04-18T10:23:13.869837Z",
            "url": "https://files.pythonhosted.org/packages/b1/c8/e3ed2f9e3762ecc82a6a101157d8694a6ecdc977977ada4e0dcc99476046/hiku-0.7.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7c63b959725d91f84257d7e65519030d641e85a79a5f2cf8bc106e4751c1be06",
                "md5": "81afc118cc54c92cac71872366f57a34",
                "sha256": "ca58af98c71b0d4d036859968c4e702a8e81da26b102d1ad3b8b7e6e800dd7f8"
            },
            "downloads": -1,
            "filename": "hiku-0.7.2.tar.gz",
            "has_sig": false,
            "md5_digest": "81afc118cc54c92cac71872366f57a34",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 86344,
            "upload_time": "2024-04-18T10:23:16",
            "upload_time_iso_8601": "2024-04-18T10:23:16.237312Z",
            "url": "https://files.pythonhosted.org/packages/7c/63/b959725d91f84257d7e65519030d641e85a79a5f2cf8bc106e4751c1be06/hiku-0.7.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-18 10:23:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "evo-company",
    "github_project": "hiku",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "hiku"
}
        
Elapsed time: 0.24501s