Skip to main content

A fun Python package that generates random fortunes with a date.

Project description

fortune_package

CI Status

Description

A small Python package to make your day just a bit brighter while coding! Test your luck and explore the many fortunes we've included. If you're lucky (or unlucky), the fortune you receive might just come true.

PyPI Link

fortune-package2607555

Installation & Setup

Installing Dependencies & Setting Up a Virtual Environment

To install the required dependencies and set up a virtual environment:

  1. Install pipenv (if you haven’t already):
    pip install pipenv
    
  2. Create and enter a virtual environment, then install dependencies:
    pipenv install
    pipenv shell
    
  3. Install our fortune-teller package:
    pip install fortune-teller2607555==0.1.1
    

Overview of Provided Functions

  1. cs_fortune(category: str)
    • Returns a computer science-themed fortune from one of these categories: tech, startup, open source, ai, or career.
    • If the category is invalid, it returns an "Oops:" error message.
    from fortune_teller.cs_fortune import cs_fortune
    fortune = cs_fortune("tech")
    print(fortune)
    
  2. mood_fortune(mood: str)
    • Returns a fortune based on your mood: positive, funny, cursed, motivational).
    • If the mood is invalid, it returns an "Oops:" error message.
    from fortune_teller.mood_fortune import mood_fortune
    fortune = mood_fortune("funny")
    print(fortune)
    
  3. fortune_story(name: str)
    • Returns a personalized fortune story that includes the name you provide.
    • If the name is invalid (empty), it returns an error message.
    from fortune_teller.fortune_stories import fortune_story
    story = fortune_story("Alice")
    print(story)
    
  4. rand_date_time(current_date_str: str, fortune: str)
    • Combines a given fortune message with a random future date (up to December 31, 2060).
    • The fortune parameter must come from one of the other functions: cs_fortune, mood_fortune, or fortune_story).
    • If the user-supplied date is beyond December 31, 2060 or invalid, it returns an error message.
    from fortune_teller.date_time import rand_date_time
    from fortune_teller.cs_fortune import cs_fortune
    
    my_cs_fortune = cs_fortune("tech")
    dated_fortune = rand_date_time("2025-01-01", my_cs_fortune)
    print(dated_fortune)
    

Usage Examples

  1. Direct Function Import If you simply want to call a fortune function, cs_fortune, for instance:
from fortune_teller.cs_fortune import cs_fortune

fortune = cs_fortune("ai")
print("AI Fortune:", fortune)
  1. Try Our Interactive CLI We include a get_started.py script that lets you interactively pick any fortune type from the command line, combine it with a random future date, and see the final result printed with fun ASCII art. To try it:
  • Navigate to your project folder
  • Run:
python -m fortune_teller.get_started
  • Follow the menu prompts to select your fortune type: mood_fortune, fortune_story, or cs_fortune) or quit. You’ll see a fun ASCII “cookie” and your fortune each time!

For a complete example of all functions, check out get_started.py.

Contribution Guidelines

We welcome contributions! If you'd like to contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or fix.
  3. Ensure your changes integrate well with existing tests and add new tests if necessary.
  4. Submit a pull request for review.

Code Testing

Run tests locally before submitting your new code:

pipenv install --dev pytest
pipenv run python -m pytest tests/

The Team

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

fortune_teller2607555-0.1.1.tar.gz (28.9 kB view details)

Uploaded Source

Built Distribution

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

fortune_teller2607555-0.1.1-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file fortune_teller2607555-0.1.1.tar.gz.

File metadata

  • Download URL: fortune_teller2607555-0.1.1.tar.gz
  • Upload date:
  • Size: 28.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.10

File hashes

Hashes for fortune_teller2607555-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2cd353b9d7f2571bc417110a8c760daf0a43824a7d40fc9e7d901cf3aea1f7c9
MD5 ab9910fddd24f6a0ac84be36d87a4018
BLAKE2b-256 4c3d8f9a928ff72678e05436da685d5acad47e55c4c4d3652f2c836d939e8fa9

See more details on using hashes here.

File details

Details for the file fortune_teller2607555-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fortune_teller2607555-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 093527c9d0cdff2378721b80367eeba2532f29d91c28e39126d7806131cd6f9b
MD5 3b4f7b0f21a7243af1468ad37555f425
BLAKE2b-256 c655e09acbad4ef64b3c0f6c7518d2fd7da04b13219fc8efa90aa6cd185b1aeb

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