Skip to main content

ai-is-odd

PyPI version

Why determine if something is odd or odd the usual way when you can do it with ✨AI✨?

Our library has 100% test coverage!

ai-is-odd is a Python library that uses OpenAI's GPT-4o-mini model to tell if a number is even or odd. Add some AI magic to your number-checking tasks!

Installation

To install ai-is-odd, use pip:

pip install ai-is-odd

SetupTo use is-odd, you’ll need an OpenAI API key. Get one by signing up at OpenAI.

  1. Create a .env file in the root of your project.
  2. Add your OpenAI API key to the .env file:
OPENAI_API_KEY=your-api-key

Replace your-api-key with your actual OpenAI API key.

Usage

Here’s an example of how to use the ai-is-odd package in your project:

from ai_is_odd import is_odd

# Example usage
number = 5
result = is_odd(number)
print(f"Is {number} odd? {result}")  # Output: Is 5 odd? True

Function

is_odd(number)

  • Parameters: number (int) - The number to check.
  • Returns: bool - True if the number is odd, False if even.
  • Raises: ValueError if the API response is inconclusive or if there's an issue with the request.

Running Tests

To test the is_odd library, use the unittest framework:

python -m unittest discover -s tests

Generating a Coverage Report

To check code coverage, make sure you have coverage installed:

pip install coverage

Run tests with coverage enabled:

coverage run -m unittest discover -s tests

To see a summary report in the terminal, use:

coverage report

To create a detailed HTML report:

coverage html

Open htmlcov/index.html in your browser to view the line-by-line coverage details.

Contributing

Contributions are welcome! If you have suggestions or improvements, feel free to open an issue or submit a pull request.

License

This project is licensed under the Apache 2.0 license.

Metadata

Release files for ai-is-odd 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-is-odd 0.1.2
File Size Uploaded Provenance
ai_is_odd-0.1.2.tar.gz 7.7 kB Without provenance Details

Release files / ai_is_odd-0.1.2.tar.gz

Download URL ai_is_odd-0.1.2.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c7d79723b9ec31a377fd566c8bf25fb92c3a5dd50153312ea7636223f2b5aef3
BLAKE2b-256 checksum
How to use checksums
7b78d70c3370dba3526eb9de0023db123def7e91f6a1f4858e8c0600b84d8844
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Security for ai-is-odd 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page