Name | convtools JSON |
Version |
1.14.3
JSON |
| download |
home_page | None |
Summary | dynamic, declarative data transformations with automatic code generation |
upload_time | 2024-09-16 20:37:10 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.6 |
license | The MIT License (MIT) Copyright (c) 2021 Nikita Almakov Copyright (c) 2020 iTechArt Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
etl
converters
codegen
convtools
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
|
# convtools
**convtools** is a Python library that simplifies data transformation by
allowing you to define them in a declarative way. It then generates the
necessary Python code in the background, saving you time and effort.
[![License](https://img.shields.io/github/license/westandskif/convtools.svg)](https://github.com/westandskif/convtools/blob/master/LICENSE.txt)
[![codecov](https://codecov.io/gh/westandskif/convtools/branch/master/graph/badge.svg)]( https://codecov.io/gh/westandskif/convtools)
[![Tests status](https://github.com/westandskif/convtools/workflows/tests/badge.svg)](https://github.com/westandskif/convtools/actions/workflows/pytest.yml)
[![Docs status](https://readthedocs.org/projects/convtools/badge/?version=latest)](https://convtools.readthedocs.io/en/latest/?badge=latest)
[![PyPI](https://badge.fury.io/py/convtools.svg)](https://pypi.org/project/convtools/)
[![Twitter](https://img.shields.io/twitter/url?label=convtools&style=social&url=https%3A%2F%2Ftwitter.com%2Fconvtools)](https://twitter.com/convtools)
[![Downloads](https://static.pepy.tech/badge/convtools)](https://pepy.tech/project/convtools)
[![Python versions](https://img.shields.io/pypi/pyversions/convtools.svg)](https://pypi.org/project/convtools/)
____
## Installation
`pip install convtools`
## Documentation
**[convtools.readthedocs.io](https://convtools.readthedocs.io/en/latest/)**
## Group by example
```python
from convtools import conversion as c
input_data = [
{"a": 5, "b": "foo"},
{"a": 10, "b": "foo"},
{"a": 10, "b": "bar"},
{"a": 10, "b": "bar"},
{"a": 20, "b": "bar"},
]
conv = (
c.group_by(c.item("b"))
.aggregate(
{
"b": c.item("b"),
"a_first": c.ReduceFuncs.First(c.item("a")),
"a_max": c.ReduceFuncs.Max(c.item("a")),
}
)
.pipe(
c.aggregate({
"b_values": c.ReduceFuncs.Array(c.item("b")),
"mode_a_first": c.ReduceFuncs.Mode(c.item("a_first")),
"median_a_max": c.ReduceFuncs.Median(c.item("a_max")),
})
)
.gen_converter()
)
assert conv(input_data) == {
'b_values': ['foo', 'bar'],
'mode_a_first': 10,
'median_a_max': 15.0
}
```
##### Built-in reducers like `c.ReduceFuncs.First`
* Sum
* SumOrNone
* Max
* MaxRow
* Min
* MinRow
* Count
* CountDistinct
* First
* Last
* Average
* Median
* Percentile
* Mode
* TopK
* Array
* ArrayDistinct
* ArraySorted
DICT REDUCERS ARE IN FACT AGGREGATIONS THEMSELVES, BECAUSE VALUES GET REDUCED.
* Dict
* DictArray
* DictSum
* DictSumOrNone
* DictMax
* DictMin
* DictCount
* DictCountDistinct
* DictFirst
* DictLast
AND LASTLY YOU CAN DEFINE YOUR OWN REDUCER BY PASSING ANY REDUCE FUNCTION
OF TWO ARGUMENTS TO ``c.reduce``.
## What's the point if there are tools like Pandas / Polars?
* convtools doesn't need to wrap data in a container to provide functionality,
it simply runs the python code it generates on **any input**
* convtools is lightweight (_though optional `black` is highly recommended for
pretty-printing generated code out of curiosity_)
* convtools fosters building pipelines on top of iterators, allowing for stream
processing
* convtools supports nested aggregations
* convtools is a set of primitives for code generation, so it's just different.
## Contributing
The best way to support the development of convtools is to spread the word!
Also, if you already are a convtools user, we would love to hear about your use
cases and challenges in the [Discussions
section](https://github.com/westandskif/convtools/discussions).
To report a bug or suggest enhancements, please open [an
issue](https://github.com/westandskif/convtools/issues) and/or submit [a pull
request](https://github.com/westandskif/convtools/pulls).
**Reporting a Security Vulnerability**: see the [security policy](https://github.com/westandskif/convtools/security/policy).
Raw data
{
"_id": null,
"home_page": null,
"name": "convtools",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "Nikita Almakov <nikita.almakov@gmail.com>",
"keywords": "etl, converters, codegen, convtools",
"author": null,
"author_email": "Nikita Almakov <nikita.almakov@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/54/7a/0d449f843759b1f4e6e76a617ef8434c280d468b8c2522f9dbe72181396a/convtools-1.14.3.tar.gz",
"platform": null,
"description": "# convtools\n\n**convtools** is a Python library that simplifies data transformation by\nallowing you to define them in a declarative way. It then generates the\nnecessary Python code in the background, saving you time and effort.\n\n[![License](https://img.shields.io/github/license/westandskif/convtools.svg)](https://github.com/westandskif/convtools/blob/master/LICENSE.txt)\n[![codecov](https://codecov.io/gh/westandskif/convtools/branch/master/graph/badge.svg)]( https://codecov.io/gh/westandskif/convtools)\n[![Tests status](https://github.com/westandskif/convtools/workflows/tests/badge.svg)](https://github.com/westandskif/convtools/actions/workflows/pytest.yml)\n[![Docs status](https://readthedocs.org/projects/convtools/badge/?version=latest)](https://convtools.readthedocs.io/en/latest/?badge=latest)\n[![PyPI](https://badge.fury.io/py/convtools.svg)](https://pypi.org/project/convtools/)\n[![Twitter](https://img.shields.io/twitter/url?label=convtools&style=social&url=https%3A%2F%2Ftwitter.com%2Fconvtools)](https://twitter.com/convtools)\n[![Downloads](https://static.pepy.tech/badge/convtools)](https://pepy.tech/project/convtools)\n[![Python versions](https://img.shields.io/pypi/pyversions/convtools.svg)](https://pypi.org/project/convtools/)\n\n____\n\n## Installation\n\n`pip install convtools`\n\n## Documentation\n\n**[convtools.readthedocs.io](https://convtools.readthedocs.io/en/latest/)**\n\n\n## Group by example\n\n```python\nfrom convtools import conversion as c\n\ninput_data = [\n {\"a\": 5, \"b\": \"foo\"},\n {\"a\": 10, \"b\": \"foo\"},\n {\"a\": 10, \"b\": \"bar\"},\n {\"a\": 10, \"b\": \"bar\"},\n {\"a\": 20, \"b\": \"bar\"},\n]\n\nconv = (\n c.group_by(c.item(\"b\"))\n .aggregate(\n {\n \"b\": c.item(\"b\"),\n \"a_first\": c.ReduceFuncs.First(c.item(\"a\")),\n \"a_max\": c.ReduceFuncs.Max(c.item(\"a\")),\n }\n )\n .pipe(\n c.aggregate({\n \"b_values\": c.ReduceFuncs.Array(c.item(\"b\")),\n \"mode_a_first\": c.ReduceFuncs.Mode(c.item(\"a_first\")),\n \"median_a_max\": c.ReduceFuncs.Median(c.item(\"a_max\")),\n })\n )\n .gen_converter()\n)\n\nassert conv(input_data) == {\n 'b_values': ['foo', 'bar'],\n 'mode_a_first': 10,\n 'median_a_max': 15.0\n}\n\n```\n\n##### Built-in reducers like `c.ReduceFuncs.First`\n * Sum\n * SumOrNone\n * Max\n * MaxRow\n * Min\n * MinRow\n * Count\n * CountDistinct\n * First\n * Last\n * Average\n * Median\n * Percentile\n * Mode\n * TopK\n * Array\n * ArrayDistinct\n * ArraySorted\n\n DICT REDUCERS ARE IN FACT AGGREGATIONS THEMSELVES, BECAUSE VALUES GET REDUCED.\n * Dict\n * DictArray\n * DictSum\n * DictSumOrNone\n * DictMax\n * DictMin\n * DictCount\n * DictCountDistinct\n * DictFirst\n * DictLast\n\n AND LASTLY YOU CAN DEFINE YOUR OWN REDUCER BY PASSING ANY REDUCE FUNCTION\n OF TWO ARGUMENTS TO ``c.reduce``.\n\n\n## What's the point if there are tools like Pandas / Polars?\n\n* convtools doesn't need to wrap data in a container to provide functionality,\n it simply runs the python code it generates on **any input**\n* convtools is lightweight (_though optional `black` is highly recommended for\n pretty-printing generated code out of curiosity_)\n* convtools fosters building pipelines on top of iterators, allowing for stream\n processing\n* convtools supports nested aggregations\n* convtools is a set of primitives for code generation, so it's just different.\n\n## Contributing\n\nThe best way to support the development of convtools is to spread the word!\n\nAlso, if you already are a convtools user, we would love to hear about your use\ncases and challenges in the [Discussions\nsection](https://github.com/westandskif/convtools/discussions).\n\nTo report a bug or suggest enhancements, please open [an\nissue](https://github.com/westandskif/convtools/issues) and/or submit [a pull\nrequest](https://github.com/westandskif/convtools/pulls).\n\n\n**Reporting a Security Vulnerability**: see the [security policy](https://github.com/westandskif/convtools/security/policy).\n",
"bugtrack_url": null,
"license": "The MIT License (MIT) Copyright (c) 2021 Nikita Almakov Copyright (c) 2020 iTechArt Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "dynamic, declarative data transformations with automatic code generation",
"version": "1.14.3",
"project_urls": {
"changelog": "https://github.com/westandskif/convtools/blob/master/docs/CHANGELOG.md",
"documentation": "https://convtools.readthedocs.io/en/latest/",
"homepage": "https://github.com/westandskif/convtools",
"repository": "https://github.com/westandskif/convtools"
},
"split_keywords": [
"etl",
" converters",
" codegen",
" convtools"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9a37d46e305182e5df878f55bf8a4814fda3f6e587810469ccb860a46b2b461d",
"md5": "70b3c8ac4621a9aa0ff7a25c12d18f83",
"sha256": "ab06079c3461d6bb3202591b9e4c01bf40d02e6aaa0ebd5ed0f791a4956a1cb6"
},
"downloads": -1,
"filename": "convtools-1.14.3-cp310-abi3-macosx_10_9_x86_64.whl",
"has_sig": false,
"md5_digest": "70b3c8ac4621a9aa0ff7a25c12d18f83",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.6",
"size": 93821,
"upload_time": "2024-09-16T20:37:04",
"upload_time_iso_8601": "2024-09-16T20:37:04.247097Z",
"url": "https://files.pythonhosted.org/packages/9a/37/d46e305182e5df878f55bf8a4814fda3f6e587810469ccb860a46b2b461d/convtools-1.14.3-cp310-abi3-macosx_10_9_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "706c0564f9d51d819ff3f217a9208adb1902fb836f0e76a0f274d36a2e629ded",
"md5": "4898f256cf239f6f46034e201f14e894",
"sha256": "7256ec584bcc76fa459215cd4a4cc0af70b17d900d74956ebb2a70dc8d7b5bc4"
},
"downloads": -1,
"filename": "convtools-1.14.3-cp310-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "4898f256cf239f6f46034e201f14e894",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.6",
"size": 94120,
"upload_time": "2024-09-16T20:37:05",
"upload_time_iso_8601": "2024-09-16T20:37:05.906566Z",
"url": "https://files.pythonhosted.org/packages/70/6c/0564f9d51d819ff3f217a9208adb1902fb836f0e76a0f274d36a2e629ded/convtools-1.14.3-cp310-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5a4e0d10e307031ea20789db9734cc9d9dc9bd94f48f096c7de57c4c359e65f8",
"md5": "18e28fb32874b106e3d0c5bcff9cb503",
"sha256": "e4ee09a175529a080135870003fc732f72e45ca5793d1e91a37d288aec3fa5f3"
},
"downloads": -1,
"filename": "convtools-1.14.3-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "18e28fb32874b106e3d0c5bcff9cb503",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.6",
"size": 98853,
"upload_time": "2024-09-16T20:37:07",
"upload_time_iso_8601": "2024-09-16T20:37:07.374175Z",
"url": "https://files.pythonhosted.org/packages/5a/4e/0d10e307031ea20789db9734cc9d9dc9bd94f48f096c7de57c4c359e65f8/convtools-1.14.3-cp310-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "abd038bad37b61f2d00c297e076442bd67314475ba191131774f1ecc158fb507",
"md5": "783a9140760b1118add4975488c66eda",
"sha256": "5f0ab03ba803965f05d88d8fa436b7a63fe605669f52ccbab1036c8d0cfd83a7"
},
"downloads": -1,
"filename": "convtools-1.14.3-cp310-abi3-musllinux_1_2_x86_64.whl",
"has_sig": false,
"md5_digest": "783a9140760b1118add4975488c66eda",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.6",
"size": 98694,
"upload_time": "2024-09-16T20:37:08",
"upload_time_iso_8601": "2024-09-16T20:37:08.478524Z",
"url": "https://files.pythonhosted.org/packages/ab/d0/38bad37b61f2d00c297e076442bd67314475ba191131774f1ecc158fb507/convtools-1.14.3-cp310-abi3-musllinux_1_2_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4407660489b42c0fec36b221a68e52cc4841fdc9c7e73b3d0cc535c5208990b9",
"md5": "7b6171e96f902da61a561bfcb223d194",
"sha256": "c55aa8c6b64cfb68999c4d6c9c9c8ec82411360e2b5cf79ef5f0473b98026388"
},
"downloads": -1,
"filename": "convtools-1.14.3-cp310-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "7b6171e96f902da61a561bfcb223d194",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.6",
"size": 97597,
"upload_time": "2024-09-16T20:37:09",
"upload_time_iso_8601": "2024-09-16T20:37:09.451864Z",
"url": "https://files.pythonhosted.org/packages/44/07/660489b42c0fec36b221a68e52cc4841fdc9c7e73b3d0cc535c5208990b9/convtools-1.14.3-cp310-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "547a0d449f843759b1f4e6e76a617ef8434c280d468b8c2522f9dbe72181396a",
"md5": "4b6f140e5888f6e27519720869e3444e",
"sha256": "26dca320b0897b9df93c2b182ef39af09497ccfe9e464f1b36381a289d72a9a6"
},
"downloads": -1,
"filename": "convtools-1.14.3.tar.gz",
"has_sig": false,
"md5_digest": "4b6f140e5888f6e27519720869e3444e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 132177,
"upload_time": "2024-09-16T20:37:10",
"upload_time_iso_8601": "2024-09-16T20:37:10.740937Z",
"url": "https://files.pythonhosted.org/packages/54/7a/0d449f843759b1f4e6e76a617ef8434c280d468b8c2522f9dbe72181396a/convtools-1.14.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-16 20:37:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "westandskif",
"github_project": "convtools",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "convtools"
}