A package that shares fortunes, lucky numbers, and themed or personalized messages.
Project description
Python Package Exercise
Fortune Cookie Python Package
Team Members
Oluwapelumi Adesiyan
Nikita Bhaskar
Ariya Mathrawala
Emily Ney
What is This Package?
The Fortune Cookie package is a python package that will bring some joy to your day to day coding! You can can use this package to get a random fortune or find your lucky numbers.
PyPI Package Link
Installation
pip3 install fortunecookiepkg
Usage
Import the package and use the following functions:
from fortunecookiepackage import get_random_fortune, get_lucky_numbers, get_daily_fortune, get_custom_fortune, get_themed_fortune
print(get_random_fortune())
#Output: Sell your ideas—they have exceptional merit.
print(get_lucky_numbers(6))
#Output: Lucky Numbers: [83, 40, 3, 45, 66, 17]
print(get_daily_fortune("Monday"))
#Output: Today's Fortune: Goodness is the only investment that never fails.
print(get_custom_fortune("Alice"))
#Output: Alice, A journey of a thousand miles begins with a single step.
print(get_themed_fortune("Love"))
#Output: The one you love is closer than you think.
Or try running the package as a script:
python -m fortunecookiepkg --random
python -m fortunecookiepkg --numbers 6
python -m fortunecookiepkg --daily monday
python -m fortunecookiepkg --custom Alice
python -m fortunecookiepkg --themed Love
Example Program
Demo the package by running the Python file found here or copy and paste the code below!
from fortunecookiepackage import get_random_fortune, get_lucky_numbers, get_daily_fortune, get_custom_fortune, get_themed_fortune
print(get_random_fortune())
#Output: Sell your ideas—they have exceptional merit.
print(get_lucky_numbers(6))
#Output: Lucky Numbers: [83, 40, 3, 45, 66, 17]
print(get_daily_fortune("Monday"))
#Output: Today's Fortune: Goodness is the only investment that never fails.
print(get_custom_fortune("Alice"))
#Output: Alice, A journey of a thousand miles begins with a single step.
print(get_themed_fortune("Love"))
#Output: The one you love is closer than you think.
Development Guide
Clone the Repository
git clone https://github.com/software-students-spring2025/3-python-package-teamproj3.git
cd 3-python-package-teamproj3
Set up Virtual Environment
Using pipenv:
pip install pipenv
pipenv shell
Using venv:
python3 -m venv .venv
source .venv/bin/activate #On Mac
.venv\Scripts\activate.bat #On Windows
Run Tests
Simple example unit tests are included within the tests directory. To run these tests use:
pytest tests/
Build and Publish Package
To build the package and upload it to TestPyPI:
python -m build
twine upload -r testpypi dist/*
To publish it to PyPI:
twine upload dist/*
Contribute
To contribute to this project follow these steps:
- Clone the repository
- Create a feature branch (
git checkout -b feature-name). - Commit your changes (
git commit -m "Added new feature"). - Push to your branch (
git push origin feature-name). - Open a pull request.
Function Documentation
get_random_function()
Generates a random fortune
Parameters:
- None
Return:
str: A randomly selected fortune.
get_lucky_numbers(len)
Generates a set of lucky numbers.
Parameters:
len(int): The number of lucky numbers to return
Return:
list[int]: A list of lucky numbers.
get_daily_fortune(day)
Generates the same fortune for all users for that day.
Parameters:
day(str): The weekday for which to retrieve a fortune.
Return:
str: The fortune for the given day.
get_custom_fortune(name)
Generates a fortune that includes the user's name.
Parameters:
name(str): The name to include in the fortune.
Return:
str: A personalized fortune.
get_themed_fortune(theme)
Genrates a fortune that relates to the selected theme.
Parameters:
theme(str): The theme for the fortune (ie. love, career, happiness)
Return:
str: A themed fortune.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters