Skip to main content

A package developed with pipenv, built with build using setuptools, uploaded to PyPI using twine, and distributed via pip.

Project description

CI / CD

Software Engineering, Spring 2025, Project 3.

Description

This Python package allows developers to use fun randomizing functions to flip a coin, roll a dice, generate random colors, choose an option from a list, and much more!

PyPI Website Link

You can find the link to our package on the PyPI website here.

Installation

Install the devdice module with pip:

pip install devdice

Importing devdice Functions

You can use any function in your own projects by it importing devdice then calling it directly:

from devdice import{
    Chooser
    Eliminator
    MagicEightBall
    roulette
    flip_a_coin
    roll_a_dice
    rock_paper_scissors
    random_color_generator
}

# Flip a coin 5 times
print(flip_a_coin(5)) # Possible Output: ['Heads', 'Heads', 'Heads', 'Heads', 'Tails']

# Generate two rock, paper, scissors outcomes
print(rock_paper_scissors(2)) # Possible Output: ['Scissors', 'Rock']

Usage Examples

Eliminator Class

elim = Eliminator(['Option A', 'Option B', 'Option C'])
print(elim.eliminate()) # Removes and returns a random option

Chooser Class

chooser = Chooser(['Option A', 'Option B', 'Option C'])
print(chooser.pick()) # Returns a randomly selected option

MagicEightBall Class

magic_eight_ball = MagicEightBall()
print(magic_eight_ball.shake()) # Returns a randomly selected Magic Eight Ball response

roulette(starting: int)

print(roulette(2)) # Spins wheel with 2 of 6 winning positions 

flip_a_coin(num: int)

print(flip_a_coin(5)) # Flips 5 coins

roll_a_dice(num: int)

print(roll_a_dice(5)) # Rolls 5 dice

rock_paper_scissors(num: int = 1)

print(rock_paper_scissors()) # Generates a rock, paper, scissors outcome
print(rock_paper_scissors(2)) # Generates list of 2 rock, paper, scissors outcomes

random_color_generator(num: int = 1)

print(random_color_generator()) # Generates a hex-codes color string
print(random_color_generator(2)) # Generates list of 2 hex-codes color strings

Demonstrative Python Script

The repository contains a script called demo.py which you can find here. This script demonstrates all available functions in the devdice package, including details on their expected inputs and outputs.

Contributing to DevDice's development

  • The code is licensed under the GNU General Public License
  • Please use GitHub issues to submit bugs and report issues
  • Feel free to contribute to the code

Environment Setup for Contributors

Virtual Environment Setup

  1. In your python project's directory, if you have not done so already, Create a pipenv-managed virtual environment.

  2. Enter that virtual environment: pipenv shell.

  3. Install package dependencies: pip install -r requirements.txt.

  4. Create a Python program file that imports devdice and uses it.

  5. Run the program: python3 my_program_filename.py.

  6. Exit the virtual environment: exit.

Running Unit Testing

Simple example unit tests are included within the tests directory. To run these tests...

  1. Install pytest into the virtual environment, e.g. pipenv install pytest

  2. Run the tests from the main project directory: python3 -m pytest.

  3. Tests should never fail. Any failed tests indicate that the production code is behaving differently from the behavior the tests expect.

Instructions for setting up any environment vartiables and importing any starter data

There are no environemnt variables or starter data necessary for the system to operate correctly when run.

Instructions for any "secret" configuration files

There are no "secret" configuration files such as .env or anything of that nature.

Contributors

Ordered alphabetically by last-name:

  1. Edwin Chen
  2. Benjamin DeWeese
  3. John Ma
  4. Forrest Williams

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

devdice-0.0.5.tar.gz (45.2 kB view details)

Uploaded Source

Built Distribution

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

devdice-0.0.5-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

File details

Details for the file devdice-0.0.5.tar.gz.

File metadata

  • Download URL: devdice-0.0.5.tar.gz
  • Upload date:
  • Size: 45.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for devdice-0.0.5.tar.gz
Algorithm Hash digest
SHA256 4abfe19469b9966155de85beb51befb085d9a0f5f9044c2e5587e2f573432b2c
MD5 19168eddd79d6fd250a76f900a3a9ccd
BLAKE2b-256 da4f65992611951bbe4c618c848144c065b1b21f4e78ee086f77b4802d72d7cc

See more details on using hashes here.

File details

Details for the file devdice-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: devdice-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 34.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for devdice-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6485970c1ef9f7aa3beb2d5c48d413bfe53ccc9309f386da196dd255359d7a3b
MD5 ca0d8d385fe7c7de3bb9b4c581e83957
BLAKE2b-256 3c31b7f141a480b3842f07d44ce003a03d5882cd29afe245b3d553ad121c3c59

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