Skip to main content

A python riddles package.

Project description

Python Package Exercise

Build Status

Plain-language Description

  • PyRiddles is a fun and interactive python package for those who want to enjoy a few riddles! With a range of difficulty levels and hints to help you along the way, PyRiddles is perfect for anyone looking to exercise their brain and have a good time. Whether you're a seasoned puzzle solver or just looking for a fun way to pass the time, PyRiddles is the perfect package for you.

Link to Package on PyPi Website

How to Import

  1. Run the following command in terminal:
    pip install PyRiddless
    
  2. Confirm proper installation:
    pip show PyRiddless
    
  3. Next, import the desired functions (example usage below):
    from pyriddles import arbitrary_riddle, get_answer, ...
    

Example Usage of Key Functions:

  • arbitrary_riddle:

    • Parameters:
      • None
    • Returns:
      • A random riddle_id to be used in other methods
    • Example:
      • # Demonstrate arbitrary_riddle
        riddle_id = arbitrary_riddle()
        print(f"Random riddle ID: {riddle_id}")
        
  • get_riddle_by_difficulty:

    • Parameters:
      • A difficulty (of 'easy', 'medium', or 'hard')
    • Returns:
      • A random riddle based on difficulty
    • Example:
      • # Demonstrate proper usage of get_riddle_by_difficulty
        print(get_riddle_by_difficulty("easy"))
        
        # Demonstrate improper usage of get_riddle_by_difficulty
        print(get_riddle_by_difficulty("extra hard"))
        
  • list_difficulties:

    • Parameters:
      • None
    • Returns:
      • A list of available difficulties
    • Example:
      • #Demonstrate list_difficulties
        print(list_difficulties())
        
  • get_answer:

    • Parameters:
      • riddle_id : The id number for a riddle in config.py
    • Returns:
      • A boolean value depending on the verity of the user's answer
    • Example:
      • #Demonstrate get_answer
        answer = get_answer(riddle_id)
        print(f"The answer to riddle {riddle_id} is: {answer}")
        
  • get_hint:

    • Parameters:
      • riddle_id
      • hint_type (set to auto normally)
      • max_attempts : the maximum number of tries for a riddle
    • Returns: A singular (usually random) hint
    • Example:
      • #Example usage of get_hint
        
        hint = get_hint(riddle_id, "soundsalad_hint")
        print("Generated hint (soundsalad_hint):", hint)
        
        hint_auto = get_hint(riddle_id, "auto")
        print("Generated hint (auto):", hint_auto)
        
  • get_hints:

    • Parameters:
      • riddle_id
      • hint_type : Usually randomly selected, but can be input manually for a specific type
      • limit : The total number of hints desired
    • Returns:
      • Several hints
    • Example:
      #Example usage of get_hints
      
      hints_list = get_hints(riddle_id, "auto", limit=5)
      print("Generated list of hints (auto):", hints_list)
      
  • NOTE: For a program that uses all key functions, go here

Team Members

For Developers

These instructions will guide you on how to configure and run this project.

Prerequisites

Before you begin, ensure you have the following installed:

  • Python 3.9 or higher
  • pipenv (for dependency and virtual environment management)

If you don’t have pipenv, install it with:

pip install pipenv

Setting Up the Development Environment

  1. Clone the repository

    git clone https://github.com/software-students-spring2025/3-python-package-gmjm.git
    cd 3-python-package-gmjm
    
  2. Set up the virtual environment and install dependencies

    pipenv install
    
  3. Activate the virtual environment:

    pipenv shell
    

Running the Package Locally

To execute the package code locally, use:

python -m pyriddles

Running Tests

To ensure that all functions work correctly, you can run the tests manually using:

pytest

Building the Package

To manually build the package into distributable artifacts:

python -m build

Importing the Package

To import the entire package for use in your code, add the following line to the top of your file

import pyriddles

If you only want to import certain functions, add the following line to the top of your file:

from pyriddles import func1, func2...

Code Examples

For more information on how the functuons in this package should work, see this code file.


CI/CD with GitHub Actions

Every time a pull request is created, GitHub Actions will:

  • Run the test suite
  • Build the package
  • Ensure compatibility with multiple Python versions

You can check the latest test/build status via the badge at the top of this README.

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

pyriddles-0.0.2.tar.gz (48.9 kB view details)

Uploaded Source

Built Distribution

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

pyriddles-0.0.2-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

Details for the file pyriddles-0.0.2.tar.gz.

File metadata

  • Download URL: pyriddles-0.0.2.tar.gz
  • Upload date:
  • Size: 48.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for pyriddles-0.0.2.tar.gz
Algorithm Hash digest
SHA256 e64389a7a9152fda7a058659ba9b0ddc0ae378a3f261e59c08b2d0dce0fa1905
MD5 3e5822ba856cb4f79195c30fda62630c
BLAKE2b-256 24b7ad4d06d05d9f9d13aa689bf5e2b54773861e8cc81152de172244216085c0

See more details on using hashes here.

File details

Details for the file pyriddles-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pyriddles-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 34.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.1

File hashes

Hashes for pyriddles-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a91d4fe6b13f641e3df812c474ec8e628e5a63d0be85ad8eff72aa4a547dd918
MD5 37e6d916d30757787eb61c34ae823302
BLAKE2b-256 e3f8735135d60e8c5c92f11b7c7919ea00ad3c5d2264f141a336842bca348043

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