A package developed with pipenv, built with build using setuptools, uploaded to PyPI using twine, and distributed via pip.
Project description
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
-
In your python project's directory, if you have not done so already, Create a
pipenv-managed virtual environment. -
Enter that virtual environment:
pipenv shell. -
Install package dependencies:
pip install -r requirements.txt. -
Create a Python program file that imports
devdiceand uses it. -
Run the program:
python3 my_program_filename.py. -
Exit the virtual environment:
exit.
Running Unit Testing
Simple example unit tests are included within the tests directory. To run these tests...
-
Install
pytestinto the virtual environment, e.g.pipenv install pytest -
Run the tests from the main project directory:
python3 -m pytest. -
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:
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file devdice-0.0.3.tar.gz.
File metadata
- Download URL: devdice-0.0.3.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d914ee75d280223049f2a7e8947d1614443b21eb36e2b13a5534dbef8cd8ac6
|
|
| MD5 |
1fdb85d1ffefbc83a423a24d07ed9e74
|
|
| BLAKE2b-256 |
354f2e6a6c8966e2de0947c7718bd11a0978752ef1a8d7e1dc0066fab82bea15
|
File details
Details for the file devdice-0.0.3-py3-none-any.whl.
File metadata
- Download URL: devdice-0.0.3-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f0cb8717ff18c0b776daf418810152c23c26634ff5209a36ec7ec7117cd02e4
|
|
| MD5 |
5192d41f72bc05b70a1d84f25ff4955b
|
|
| BLAKE2b-256 |
67c145dad206f324be787f47ac5a558506351f5d2b0ecd954091bc7e78323d6e
|