Skip to main content

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

Project description

Python build & test

CI/CD

Python Package Exercise

An exercise to create a Python package, build it, test it, distribute it, and use it. See instructions for details.

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 install 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

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.4.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.4-py3-none-any.whl (31.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fortunecookiepkg-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 3a3acaf695a71068fec4220ba3b1ef8e5267b79234baf4b483c424377c32c429
MD5 97ef5e19dc3b07b69f1eb60f33b250dd
BLAKE2b-256 11ae4faec13dd4a03881ad039d822454443bba4d9f0061890e76c62f77c1e7ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fortunecookiepkg-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 be5791fe316170d328e8e98f1cae166c045ef1ef4af3bc7b39576215d08125ac
MD5 72500ca32bc49548515e2ba136d3a022
BLAKE2b-256 4eb5de3431ae8f04f06c6395519af755a4db6b9477be6b87243e7b231d1eb91a

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