Skip to main content

Petmagotchi Package

Build Status

What is Petmagotchi?

Petmagotchi is a package that allows you to simulate taking care of your own virutal pet! Inspired by the Tamagotchi, you can create your own pet and interact with it in various ways. Take care of him/her by feeding, cleaning and playing with him!

Features

  • Create Your Pet: Choose from a variety of pet types and give it a name to start your journey together.
  • Feed Your Pet: Give an assortment of foods and drinks to your pet to keep their tummy full and hydrated.
  • Hygiene Maintenance: Clean your pet so they are ready for cuddles!
  • Playtime: Engage in fun activities with your pet to share a wonderful time together.

Installation

To install Petmagotchi, use the following pip command:

pip install petmagotchi

Functions and usage

Create a new python file and install petmagotchi. Then, import the package with the following line of code:

from petmagotchi.pet import Pet

Create Pet: Pet(name,type)

Create your pet instance with the following command: my_Pet = Pet(name = 'pet_name', type = 'type')

Any pet name is allowed, given that the pet name is a string.

The current version only supports two types of pets: Dog, Cat

Therefore, valid commands look like:

my_Pet = Pet(name = 'Yuka', type = 'Cat')
my_Pet = Pet(name = 'Kylo', type = 'Dog')

See the status of your pet: print_status()

To see the status of your pet, use the print_status() method. Example below:

my_Pet.print_status()

This will automatically update your pet status based on the the time since the last action, and show you the status of your pet.

Feed your pet: feed_pet(food, quantity)

To feed your pet, use the feed_pet(food,quantity) method. This will fill your pet's hunger meter and mood. The method will also print out a reaction!

  • The valid food selections are: meat, vegetable, ice cream, bread
  • The valid quantity range is: [1,3]

Example below:

my_Pet.feed_pet(food = 'meat', quantity = 2)

Hydrate your pet: hydrate_pet(drink, quantity)

Same as feed, but for drinks!

  • The valid food selections are: water, soda, milk, lemonade
  • The valid quantity range is: [1,3]

Example below:

my_Pet.feed_pet(drink = 'lemonade', quantity = 3)

Play with your pet: play(toy)

Play with your pet by giving it a toy. This will consume some energy but raise their mood. Pets also have a favorite toy!

  • The valid toy selections are: yarn, ball, plushie, bone
  • Pets that have low energy will be too tired to play

Example below:

my_Pet.play(toy = 'plushie')

Keep your pet clean: wash()

Keep your pet clean by washing him with:

my_Pet.wash()

Pet your pet: pet()

Pet your pet with:

my_Pet.pet()

A pet that is too unhappy may not be willing to come for pets. Keep them happy by playing with them!

Bring them somewhere: bring_to(destination)

Take your pet somewhere fun!

You can take them to the park, on a hike, to the vet, to the groomer, or lastly to a pet cafe.

my_Pet.bring_to('park')

Save your pet: save_pet()

Save your pet for the future!

my_Pet.save_pet()

The file will automatically be called petName.pickle, where petName will be the name of your pet, with underscores representing spaces.

Load your pet: load_pet(file_path)

Load a previous pet:

my_Pet = Pet.load_pet(file_path = 'Fido.pickle')

Ensure to enter the file name correctly!

Example file

To see an example file with the above methods, click here.

Contributing to the package

Feel free to contribute to the project! Here are the steps you can take to contribute.

Fork the repository

Fork the repository to your own account by visiting our GitHub page.

Clone the repository to your local computer

Use Git Bash or something similar to clone the repository to your local computer. The command for Git Bash is:

git clone ...

Where you replace ... with the url of the repository.

Set up your Development Environment

  1. Open a terminal with python.
  2. If you do not have pipenv, install the package with the command:
pip install pipenv
  1. Once pipenv is installed, install the package dependencies by running:
pipenv install --dev

To activate the virtual environment, run:

pipenv shell

You can now write your code to contribute to the project.

Rest of the workflow: branch creation, creating a PR

Create your own feature branch, then add and commit your changes. Once that is completed, feel free to create a pull request to the main repository.

We will review the changes as soon as possible!

Other notes

  • Make sure to add and run additional unit tests for newly written functions in /src/tests.
  • Add documentation to the README.md for new functions.

You can run tests in the terminal with the command: pipenv run pytest

To access our package on PyPi, click here!

Contributors

Release files for petmagotchi 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for petmagotchi 0.1.4
File Size Uploaded
petmagotchi-0.1.4.tar.gz 51.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for petmagotchi 0.1.4
File Interpreter ABI Platform
petmagotchi-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 84.7 kB

Release files / petmagotchi-0.1.4.tar.gz

Download URL petmagotchi-0.1.4.tar.gz
Size 51.4 kB
Tags Source
SHA-256 checksum
How to use checksums
155ea940e9ddc741a6b130863f260c41f320ff3d737cfb02341018b76f3b3b46
BLAKE2b-256 checksum
How to use checksums
289e2ba5217bf7eae62d6d4fae01d0c9f9bf8aeddf8999b1337c6926b77877ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.0

Release files / petmagotchi-0.1.4-py3-none-any.whl

Download URL petmagotchi-0.1.4-py3-none-any.whl
Size 33.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
464fa9d424214dbb9c9f44e875180ec434f04dccc77978ff725fa664324b27f2
BLAKE2b-256 checksum
How to use checksums
2ee3bdd4db5536eecb5199099b93555393b686e6c82b1db3dae2c28bafe47d90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.0

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page