Skip to main content

A package that shares fortunes, lucky numbers, and themed or personalized messages.

Project description

CI

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

View our package on PyPI here

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:

  1. Clone the repository
  2. Create a feature branch (git checkout -b feature-name).
  3. Commit your changes (git commit -m "Added new feature").
  4. Push to your branch (git push origin feature-name).
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fortunecookiepkg-0.1.6.tar.gz (45.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fortunecookiepkg-0.1.6-py3-none-any.whl (31.2 kB view details)

Uploaded Python 3

File details

Details for the file fortunecookiepkg-0.1.6.tar.gz.

File metadata

  • Download URL: fortunecookiepkg-0.1.6.tar.gz
  • Upload date:
  • Size: 45.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for fortunecookiepkg-0.1.6.tar.gz
Algorithm Hash digest
SHA256 4067be799af52cec961abc52da789d488c449f544d1e068033c302bf6ca9dc37
MD5 eba5c21e4c766779f0da7d6e0d7ccae9
BLAKE2b-256 456bace13ad4a2efe1290fbbf751f78db759573ff43ad8552a3da722f0752bd5

See more details on using hashes here.

File details

Details for the file fortunecookiepkg-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for fortunecookiepkg-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 fdbfbd6684c47497a02c0359032fee2a144f842c350053cb8ff7998671406a97
MD5 f16bc625dcb97d8d0b6579c29d4b7cec
BLAKE2b-256 ada6e844222e50aa37673aa1347fabc88f2756cf629591730e200a165b6171ea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page