crosszip


Namecrosszip JSON
Version 1.1.0 PyPI version JSON
download
home_pageNone
SummaryApply a given function to all combinations of elements from multiple iterables
upload_time2024-12-05 09:01:55
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
license# MIT License Copyright (c) 2024 crosszip authors 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 iterables
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            

# crosszip <img src="https://raw.githubusercontent.com/IndrajeetPatil/crosszip/main/docs/assets/logo.png" align="right" width="240" />

[![PyPI
version](https://img.shields.io/pypi/v/crosszip.png)](https://pypi.org/project/crosszip/)
![Python versions](https://img.shields.io/pypi/pyversions/crosszip.png)
[![PyPI
Downloads](https://img.shields.io/pypi/dm/crosszip.png)](https://pypistats.org/packages/crosszip)

`crosszip` is a Python utility that makes it easy to apply a function to
all possible combinations of elements from multiple iterables. It
combines the power of the Cartesian product and functional programming
into a single, intuitive tool.

Additionally, `@pytest.mark.crosszip_parametrize` is a `pytest` marker
that simplifies running tests with all possible combinations of
parameter values.

## Installation

| Package Manager | Installation Command      |
|-----------------|---------------------------|
| pip             | `pip install crosszip`    |
| uv              | `uv pip install crosszip` |

## Usage

Example of using `crosszip`:

``` python
# Label Generation for Machine Learning

from crosszip import crosszip


def create_label(category, subcategory, version):
    return f"{category}_{subcategory}_v{version}"


categories = ["cat", "dog"]
subcategories = ["small", "large"]
versions = ["1.0", "2.0"]

labels = crosszip(create_label, categories, subcategories, versions)
print(labels)
```

    ['cat_small_v1.0', 'cat_small_v2.0', 'cat_large_v1.0', 'cat_large_v2.0', 'dog_small_v1.0', 'dog_small_v2.0', 'dog_large_v1.0', 'dog_large_v2.0']

Example of using `pytest` marker `crosszip_parametrize`:

``` python
# Testing Power Function

import math
import crosszip
import pytest


@pytest.mark.crosszip_parametrize(
    "base",
    [2, 10],
    "exponent",
    [-1, 0, 1],
)
def test_power_function(base, exponent):
    result = math.pow(base, exponent)
    assert result == base**exponent
```

For more examples, check out the package documentation at:
<https://indrajeetpatil.github.io/crosszip/>

## Key Features

- **Flexible Input**: Works with any iterables, including lists, tuples,
  sets, and generators.
- **pytest Plugin**: Provides a `crosszip_parametrize` marker for
  running tests with all possible combinations of parameter values.
- **Simple API**: Minimalist, intuitive design for quick integration
  into your projects.

## License

This project is licensed under the MIT License.

## Acknowledgements

Hex sticker font is `Rubik`, and the image is taken from icon made by
Freepik and available at flaticon.com.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "crosszip",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "iterables",
    "author": null,
    "author_email": "Indrajeet Patil <patilindrajeet.science@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/ab/31/101e43d7df91fc0c63b9a7624dc2f09951ab4cdce0d21f03fde7ba382827/crosszip-1.1.0.tar.gz",
    "platform": null,
    "description": "\n\n# crosszip <img src=\"https://raw.githubusercontent.com/IndrajeetPatil/crosszip/main/docs/assets/logo.png\" align=\"right\" width=\"240\" />\n\n[![PyPI\nversion](https://img.shields.io/pypi/v/crosszip.png)](https://pypi.org/project/crosszip/)\n![Python versions](https://img.shields.io/pypi/pyversions/crosszip.png)\n[![PyPI\nDownloads](https://img.shields.io/pypi/dm/crosszip.png)](https://pypistats.org/packages/crosszip)\n\n`crosszip` is a Python utility that makes it easy to apply a function to\nall possible combinations of elements from multiple iterables. It\ncombines the power of the Cartesian product and functional programming\ninto a single, intuitive tool.\n\nAdditionally, `@pytest.mark.crosszip_parametrize` is a `pytest` marker\nthat simplifies running tests with all possible combinations of\nparameter values.\n\n## Installation\n\n| Package Manager | Installation Command      |\n|-----------------|---------------------------|\n| pip             | `pip install crosszip`    |\n| uv              | `uv pip install crosszip` |\n\n## Usage\n\nExample of using `crosszip`:\n\n``` python\n# Label Generation for Machine Learning\n\nfrom crosszip import crosszip\n\n\ndef create_label(category, subcategory, version):\n    return f\"{category}_{subcategory}_v{version}\"\n\n\ncategories = [\"cat\", \"dog\"]\nsubcategories = [\"small\", \"large\"]\nversions = [\"1.0\", \"2.0\"]\n\nlabels = crosszip(create_label, categories, subcategories, versions)\nprint(labels)\n```\n\n    ['cat_small_v1.0', 'cat_small_v2.0', 'cat_large_v1.0', 'cat_large_v2.0', 'dog_small_v1.0', 'dog_small_v2.0', 'dog_large_v1.0', 'dog_large_v2.0']\n\nExample of using `pytest` marker `crosszip_parametrize`:\n\n``` python\n# Testing Power Function\n\nimport math\nimport crosszip\nimport pytest\n\n\n@pytest.mark.crosszip_parametrize(\n    \"base\",\n    [2, 10],\n    \"exponent\",\n    [-1, 0, 1],\n)\ndef test_power_function(base, exponent):\n    result = math.pow(base, exponent)\n    assert result == base**exponent\n```\n\nFor more examples, check out the package documentation at:\n<https://indrajeetpatil.github.io/crosszip/>\n\n## Key Features\n\n- **Flexible Input**: Works with any iterables, including lists, tuples,\n  sets, and generators.\n- **pytest Plugin**: Provides a `crosszip_parametrize` marker for\n  running tests with all possible combinations of parameter values.\n- **Simple API**: Minimalist, intuitive design for quick integration\n  into your projects.\n\n## License\n\nThis project is licensed under the MIT License.\n\n## Acknowledgements\n\nHex sticker font is `Rubik`, and the image is taken from icon made by\nFreepik and available at flaticon.com.\n",
    "bugtrack_url": null,
    "license": "# MIT License  Copyright (c) 2024 crosszip authors  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": "Apply a given function to all combinations of elements from multiple iterables",
    "version": "1.1.0",
    "project_urls": {
        "Changelog": "https://github.com/IndrajeetPatil/crosszip/blob/main/CHANGELOG.md",
        "Documentation": "https://indrajeetpatil.github.io/crosszip/",
        "Homepage": "https://github.com/IndrajeetPatil/crosszip",
        "Issues": "https://github.com/IndrajeetPatil/crosszip/issues",
        "Repository": "https://github.com/IndrajeetPatil/crosszip"
    },
    "split_keywords": [
        "iterables"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "63065f985c8e0aeee7c3b5fab3221d498ec719cb9acd40af36e6d769b0194ba7",
                "md5": "f17a5584ec79b89d1b232eb5c3d02b05",
                "sha256": "7781fe7dde421f543c7a29c1ba2d884860a43397d7ef9ca4ce5ffe4cf5c5402f"
            },
            "downloads": -1,
            "filename": "crosszip-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f17a5584ec79b89d1b232eb5c3d02b05",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 6632,
            "upload_time": "2024-12-05T09:01:53",
            "upload_time_iso_8601": "2024-12-05T09:01:53.672819Z",
            "url": "https://files.pythonhosted.org/packages/63/06/5f985c8e0aeee7c3b5fab3221d498ec719cb9acd40af36e6d769b0194ba7/crosszip-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ab31101e43d7df91fc0c63b9a7624dc2f09951ab4cdce0d21f03fde7ba382827",
                "md5": "29261363556a25e350a94de2dab3cc16",
                "sha256": "33af260d575f6e5b24a02d80b6ec1ddb3e54f38921837f9219df8a20cd70bf18"
            },
            "downloads": -1,
            "filename": "crosszip-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "29261363556a25e350a94de2dab3cc16",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 222760,
            "upload_time": "2024-12-05T09:01:55",
            "upload_time_iso_8601": "2024-12-05T09:01:55.016053Z",
            "url": "https://files.pythonhosted.org/packages/ab/31/101e43d7df91fc0c63b9a7624dc2f09951ab4cdce0d21f03fde7ba382827/crosszip-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-05 09:01:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "IndrajeetPatil",
    "github_project": "crosszip",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "crosszip"
}
        
Elapsed time: 0.38686s