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.4.tar.gz (45.3 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.4-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: devdice-0.0.4.tar.gz
  • Upload date:
  • Size: 45.3 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.4.tar.gz
Algorithm Hash digest
SHA256 dd34b53569570dff0ead0fe09f3b1de9cd21667c5c56778dbd61cc18b7d36a2f
MD5 63c55a19375f2cbb83de427909e7da11
BLAKE2b-256 0a197cec3db7ff24bce9f7a6c37d449b0dd88af4a68b5387dc68f0fabbe8711a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: devdice-0.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 43a8c24f1cbd5d697758da89be187cecb2ec9b3f9e47a7663590b85c9604bc63
MD5 94469d6abfdabd8f6de3c4af7f362f40
BLAKE2b-256 8d73bc835681ad3909932e4f25773e9d26e8937ce22151335baefc8167ca349e

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