Metadata-Version: 2.5
Name: lupaxa-magic-8ball
Version: 0.1.0
Summary: Classic Magic 8-Ball library and slim CLI.
Project-URL: Homepage, https://github.com/lupaxa-after-hours/magic-8ball
Project-URL: Documentation, https://github.com/lupaxa-after-hours/magic-8ball
Project-URL: Repository, https://github.com/lupaxa-after-hours/magic-8ball
Project-URL: Issues, https://github.com/lupaxa-after-hours/magic-8ball/issues
Author: The Lupaxa Project
License: MIT License
        
        Copyright (c) The Lupaxa Project
        
        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.
License-File: LICENCE
Keywords: 8ball,cli,magic-8-ball,toy
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Games/Entertainment
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Provides-Extra: dev
Requires-Dist: bump-my-version>=1.2.0; extra == 'dev'
Requires-Dist: hatch>=1.12.0; extra == 'dev'
Requires-Dist: mypy>=1.12.0; extra == 'dev'
Requires-Dist: pip-audit>=2.7.0; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6.0; extra == 'dev'
Provides-Extra: test
Requires-Dist: pytest-cov>=5.0; extra == 'test'
Requires-Dist: pytest>=8.0; extra == 'test'
Description-Content-Type: text/markdown

<p align="center">
  <a href="https://github.com/lupaxa-after-hours">
    <img src="https://raw.githubusercontent.com/the-lupaxa-project/brand-assets/master/logos/organisations/after-hours/readme-logo.png" alt="After Hours" />
  </a>
</p>

<h1 align="center">Magic 8 Ball</h1>

Ask a yes-or-no question and get one of the twenty classic Magic 8-Ball
replies. The question is checked, then discarded. The reply is chosen at
random from the traditional set.

The PyPI name is `lupaxa-magic-8ball`. The import path is
`lupaxa.magic_8ball`. The console script is `magic-8ball`. `lupaxa` is a
namespace package — there is no `lupaxa/__init__.py`.

Public names: `ask`, `Magic8Ball`, `RESPONSES`, `Magic8BallError`,
`InvalidQuestionError`, `__version__`, `get_version()`.

## Install

```bash
pip install lupaxa-magic-8ball
```

Requires Python 3.10+. The standard library is enough.

## CLI

```bash
magic-8ball "Will it rain tomorrow?"
magic-8ball --version
```

The question is one positional argument. Quote it so the shell keeps it
together.

| Flag        | Meaning                                          |
| ----------- | ------------------------------------------------ |
| `question`  | Yes-or-no question (required unless `--version`) |
| `--version` | Print `magic-8ball x.y.z` and exit `0`           |
| `--help`    | Show argparse help                               |

| Result                    | Stdout              | Exit |
| ------------------------- | ------------------- | ---- |
| Success                   | One response        | `0`  |
| `--version`               | `magic-8ball x.y.z` | `0`  |
| Missing or blank question | error on stderr     | `2`  |

```bash
python -m lupaxa.magic_8ball "Will it rain tomorrow?"
```

## Library

```python
from lupaxa.magic_8ball import Magic8Ball, ask

ask("Will it rain tomorrow?")

ball = Magic8Ball()
ball.ask("Will it rain tomorrow?")
```

| Call                         | Return                      |
| ---------------------------- | --------------------------- |
| `ask(question)`              | one of the twenty responses |
| `Magic8Ball().ask(question)` | the same                    |
| `str(Magic8Ball())`          | `Magic 8-Ball Emulator`     |

`RESPONSES` is the fixed tuple of twenty phrases, affirmative first,
non-committal in the middle, and negative last.

| Situation                       | Result                 |
| ------------------------------- | ---------------------- |
| Non-empty string                | One classic response   |
| Empty string or only whitespace | `InvalidQuestionError` |
| Value that is not a string      | `InvalidQuestionError` |

```python
from lupaxa.magic_8ball import InvalidQuestionError, ask

try:
    ask("Will I get a promotion?")
except InvalidQuestionError as exc:
    print(f"Error: {exc}")
```

## Development

```bash
make init
make python-install-dev
make python-check
```

<a href="https://github.com/the-lupaxa-project">
    <img src="https://raw.githubusercontent.com/the-lupaxa-project/brand-assets/master/logos/components/footer-for-child-orgs.svg" alt="The Lupaxa Project Footer" width="100%" />
</a>
