pykeafortune
Description
pykeafortune is a Python package containing functions to find your horoscope, lucky day, lucky number, and fortune cookie fortune when you want to boost your luck and discover any upcoming fortune.
Installation: How to Import and Use pykeafortune
-
Install the package
pip install pykeafortune -
Import desired functions into your Python code
from pykeafortune.fortune_cookie import get_fortune from pykeafortune.horoscope import get_horoscope from pykeafortune.lucky_day import get_lucky_day from pykeafortune.lucky_number import get_lucky_number
Documentation
get_fortune(number: int) -> str
Returns a fortune cookie fortune determined by the passed integer.
Parameters:
- number (int): Any integer such that 1 <= number <= 50
Returns:
- str: A generated fortune cookie fortune.
Raises:
- ValueError: If the user's number is not between 1 and 50.
- TypeError: If the user input is not an integer.
Code Example:
from pykeafortune.fortune_cookie import get_fortune
user_input = input("Enter an integer between 1 and 50 (inclusive): ")
print(get_fortune(user_input))
get_horoscope(birthday: str, birth_time: str, location: str) -> str
Returns a horoscope based on the user's birthday, birth time, and location of birth.
Parameters:
- birthday (str): The birthday in 'YYYY-MM-DD' format.
- birth_time (str): The birth time in 'HH:MM' format (24-hour clock).
- location (str): The location of birth (e.g., city, country).
Returns:
- str: A generated horoscope string.
Raises:
- ValueError: If the birthday or birth_time is not in the correct format, or if location is empty.
Code Example:
from pykeafortune.horoscope import get_horoscope
my_horoscope = get_horoscope("2000-03-21", "12:34", "New York")
print(my_horoscope)
get_lucky_day(favorite_day: str) -> datetime.datetime
Returns a random future date that occurs on the user's favorite day of the week.
Parameters:
- favorite_day (str): The user's favorite day of the week (e.g. Monday, Tuesday)
Returns:
- datetime.date: A datetime.date object for the lucky day.
Raises:
- ValueError: If the user's favorite day is not a valid day of the week.
- TypeError: If the user input is not a string.
Code Example:
from pykeafortune.lucky_day import get_lucky_day
user_input = input("Enter your favorite day of the week, unabbreviated: ")
print(get_lucky_day(user_input))
get_lucky_number(favorite_color: str) -> int
Returns a lucky number determined by the user's favorite color.
Parameters:
- favorite_color (str): The user's favorite color (e.g. blue, red)
Returns:
- int: An integer representing the user's lucky number
Raises:
- ValueError: If the user's favorite color does not exist in color -> number map
- TypeError: If the user input is not a string.
Code Example:
from pykeafortune.lucky_number import get_lucky_number
user_input = input("Enter your favorite color: ")
print(get_lucky_number(user_input))
Example Python Program
See pykeafortune in action here!
How to Contribute to pykeafortune
-
Clone the repository.
git clone https://github.com/software-students-spring2025/3-python-package-pyke-ult.git -
Set up the virtual environment and install the necessary dependencies.
pip install pipenv pipenv install pipenv shell -
Create a branch, implement your feature, push your branch to origin, then submit a PR!
Building and Testing
To build pykeafortune in your clone, run
python -m build
To test pykeafortune (i.e. run unit tests) in your clone, run
pytest
How to Run Your Project
To run your project as a Python script implemented in __main__.py in src, assuming you are in the proper virtual environment, simply run
python -m pykeafortune
Note: in your __main__.py file, below your implementation of main(), you will want to include
if __name__ == "__main__":
main()
Contributors:
Metadata
Release files for pykeafortune 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pykeafortune-1.0.0.tar.gz | 49.4 kB | Without provenance | Details for pykeafortune-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pykeafortune-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for pykeafortune-1.0.0-py3-none-any.whl |
Total release size: 83.7 kB
Release files / pykeafortune-1.0.0.tar.gz
| Download URL | pykeafortune-1.0.0.tar.gz |
|---|---|
| Size | 49.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b55a93eb16455973d413d2d092a7e70920f9d10b5518296ab7fbc6f2023be533
|
|
BLAKE2b-256 checksum How to use checksums |
66df2826457a54a65630f8fd7d86519e1bd1ebba3db9c9a71293efa1b38696bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Release files / pykeafortune-1.0.0-py3-none-any.whl
| Download URL | pykeafortune-1.0.0-py3-none-any.whl |
|---|---|
| Size | 34.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
82dd37a50af14ac5b8e6108335320523324e71a3f365e00581ebcfdc09917bf9
|
|
BLAKE2b-256 checksum How to use checksums |
3ec505b21879dadc24cd42144f0a2601e97f5d9d37d42847f395e20ed08db788
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Security for pykeafortune 1.0.0
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.