crosszip 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. crosszip-0.1.0/.github/dependabot.yaml +8 -0
  2. crosszip-0.1.0/.github/workflows/ci.yml +61 -0
  3. crosszip-0.1.0/.github/workflows/docs.yml +39 -0
  4. crosszip-0.1.0/.github/workflows/release.yml +25 -0
  5. crosszip-0.1.0/.gitignore +38 -0
  6. crosszip-0.1.0/.pre-commit-config.yaml +21 -0
  7. crosszip-0.1.0/.python-version +1 -0
  8. crosszip-0.1.0/CHANGELOG.md +0 -0
  9. crosszip-0.1.0/CODE_OF_CONDUCT.md +126 -0
  10. crosszip-0.1.0/LICENSE.md +21 -0
  11. crosszip-0.1.0/Makefile +78 -0
  12. crosszip-0.1.0/PKG-INFO +133 -0
  13. crosszip-0.1.0/README.md +91 -0
  14. crosszip-0.1.0/crosszip.Rproj +18 -0
  15. crosszip-0.1.0/crosszip.code-workspace +8 -0
  16. crosszip-0.1.0/docs/assets/logo.png +0 -0
  17. crosszip-0.1.0/docs/crosszip.md +104 -0
  18. crosszip-0.1.0/docs/favicon/apple-touch-icon.png +0 -0
  19. crosszip-0.1.0/docs/favicon/favicon-96x96.png +0 -0
  20. crosszip-0.1.0/docs/favicon/favicon.ico +0 -0
  21. crosszip-0.1.0/docs/favicon/favicon.svg +3 -0
  22. crosszip-0.1.0/docs/favicon/site.webmanifest +21 -0
  23. crosszip-0.1.0/docs/favicon/web-app-manifest-192x192.png +0 -0
  24. crosszip-0.1.0/docs/favicon/web-app-manifest-512x512.png +0 -0
  25. crosszip-0.1.0/docs/index.md +83 -0
  26. crosszip-0.1.0/docs/pytest-plugin.md +89 -0
  27. crosszip-0.1.0/hextools/data.png +0 -0
  28. crosszip-0.1.0/hextools/script.R +41 -0
  29. crosszip-0.1.0/mkdocs.yml +71 -0
  30. crosszip-0.1.0/pyproject.toml +70 -0
  31. crosszip-0.1.0/requirements.txt +2 -0
  32. crosszip-0.1.0/src/crosszip/__init__.py +1 -0
  33. crosszip-0.1.0/src/crosszip/crosszip.py +75 -0
  34. crosszip-0.1.0/src/crosszip/py.typed +0 -0
  35. crosszip-0.1.0/src/crosszip_parametrize/__init__.py +1 -0
  36. crosszip-0.1.0/src/crosszip_parametrize/crosszip_parametrize.py +43 -0
  37. crosszip-0.1.0/src/crosszip_parametrize/py.typed +0 -0
  38. crosszip-0.1.0/tests/__init__.py +0 -0
  39. crosszip-0.1.0/tests/snapshots/test_crosszip/test_crosszip_with_iterables/12-ab-xy-string_inputs/string_inputs.json +10 -0
  40. crosszip-0.1.0/tests/snapshots/test_crosszip/test_crosszip_with_iterables/iterable10-iterable20-iterable30-list_inputs/list_inputs.json +10 -0
  41. crosszip-0.1.0/tests/snapshots/test_crosszip/test_crosszip_with_iterables/iterable11-iterable21-iterable31-tuple_inputs/tuple_inputs.json +10 -0
  42. crosszip-0.1.0/tests/test_crosszip.py +98 -0
  43. crosszip-0.1.0/tests/test_crosszip_parametrize.py +101 -0
  44. crosszip-0.1.0/uv.lock +334 -0
@@ -0,0 +1,8 @@
1
+ version: 2
2
+
3
+ updates:
4
+ # Keep dependencies for GitHub Actions up-to-date
5
+ - package-ecosystem: "github-actions"
6
+ directory: "/"
7
+ schedule:
8
+ interval: "weekly"
@@ -0,0 +1,61 @@
1
+ name: Package Checks
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ qa:
11
+ name: QA
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - name: Checkout Code
16
+ uses: actions/checkout@v4
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: 3.13
22
+
23
+ - name: Install Dependencies
24
+ run: |
25
+ python3 -m venv .venv
26
+ .venv/bin/pip install --upgrade pip
27
+ pip install uv
28
+ uv sync --frozen
29
+
30
+ - name: Run pre-commit hooks
31
+ run: .venv/bin/pre-commit run --all-files
32
+
33
+ - name: Compute Coverage
34
+ run: |
35
+ .venv/bin/coverage run -m pytest tests/ && .venv/bin/coverage report --fail-under=95 && .venv/bin/coverage html
36
+
37
+ test:
38
+ name: Run Tests
39
+ runs-on: ${{ matrix.os }}
40
+ strategy:
41
+ matrix:
42
+ os: [ubuntu-latest, macos-latest]
43
+ python-version: [3.12, 3.13]
44
+ steps:
45
+ - name: Checkout Code
46
+ uses: actions/checkout@v4
47
+
48
+ - name: Set up Python
49
+ uses: actions/setup-python@v5
50
+ with:
51
+ python-version: ${{ matrix.python-version }}
52
+
53
+ - name: Install Dependencies
54
+ run: |
55
+ python3 -m venv .venv
56
+ .venv/bin/pip install --upgrade pip
57
+ pip install uv
58
+ uv sync --frozen
59
+
60
+ - name: Run Tests
61
+ run: .venv/bin/pytest . -vv --random-order
@@ -0,0 +1,39 @@
1
+ name: Docs
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ permissions:
10
+ contents: write
11
+
12
+ jobs:
13
+ build-docs:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Configure Git Credentials
19
+ run: |
20
+ git config user.name github-actions[bot]
21
+ git config user.email 41898282+github-actions[bot]@users.noreply.github.com
22
+
23
+ - uses: actions/setup-python@v5
24
+ with:
25
+ python-version: 3.13
26
+
27
+ - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
28
+ - uses: actions/cache@v4
29
+ with:
30
+ key: mkdocs-material-${{ env.cache_id }}
31
+ path: .cache
32
+ restore-keys: |
33
+ mkdocs-material-
34
+
35
+ - run: pip install mkdocs-material
36
+
37
+ - name: Deploy
38
+ if: github.ref == 'refs/heads/main'
39
+ run: mkdocs gh-deploy --force
@@ -0,0 +1,25 @@
1
+ name: Publish to PyPI
2
+ on:
3
+ release:
4
+ types: [published]
5
+
6
+ jobs:
7
+ pypi-publish:
8
+ name: Upload release to PyPI
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ id-token: write
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - name: Set up Python
15
+ uses: actions/setup-python@v5
16
+ with:
17
+ python-version: 3.13
18
+ - name: Install dependencies
19
+ run: |
20
+ python -m pip install --upgrade pip
21
+ pip install build
22
+ - name: Build package
23
+ run: python -m build
24
+ - name: Publish package
25
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,38 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+ .DS_Store
12
+
13
+ # mkdocs documentation
14
+ /site
15
+ README.html
16
+ README_files/
17
+
18
+ # Installer logs
19
+ pip-log.txt
20
+ pip-delete-this-directory.txt
21
+
22
+ # Unit test / coverage reports
23
+ htmlcov/
24
+ .tox/
25
+ .nox/
26
+ .coverage
27
+ .coverage.*
28
+ .cache
29
+ nosetests.xml
30
+ coverage.xml
31
+ *.cover
32
+ *.py,cover
33
+ .hypothesis/
34
+ .pytest_cache/
35
+ cover/
36
+ repos/
37
+ .Rproj.user
38
+ .Rhistory
@@ -0,0 +1,21 @@
1
+ default_stages: [pre-commit]
2
+ default_language_version:
3
+ python: python3.13
4
+
5
+ repos:
6
+ - repo: https://github.com/astral-sh/ruff-pre-commit
7
+ rev: v0.8.0
8
+ hooks:
9
+ - id: ruff
10
+ args: [--fix]
11
+ - id: ruff-format
12
+
13
+ - repo: https://github.com/pre-commit/mirrors-mypy
14
+ rev: v1.13.0
15
+ hooks:
16
+ - id: mypy
17
+
18
+ - repo: https://github.com/asottile/dead
19
+ rev: v1.5.2
20
+ hooks:
21
+ - id: dead
@@ -0,0 +1 @@
1
+ 3.13
File without changes
@@ -0,0 +1,126 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at codeofconduct@rstudio.com.
63
+ All complaints will be reviewed and investigated promptly and fairly.
64
+
65
+ All community leaders are obligated to respect the privacy and security of the
66
+ reporter of any incident.
67
+
68
+ ## Enforcement Guidelines
69
+
70
+ Community leaders will follow these Community Impact Guidelines in determining
71
+ the consequences for any action they deem in violation of this Code of Conduct:
72
+
73
+ ### 1. Correction
74
+
75
+ **Community Impact**: Use of inappropriate language or other behavior deemed
76
+ unprofessional or unwelcome in the community.
77
+
78
+ **Consequence**: A private, written warning from community leaders, providing
79
+ clarity around the nature of the violation and an explanation of why the
80
+ behavior was inappropriate. A public apology may be requested.
81
+
82
+ ### 2. Warning
83
+
84
+ **Community Impact**: A violation through a single incident or series of
85
+ actions.
86
+
87
+ **Consequence**: A warning with consequences for continued behavior. No
88
+ interaction with the people involved, including unsolicited interaction with
89
+ those enforcing the Code of Conduct, for a specified period of time. This
90
+ includes avoiding interactions in community spaces as well as external channels
91
+ like social media. Violating these terms may lead to a temporary or permanent
92
+ ban.
93
+
94
+ ### 3. Temporary Ban
95
+
96
+ **Community Impact**: A serious violation of community standards, including
97
+ sustained inappropriate behavior.
98
+
99
+ **Consequence**: A temporary ban from any sort of interaction or public
100
+ communication with the community for a specified period of time. No public or
101
+ private interaction with the people involved, including unsolicited interaction
102
+ with those enforcing the Code of Conduct, is allowed during this period.
103
+ Violating these terms may lead to a permanent ban.
104
+
105
+ ### 4. Permanent Ban
106
+
107
+ **Community Impact**: Demonstrating a pattern of violation of community
108
+ standards, including sustained inappropriate behavior, harassment of an
109
+ individual, or aggression toward or disparagement of classes of individuals.
110
+
111
+ **Consequence**: A permanent ban from any sort of public interaction within the
112
+ community.
113
+
114
+ ## Attribution
115
+
116
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
117
+ version 2.1, available at
118
+ <https://www.contributor-covenant.org/version/2/1/code_of_conduct.html>.
119
+
120
+ Community Impact Guidelines were inspired by
121
+ [Mozilla's code of conduct enforcement ladder][https://github.com/mozilla/inclusion].
122
+
123
+ For answers to common questions about this code of conduct, see the FAQ at
124
+ <https://www.contributor-covenant.org/faq>. Translations are available at <https://www.contributor-covenant.org/translations>.
125
+
126
+ [homepage]: https://www.contributor-covenant.org
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2024 crosszip authors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,78 @@
1
+ .EXPORT_ALL_VARIABLES:
2
+ SHELL=/bin/bash
3
+ VIRTUAL_ENV ?= ${PWD}/.venv
4
+
5
+ venv:
6
+ rm -rf $(VIRTUAL_ENV) && python3.13 -m venv $(VIRTUAL_ENV)
7
+ $(VIRTUAL_ENV)/bin/pip install --upgrade pip
8
+ pip install uv
9
+ uv sync --frozen
10
+
11
+ activate:
12
+ . $(VIRTUAL_ENV)/bin/activate
13
+
14
+ ## Test package
15
+
16
+ test: activate
17
+ $(VIRTUAL_ENV)/bin/pytest . -vv --random-order
18
+
19
+ coverage: activate
20
+ $(VIRTUAL_ENV)/bin/coverage run -m pytest . && $(VIRTUAL_ENV)/bin/coverage report --fail-under=95 && $(VIRTUAL_ENV)/bin/coverage html;
21
+
22
+ test-package: test coverage
23
+
24
+ ## Code quality
25
+
26
+ format:
27
+ $(VIRTUAL_ENV)/bin/pre-commit run --hook-stage commit ruff-format --all-files
28
+
29
+ lint:
30
+ $(VIRTUAL_ENV)/bin/pre-commit run --hook-stage commit ruff --all-files
31
+
32
+ mypy:
33
+ $(VIRTUAL_ENV)/bin/pre-commit run --hook-stage commit mypy --all-files
34
+
35
+ qa: format lint mypy
36
+
37
+ ## Check package
38
+
39
+ build: activate
40
+ uv build
41
+
42
+ check-package: test-package qa build
43
+
44
+
45
+ help:
46
+ @echo "Usage: make [target]"
47
+ @echo ""
48
+ @echo "Targets:"
49
+ @echo " venv Create a virtual environment"
50
+ @echo " activate Activate the virtual environment"
51
+ @echo " test Run tests"
52
+ @echo " coverage Run tests and generate coverage report"
53
+ @echo " test-package Run tests, generate coverage report and check coverage"
54
+ @echo " format Format code"
55
+ @echo " lint Lint code"
56
+ @echo " mypy Type check code"
57
+ @echo " qa Run format, lint and mypy"
58
+ @echo " build Build package"
59
+ @echo " check-package Run tests, generate coverage report, check coverage, format, lint, mypy and build"
60
+ @echo " help Show this help message"
61
+ @echo ""
62
+ @echo "Variables:"
63
+ @echo " VIRTUAL_ENV Path to the virtual environment"
64
+ @echo ""
65
+ @echo "Examples:"
66
+ @echo " make test"
67
+ @echo " make coverage"
68
+ @echo " make test-package"
69
+ @echo " make format"
70
+ @echo " make lint"
71
+ @echo " make mypy"
72
+ @echo " make qa"
73
+ @echo " make build"
74
+ @echo " make check-package"
75
+ @echo " make help"
76
+ @echo ""
77
+ @echo "For more information, see the Makefile"
78
+ @echo ""
@@ -0,0 +1,133 @@
1
+ Metadata-Version: 2.3
2
+ Name: crosszip
3
+ Version: 0.1.0
4
+ Summary: Apply a given function to all combinations of elements from multiple iterables
5
+ Project-URL: Repository, https://github.com/IndrajeetPatil/crosszip
6
+ Project-URL: Changelog, https://github.com/IndrajeetPatil/crosszip/blob/main/CHANGELOG.md
7
+ Author-email: Indrajeet Patil <patilindrajeet.science@gmail.com>
8
+ License: # MIT License
9
+
10
+ Copyright (c) 2024 crosszip authors
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+ Keywords: iterables
30
+ Classifier: Development Status :: 4 - Beta
31
+ Classifier: Environment :: Console
32
+ Classifier: Intended Audience :: Developers
33
+ Classifier: License :: OSI Approved :: MIT License
34
+ Classifier: Operating System :: OS Independent
35
+ Classifier: Programming Language :: Python
36
+ Classifier: Programming Language :: Python :: 3 :: Only
37
+ Classifier: Programming Language :: Python :: 3.12
38
+ Classifier: Programming Language :: Python :: 3.13
39
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
40
+ Requires-Python: >=3.12
41
+ Description-Content-Type: text/markdown
42
+
43
+ # crosszip <img src="docs/assets/logo.png" align="right" width="240" />
44
+
45
+ [![PyPI Version](https://img.shields.io/pypi/v/crosszip.svg)](https://pypi.org/project/crosszip/)
46
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
47
+
48
+ `crosszip` is a Python utility that makes it easy to apply a function to all possible combinations of elements from multiple iterables.
49
+ It combines the power of the Cartesian product and functional programming into a single, intuitive tool.
50
+
51
+ Additionally, `crosszip_parametrize` Pytest plugin is a decorator that simplifies running tests with all possible combinations of parameter values.
52
+ This is particularly useful for testing functions or components across multiple dimensions of input parameters.
53
+
54
+ ---
55
+
56
+ ## Installation
57
+
58
+ Install `crosszip` via pip:
59
+
60
+ ```bash
61
+ pip install crosszip
62
+ ```
63
+
64
+ Registering the crosszip marker for pytest is simple. Just add the following to your `pytest.ini` file:
65
+
66
+ ```
67
+ [pytest]
68
+ markers =
69
+ crosszip_parametrize: "mark test function for crosszip parametrization"
70
+ ```
71
+
72
+ ---
73
+
74
+ ## Key Features
75
+
76
+ - **Flexible Input**: Works with any iterables, including lists, tuples, sets, and generators.
77
+ - **pytest Plugin**: Supports parametrization of tests using `crosszip`.
78
+ - **Simple API**: Minimalist, intuitive design for quick integration into your projects.
79
+
80
+ ---
81
+
82
+ ## Usage
83
+
84
+ Example of using `crosszip`:
85
+
86
+ ```python
87
+ # Label Generation for Machine Learning
88
+
89
+ from crosszip import crosszip
90
+
91
+ def create_label(category, subcategory, version):
92
+ return f"{category}_{subcategory}_v{version}"
93
+
94
+ categories = ["cat", "dog"]
95
+ subcategories = ["small", "large"]
96
+ versions = ["1.0", "2.0"]
97
+
98
+ labels = crosszip(create_label, categories, subcategories, versions)
99
+ print(labels)
100
+ # Output: ['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']
101
+ ```
102
+
103
+ Example of using `pytest` marker `crosszip_parametrize`:
104
+
105
+ ```python
106
+ # Testing Power Function
107
+
108
+ import math
109
+ from crosszip_parametrize import crosszip_parametrize
110
+
111
+ @crosszip_parametrize(
112
+ "base", [2, 10],
113
+ "exponent", [-1, 0, 1],
114
+ )
115
+ def test_power_function(base, exponent):
116
+ result = math.pow(base, exponent)
117
+ assert result == base ** exponent
118
+ ```
119
+
120
+ For more examples, check out the package documentation at:
121
+ https://indrajeetpatil.github.io/crosszip/
122
+
123
+ ---
124
+
125
+ ## License
126
+
127
+ This project is licensed under the [MIT License](LICENSE.md).
128
+
129
+ ---
130
+
131
+ ## Acknowledgements
132
+
133
+ Hex sticker font is `Rubik`, and the image is taken from icon made by Freepik and available at flaticon.com.
@@ -0,0 +1,91 @@
1
+ # crosszip <img src="docs/assets/logo.png" align="right" width="240" />
2
+
3
+ [![PyPI Version](https://img.shields.io/pypi/v/crosszip.svg)](https://pypi.org/project/crosszip/)
4
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ `crosszip` is a Python utility that makes it easy to apply a function to all possible combinations of elements from multiple iterables.
7
+ It combines the power of the Cartesian product and functional programming into a single, intuitive tool.
8
+
9
+ Additionally, `crosszip_parametrize` Pytest plugin is a decorator that simplifies running tests with all possible combinations of parameter values.
10
+ This is particularly useful for testing functions or components across multiple dimensions of input parameters.
11
+
12
+ ---
13
+
14
+ ## Installation
15
+
16
+ Install `crosszip` via pip:
17
+
18
+ ```bash
19
+ pip install crosszip
20
+ ```
21
+
22
+ Registering the crosszip marker for pytest is simple. Just add the following to your `pytest.ini` file:
23
+
24
+ ```
25
+ [pytest]
26
+ markers =
27
+ crosszip_parametrize: "mark test function for crosszip parametrization"
28
+ ```
29
+
30
+ ---
31
+
32
+ ## Key Features
33
+
34
+ - **Flexible Input**: Works with any iterables, including lists, tuples, sets, and generators.
35
+ - **pytest Plugin**: Supports parametrization of tests using `crosszip`.
36
+ - **Simple API**: Minimalist, intuitive design for quick integration into your projects.
37
+
38
+ ---
39
+
40
+ ## Usage
41
+
42
+ Example of using `crosszip`:
43
+
44
+ ```python
45
+ # Label Generation for Machine Learning
46
+
47
+ from crosszip import crosszip
48
+
49
+ def create_label(category, subcategory, version):
50
+ return f"{category}_{subcategory}_v{version}"
51
+
52
+ categories = ["cat", "dog"]
53
+ subcategories = ["small", "large"]
54
+ versions = ["1.0", "2.0"]
55
+
56
+ labels = crosszip(create_label, categories, subcategories, versions)
57
+ print(labels)
58
+ # Output: ['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']
59
+ ```
60
+
61
+ Example of using `pytest` marker `crosszip_parametrize`:
62
+
63
+ ```python
64
+ # Testing Power Function
65
+
66
+ import math
67
+ from crosszip_parametrize import crosszip_parametrize
68
+
69
+ @crosszip_parametrize(
70
+ "base", [2, 10],
71
+ "exponent", [-1, 0, 1],
72
+ )
73
+ def test_power_function(base, exponent):
74
+ result = math.pow(base, exponent)
75
+ assert result == base ** exponent
76
+ ```
77
+
78
+ For more examples, check out the package documentation at:
79
+ https://indrajeetpatil.github.io/crosszip/
80
+
81
+ ---
82
+
83
+ ## License
84
+
85
+ This project is licensed under the [MIT License](LICENSE.md).
86
+
87
+ ---
88
+
89
+ ## Acknowledgements
90
+
91
+ Hex sticker font is `Rubik`, and the image is taken from icon made by Freepik and available at flaticon.com.
@@ -0,0 +1,18 @@
1
+ Version: 1.0
2
+
3
+ RestoreWorkspace: Default
4
+ SaveWorkspace: Default
5
+ AlwaysSaveHistory: Default
6
+
7
+ EnableCodeIndexing: Yes
8
+ UseSpacesForTab: Yes
9
+ NumSpacesForTab: 2
10
+ Encoding: UTF-8
11
+
12
+ RnwWeave: knitr
13
+ LaTeX: pdfLaTeX
14
+
15
+ AutoAppendNewline: Yes
16
+ StripTrailingWhitespace: Yes
17
+
18
+ BuildType: Makefile
@@ -0,0 +1,8 @@
1
+ {
2
+ "folders": [
3
+ {
4
+ "path": "."
5
+ }
6
+ ],
7
+ "settings": {}
8
+ }
Binary file