Skip to main content

A task management package that lets you add, complete, and fetch random tasks.

Project description

Python build & test

Python Package Exercise

Funtasks: A Task Management Package

This package was created by generally following the Packaging Python Projects guide, with the addition of pipenv for virtual environment management.

Overview

Funtasks is a simple and fun task management package designed to help you add, complete, and randomly select tasks. It includes features for adding tasks with urgency levels, marking tasks as complete, and generating random tasks or daily goals based on your available time.

Team members

Natalie Ovcarov

Jun Li

Daniel Brito

Alvaro Martinez

Link to our package on PyPI

PyPI package Link

How to install and use this package

  1. Make sure you have pipenv installed. You can install it using pip3:
    pip3 install pipenv
    
  2. To install the package, use pip3 because this package requires Python 3:
    pip3 install funtasks
    
  3. Activate the virtual environment:
    pipenv shell
    
  4. Create a Python program file that imports the package and uses it, e.g.
    from funtasks.tasks import add_task, complete_task, random_task, random_daily_goal, tasks
    

This approach lets you directly use add_task, complete_task, random_task, and random_daily_goal

  1. Run the program:
    python3 your_program_filename.py
    
  2. Exit the virtual environment:
    exit
    

Additionally, we have provided an example script that you can run directly:

  1. Create an activate pipenv virtual environment as before.
  2. Run the package directly from the command line: python3 -m funtasks. This should directly run the code in the __main__.py.
  3. Exit the virtual environment: exit

How to run unit tests

We've included 3 unit tests for each function in our funtasks package. To run these tests:

  1. Install pytest in a virtual environment
  2. Now, you can run the tests from the main project directory: python3 -m pytest
  3. All tests should pass to ensure that the production code is behaving correctly

Usage

How to import funtasks

from funtasks.tasks import add_task, complete_task, random_task,random_daily_goal, tasks

Functions Overview

  • add_task(task_name: str, urgency: int) -> str

    • Description: Adds a new task to the list with a specified urgency level. Parameters:
    • task_name: The name of the task to add.
    • urgency: An integer representing the urgency level (1–5, with 5 being the most urgent).
    • Returns: A confirmation message upon successful addition.
    • Raises: ValueError if the task already exists.
  • Example:

add_task(“Do laundry”, 3)
  • complete_task(task_name: str) -> str

    • Description: Marks a task as completed.
    • Parameters:
    • task_name: The name of the task to complete.
    • Returns: A confirmation message or a message indicating the task doesn't exist.
  • Example:

complete_task("Do laundry")
  • random_task() -> str

    • Description: Retrieves a random task from the list.
    • Returns: The name of a random task or a message indicating there are no tasks.
  • Example:

random_task()
  • random_daily_goal(available_time: int) -> str

    • Description: Suggests a task based on the available time. Parameters:
    • available_time: Time available in minutes (used to determine task urgency).
    • Returns: A task that fits the time constraint or a message indicating no tasks are suitable.
  • Example:

random_daily_goal(25)

How to contribute to Funtasks

Prerequisites: Make sure you have Python 3.9 or higher installed. You can check your version by running:

python3 --version
  1. Clone the repository:
    git clone https://github.com/software-students-fall2024/3-python-package-java_and_the_scripts_.git
    
  2. Enter the directory:
    cd  3-python-package-java_and_the_scripts_
    
  3. Set up a virtual environment using pipenv: If pipenv has not been installed, install using pip3 install pipenv. Now, run the following command to install all dependencies that we've included in the provided Pipfile:
    pipenv install --dev
    
  4. Activate the virtual environment:
    pipenv shell
    
  5. Modify and Run the file: Make the changes you need to the project, and run the main program to test.
    python -m funtasks
    

If you want to run another specific file (like tasks.py), you can run it as follows: ```bash python src/funtasks/tasks.py

  1. To run tests: Now, you can also run the unit tests we've provided in the package using pytest. Again, make sure pytest is installed in the virtual envrionment.
    pipenv run pytest
    
  2. Build the package:
    python3 -m build
    
  3. Exit the virtual environment: Once you're done working with the project, you can deactivate the virtual environment with:
    exit
    

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

funtasks-0.1.18.tar.gz (44.4 kB view details)

Uploaded Source

Built Distribution

funtasks-0.1.18-py3-none-any.whl (30.2 kB view details)

Uploaded Python 3

File details

Details for the file funtasks-0.1.18.tar.gz.

File metadata

  • Download URL: funtasks-0.1.18.tar.gz
  • Upload date:
  • Size: 44.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for funtasks-0.1.18.tar.gz
Algorithm Hash digest
SHA256 af88dde3cc199cc31e50a4cb2734f7267505002d48847b9b1b69ba1f4fdc79a5
MD5 47d554c5890b7b58563b1a9edebcfc40
BLAKE2b-256 db2037aec258ff093dce11a1475cf80878aede5919f4bb778b2e0cb1b389b0da

See more details on using hashes here.

File details

Details for the file funtasks-0.1.18-py3-none-any.whl.

File metadata

  • Download URL: funtasks-0.1.18-py3-none-any.whl
  • Upload date:
  • Size: 30.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for funtasks-0.1.18-py3-none-any.whl
Algorithm Hash digest
SHA256 6d911252437ae10562fa62b1eb054380a9f7214ab0f9f23afa0d5bcd57111bf8
MD5 185128f30c9d3392f92a7ad4bf429e91
BLAKE2b-256 10599c1b725bc23d3e029a6c6cbd70b0d78fa32596e5b15d6b4854472aadf972

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page