am-i-even-or-odd 0.2.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ken Kambi
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,96 @@
1
+ Metadata-Version: 2.4
2
+ Name: am-i-even-or-odd
3
+ Version: 0.2.0
4
+ Summary: A tiny Python library for checking whether numbers are even or odd.
5
+ Author: Ken Kambi
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/KenKambi/am-i-even-or-odd
8
+ Project-URL: Repository, https://github.com/KenKambi/am-i-even-or-odd
9
+ Project-URL: Bug Tracker, https://github.com/KenKambi/am-i-even-or-odd/issues
10
+ Project-URL: Changelog, https://github.com/KenKambi/am-i-even-or-odd/blob/main/CHANGELOG.md
11
+ Keywords: even,odd,math,parity,python
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: License :: OSI Approved :: MIT License
22
+ Classifier: Operating System :: OS Independent
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.8
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.0; extra == "dev"
29
+ Dynamic: license-file
30
+
31
+ # Am I Even Or Odd
32
+
33
+ [![PyPI version](https://img.shields.io/pypi/v/am-i-even-or-odd.svg)](https://pypi.org/project/am-i-even-or-odd/)
34
+ [![CI](https://github.com/KenKambi/am-i-even-or-odd/actions/workflows/ci.yml/badge.svg)](https://github.com/KenKambi/am-i-even-or-odd/actions/workflows/ci.yml)
35
+ [![Python versions](https://img.shields.io/pypi/pyversions/am-i-even-or-odd.svg)](https://pypi.org/project/am-i-even-or-odd/)
36
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/KenKambi/am-i-even-or-odd/blob/main/LICENSE)
37
+
38
+ A tiny Python package that answers one simple question:
39
+ is your number even, or odd tho?
40
+
41
+ Yes, `n % 2 == 0` does the same thing :)
42
+
43
+ ## Installation
44
+
45
+ ```bash
46
+ pip install am-i-even-or-odd
47
+ ```
48
+
49
+ ## Usage
50
+
51
+ ```python
52
+ from am_i_even_or_odd import is_it_even_tho, is_it_odd_tho
53
+
54
+ print(is_it_even_tho(4))
55
+ print(is_it_odd_tho(5))
56
+ ```
57
+
58
+ Output
59
+
60
+ ```
61
+ True
62
+ True
63
+ ```
64
+
65
+ ### Error handling
66
+
67
+ Only `int` values are accepted. Anything else — floats, strings,
68
+ `None`, booleans — raises a `TypeError` with a message explaining
69
+ why, rather than silently returning a possibly-wrong answer:
70
+
71
+ ```python
72
+ >>> is_it_even_tho(4.0)
73
+ TypeError: expected an int, got 'float' (4.0). Floats and other
74
+ numeric types aren't supported to avoid ambiguity around what
75
+ counts as 'even' or 'odd'.
76
+ ```
77
+
78
+ ## Development
79
+
80
+ ```bash
81
+ git clone https://github.com/KenKambi/am-i-even-or-odd.git
82
+ cd am-i-even-or-odd
83
+ pip install -e ".[dev]"
84
+ pytest -v
85
+ ```
86
+
87
+ Contributions and issues are welcome — see the
88
+ [issue tracker](https://github.com/KenKambi/am-i-even-or-odd/issues).
89
+
90
+ ## Changelog
91
+
92
+ See [CHANGELOG.md](CHANGELOG.md).
93
+
94
+ ## License
95
+
96
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,66 @@
1
+ # Am I Even Or Odd
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/am-i-even-or-odd.svg)](https://pypi.org/project/am-i-even-or-odd/)
4
+ [![CI](https://github.com/KenKambi/am-i-even-or-odd/actions/workflows/ci.yml/badge.svg)](https://github.com/KenKambi/am-i-even-or-odd/actions/workflows/ci.yml)
5
+ [![Python versions](https://img.shields.io/pypi/pyversions/am-i-even-or-odd.svg)](https://pypi.org/project/am-i-even-or-odd/)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/KenKambi/am-i-even-or-odd/blob/main/LICENSE)
7
+
8
+ A tiny Python package that answers one simple question:
9
+ is your number even, or odd tho?
10
+
11
+ Yes, `n % 2 == 0` does the same thing :)
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ pip install am-i-even-or-odd
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```python
22
+ from am_i_even_or_odd import is_it_even_tho, is_it_odd_tho
23
+
24
+ print(is_it_even_tho(4))
25
+ print(is_it_odd_tho(5))
26
+ ```
27
+
28
+ Output
29
+
30
+ ```
31
+ True
32
+ True
33
+ ```
34
+
35
+ ### Error handling
36
+
37
+ Only `int` values are accepted. Anything else — floats, strings,
38
+ `None`, booleans — raises a `TypeError` with a message explaining
39
+ why, rather than silently returning a possibly-wrong answer:
40
+
41
+ ```python
42
+ >>> is_it_even_tho(4.0)
43
+ TypeError: expected an int, got 'float' (4.0). Floats and other
44
+ numeric types aren't supported to avoid ambiguity around what
45
+ counts as 'even' or 'odd'.
46
+ ```
47
+
48
+ ## Development
49
+
50
+ ```bash
51
+ git clone https://github.com/KenKambi/am-i-even-or-odd.git
52
+ cd am-i-even-or-odd
53
+ pip install -e ".[dev]"
54
+ pytest -v
55
+ ```
56
+
57
+ Contributions and issues are welcome — see the
58
+ [issue tracker](https://github.com/KenKambi/am-i-even-or-odd/issues).
59
+
60
+ ## Changelog
61
+
62
+ See [CHANGELOG.md](CHANGELOG.md).
63
+
64
+ ## License
65
+
66
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,8 @@
1
+ from .checker import is_it_odd_tho, is_it_even_tho
2
+
3
+ __version__ = "0.1.0"
4
+
5
+ __all__ = [
6
+ "is_it_odd_tho",
7
+ "is_it_even_tho",
8
+ ]
@@ -0,0 +1,34 @@
1
+ def _validate(number: int) -> None:
2
+ """Raise a clear error if ``number`` isn't a whole number.
3
+
4
+ ``bool`` is deliberately rejected even though it's technically an
5
+ ``int`` subclass in Python, since checking parity of True/False
6
+ is almost certainly a mistake on the caller's part.
7
+ """
8
+ if isinstance(number, bool) or not isinstance(number, int):
9
+ raise TypeError(
10
+ f"expected an int, got {type(number).__name__!r} "
11
+ f"({number!r}). Floats and other numeric types aren't "
12
+ "supported to avoid ambiguity around what counts as "
13
+ "'even' or 'odd'."
14
+ )
15
+
16
+
17
+ def is_it_even_tho(number: int) -> bool:
18
+ """Return True if ``number`` is even.
19
+
20
+ :param number: the whole number to check.
21
+ :raises TypeError: if ``number`` is not an ``int``.
22
+ """
23
+ _validate(number)
24
+ return number % 2 == 0
25
+
26
+
27
+ def is_it_odd_tho(number: int) -> bool:
28
+ """Return True if ``number`` is odd.
29
+
30
+ :param number: the whole number to check.
31
+ :raises TypeError: if ``number`` is not an ``int``.
32
+ """
33
+ _validate(number)
34
+ return number % 2 != 0
File without changes
@@ -0,0 +1,96 @@
1
+ Metadata-Version: 2.4
2
+ Name: am-i-even-or-odd
3
+ Version: 0.2.0
4
+ Summary: A tiny Python library for checking whether numbers are even or odd.
5
+ Author: Ken Kambi
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/KenKambi/am-i-even-or-odd
8
+ Project-URL: Repository, https://github.com/KenKambi/am-i-even-or-odd
9
+ Project-URL: Bug Tracker, https://github.com/KenKambi/am-i-even-or-odd/issues
10
+ Project-URL: Changelog, https://github.com/KenKambi/am-i-even-or-odd/blob/main/CHANGELOG.md
11
+ Keywords: even,odd,math,parity,python
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: License :: OSI Approved :: MIT License
22
+ Classifier: Operating System :: OS Independent
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.8
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.0; extra == "dev"
29
+ Dynamic: license-file
30
+
31
+ # Am I Even Or Odd
32
+
33
+ [![PyPI version](https://img.shields.io/pypi/v/am-i-even-or-odd.svg)](https://pypi.org/project/am-i-even-or-odd/)
34
+ [![CI](https://github.com/KenKambi/am-i-even-or-odd/actions/workflows/ci.yml/badge.svg)](https://github.com/KenKambi/am-i-even-or-odd/actions/workflows/ci.yml)
35
+ [![Python versions](https://img.shields.io/pypi/pyversions/am-i-even-or-odd.svg)](https://pypi.org/project/am-i-even-or-odd/)
36
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/KenKambi/am-i-even-or-odd/blob/main/LICENSE)
37
+
38
+ A tiny Python package that answers one simple question:
39
+ is your number even, or odd tho?
40
+
41
+ Yes, `n % 2 == 0` does the same thing :)
42
+
43
+ ## Installation
44
+
45
+ ```bash
46
+ pip install am-i-even-or-odd
47
+ ```
48
+
49
+ ## Usage
50
+
51
+ ```python
52
+ from am_i_even_or_odd import is_it_even_tho, is_it_odd_tho
53
+
54
+ print(is_it_even_tho(4))
55
+ print(is_it_odd_tho(5))
56
+ ```
57
+
58
+ Output
59
+
60
+ ```
61
+ True
62
+ True
63
+ ```
64
+
65
+ ### Error handling
66
+
67
+ Only `int` values are accepted. Anything else — floats, strings,
68
+ `None`, booleans — raises a `TypeError` with a message explaining
69
+ why, rather than silently returning a possibly-wrong answer:
70
+
71
+ ```python
72
+ >>> is_it_even_tho(4.0)
73
+ TypeError: expected an int, got 'float' (4.0). Floats and other
74
+ numeric types aren't supported to avoid ambiguity around what
75
+ counts as 'even' or 'odd'.
76
+ ```
77
+
78
+ ## Development
79
+
80
+ ```bash
81
+ git clone https://github.com/KenKambi/am-i-even-or-odd.git
82
+ cd am-i-even-or-odd
83
+ pip install -e ".[dev]"
84
+ pytest -v
85
+ ```
86
+
87
+ Contributions and issues are welcome — see the
88
+ [issue tracker](https://github.com/KenKambi/am-i-even-or-odd/issues).
89
+
90
+ ## Changelog
91
+
92
+ See [CHANGELOG.md](CHANGELOG.md).
93
+
94
+ ## License
95
+
96
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ am_i_even_or_odd/__init__.py
5
+ am_i_even_or_odd/checker.py
6
+ am_i_even_or_odd/py.typed
7
+ am_i_even_or_odd.egg-info/PKG-INFO
8
+ am_i_even_or_odd.egg-info/SOURCES.txt
9
+ am_i_even_or_odd.egg-info/dependency_links.txt
10
+ am_i_even_or_odd.egg-info/requires.txt
11
+ am_i_even_or_odd.egg-info/top_level.txt
12
+ tests/test_checker.py
@@ -0,0 +1,3 @@
1
+
2
+ [dev]
3
+ pytest>=7.0
@@ -0,0 +1,2 @@
1
+ am_i_even_or_odd
2
+ dist
@@ -0,0 +1,60 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "am-i-even-or-odd"
7
+ version = "0.2.0"
8
+ description = "A tiny Python library for checking whether numbers are even or odd."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+
12
+ authors = [
13
+ { name = "Ken Kambi" }
14
+ ]
15
+
16
+ license = { text = "MIT" }
17
+
18
+ keywords = [
19
+ "even",
20
+ "odd",
21
+ "math",
22
+ "parity",
23
+ "python"
24
+ ]
25
+
26
+ classifiers = [
27
+ "Development Status :: 4 - Beta",
28
+ "Intended Audience :: Developers",
29
+ "Programming Language :: Python :: 3",
30
+ "Programming Language :: Python :: 3.8",
31
+ "Programming Language :: Python :: 3.9",
32
+ "Programming Language :: Python :: 3.10",
33
+ "Programming Language :: Python :: 3.11",
34
+ "Programming Language :: Python :: 3.12",
35
+ "Programming Language :: Python :: 3 :: Only",
36
+ "License :: OSI Approved :: MIT License",
37
+ "Operating System :: OS Independent",
38
+ "Typing :: Typed",
39
+ ]
40
+
41
+ [project.urls]
42
+ Homepage = "https://github.com/KenKambi/am-i-even-or-odd"
43
+ Repository = "https://github.com/KenKambi/am-i-even-or-odd"
44
+ "Bug Tracker" = "https://github.com/KenKambi/am-i-even-or-odd/issues"
45
+ Changelog = "https://github.com/KenKambi/am-i-even-or-odd/blob/main/CHANGELOG.md"
46
+
47
+ [project.optional-dependencies]
48
+ dev = [
49
+ "pytest>=7.0",
50
+ ]
51
+
52
+ [tool.setuptools.packages.find]
53
+ where = ["."]
54
+ exclude = ["tests", "tests.*"]
55
+
56
+ [tool.setuptools.package-data]
57
+ am_i_even_or_odd = ["py.typed"]
58
+
59
+ [tool.pytest.ini_options]
60
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,42 @@
1
+ import pytest
2
+
3
+ from am_i_even_or_odd import is_it_even_tho, is_it_odd_tho
4
+
5
+
6
+ def test_even():
7
+ assert is_it_even_tho(2) is True
8
+ assert is_it_even_tho(12) is True
9
+ assert is_it_even_tho(3) is False
10
+
11
+
12
+ def test_odd():
13
+ assert is_it_odd_tho(3) is True
14
+ assert is_it_odd_tho(13) is True
15
+ assert is_it_odd_tho(100) is False
16
+
17
+
18
+ def test_zero_is_even():
19
+ assert is_it_even_tho(0) is True
20
+ assert is_it_odd_tho(0) is False
21
+
22
+
23
+ def test_negative_numbers():
24
+ assert is_it_even_tho(-4) is True
25
+ assert is_it_odd_tho(-3) is True
26
+ assert is_it_even_tho(-3) is False
27
+
28
+
29
+ @pytest.mark.parametrize("bad_value", [4.0, "4", None, [4], (4,), 4 + 0j])
30
+ def test_non_int_raises_type_error(bad_value):
31
+ with pytest.raises(TypeError):
32
+ is_it_even_tho(bad_value)
33
+ with pytest.raises(TypeError):
34
+ is_it_odd_tho(bad_value)
35
+
36
+
37
+ @pytest.mark.parametrize("bool_value", [True, False])
38
+ def test_bool_raises_type_error(bool_value):
39
+ # bool is technically an int subclass in Python, but treating
40
+ # True/False as numbers here would be a footgun for callers.
41
+ with pytest.raises(TypeError):
42
+ is_it_even_tho(bool_value)