Skip to content

djdavejam/summative-lab-python-project-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project Management CLI Tool

A Python-based Command-Line Interface (CLI) application for managing a multi-user project tracker system. This tool allows administrators to efficiently manage users, projects, and tasks through structured CLI commands with persistent data storage.

Features

Core Functionality

  • User Management: Create, update, delete, and list users
  • Project Management: Create, assign, and manage projects with due dates
  • Task Management: Create, assign, complete, and track tasks within projects
  • Data Persistence: JSON-based local file storage for all entities
  • Relationship Management: One-to-many relationships between users and projects, projects and tasks

Key Capabilities

  • Assign multiple users to projects as contributors
  • Assign tasks to specific users
  • Track task completion status
  • Maintain data integrity with cascade delete operations
  • Comprehensive error handling and validation
  • User-friendly CLI interface with clear feedback

Installation and Setup

Prerequisites

  • Python 3.7 or higher
  • pip (Python package manager)

Installation Steps

  1. Clone or download the project files

    # Create project directory
    mkdir project-management-cli
    cd project-management-cli
    
    # Copy the main.py file to this directory
  2. Install dependencies

    pip install -r requirements.txt
  3. Make the script executable (optional)

    chmod +x main.py

Usage

Basic Command Structure

python main.py <command> <subcommand> [options]

User Management Commands

Add a New User

python main.py user add --name "John Doe" --email "john@example.com"

List All Users

python main.py user list

Update User Information

python main.py user update --id 123456 --name "John Smith" --email "johnsmith@example.com"

Delete a User

python main.py user delete --id 123456

Project Management Commands

Create a New Project

python main.py project add --user 123456 --title "Website Redesign" --description "Complete redesign of company website" --due-date "2024-12-31"

List All Projects

python main.py project list

List Projects for a Specific User

python main.py project list --user 123456

Update Project Details

python main.py project update --id 789012 --title "New Title" --description "Updated description" --due-date "2025-01-15"

Delete a Project

python main.py project delete --id 789012

Add User to Existing Project

python main.py project add-user --user 123456 --project 789012

Task Management Commands

Create a New Task

python main.py task add --project 789012 --title "Design homepage mockup"

Create a Task with Assignment

python main.py task add --project 789012 --title "Implement user authentication" --assigned-to 123456

List All Tasks

python main.py task list

List Tasks for a Specific Project

python main.py task list --project 789012

List Tasks Assigned to a User

python main.py task list --user 123456

Mark Task as Complete

python main.py task complete --id 345678

Update Task Details

python main.py task update --id 345678 --title "New task title" --status "in-progress" --assigned-to 123456

Unassign a Task

python main.py task update --id 345678 --assigned-to 0

Delete a Task

python main.py task delete --id 345678

Example Workflow

Here's a complete example demonstrating typical usage:

# 1. Create users
python main.py user add --name "Alice Johnson" --email "alice@company.com"
python main.py user add --name "Bob Smith" --email "bob@company.com"

# 2. Create a project (assume Alice's user ID is 123456)
python main.py project add --user 123456 --title "Mobile App Development" --description "Develop iOS and Android app" --due-date "2024-06-30"

# 3. Add Bob to the project (assume project ID is 789012 and Bob's ID is 654321)
python main.py project add-user --user 654321 --project 789012

# 4. Create tasks
python main.py task add --project 789012 --title "UI/UX Design" --assigned-to 123456
python main.py task add --project 789012 --title "Backend API" --assigned-to 654321
python main.py task add --project 789012 --title "Testing & QA"

# 5. Mark a task as complete (assume task ID is 111222)
python main.py task complete --id 111222

# 6. View project progress
python main.py task list --project 789012
python main.py project list --user 123456

Data Storage

File Structure

The application creates a data/ directory with the following JSON files:

  • users.json - Stores user information and project assignments
  • projects.json - Stores project details and contributor lists
  • tasks.json - Stores task information and assignments

Data Relationships

  • Users ↔ Projects: Many-to-many relationship (users can contribute to multiple projects)
  • Projects → Tasks: One-to-many relationship (projects contain multiple tasks)
  • Users ← Tasks: Many-to-one relationship (tasks can be assigned to users)

Testing

Running Unit Tests

python test_project_manager.py

Test Coverage

The test suite includes comprehensive coverage for:

  • User class functionality and data persistence
  • Project class functionality and relationships
  • Task class functionality and status management
  • DataManager JSON serialization/deserialization
  • ProjectManager business logic and cascade operations
  • Error handling and edge cases

Manual Testing Examples

# Test error handling
python main.py user delete --id 999999  # Non-existent user
python main.py project add --user 999999 --title "Test" --description "Test" --due-date "2024-12-31"  # Invalid user

# Test data persistence
python main.py user add --name "Test User" --email "test@example.com"
# Restart application
python main.py user list  # Should show previously created user

Architecture

Object-Oriented Design

  • User Class: Manages user data and project relationships
  • Project Class: Handles project information and contributor/task relationships
  • Task Class: Manages task details and assignment status
  • DataManager Class: Handles JSON persistence and file I/O operations
  • ProjectManager Class: Main business logic coordinator

Key Design Patterns

  • Repository Pattern: DataManager abstracts data storage
  • Command Pattern: CLI commands map to specific business operations
  • Factory Pattern: ID generation for entities
  • Cascade Operations: Maintains referential integrity

External Dependencies

  • argparse: CLI argument parsing and help generation
  • json: Data serialization and persistence
  • pathlib: Cross-platform file system operations
  • datetime: Timestamp generation and handling
  • typing: Type hints for better code documentation

Error Handling

The application includes comprehensive error handling for:

  • Invalid user inputs and command arguments
  • Missing or corrupted data files
  • Referential integrity violations
  • File system permission issues
  • JSON parsing errors

Known Issues and Limitations

  1. Single-threaded: Not designed for concurrent access
  2. Local Storage Only: Uses local JSON files (no database integration)
  3. Basic Validation: Limited input validation for email formats and dates
  4. No User Authentication: All operations are administrative level
  5. Memory Usage: Loads all data into memory (not suitable for very large datasets)

Future Enhancements

Potential improvements for future versions:

  • Database integration (SQLite, PostgreSQL)
  • Web-based interface
  • User authentication and role-based permissions
  • Advanced search and filtering capabilities
  • Task dependencies and scheduling
  • Email notifications and reminders
  • Data export/import functionality (CSV, Excel)
  • Multi-project templates and cloning

Contributing

To contribute to this project:

  1. Follow the existing code structure and naming conventions
  2. Add unit tests for any new functionality
  3. Update documentation for new features
  4. Ensure all tests pass before submitting changes

License

This project is created for educational purposes as part of a Python programming assignment.

Support

For issues or questions:

  1. Check the error messages for specific guidance
  2. Review the command help: python main.py --help
  3. Examine the test cases for usage examples
  4. Verify data file integrity in the data/ directory

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors