Skip to content

Harsh-GitHup/Library-Management-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📚 Library Management System (LMS)

Overview

The Library Management System (LMS) is a console-based application built using Python and Object-Oriented Programming (OOP) principles. It manages books, members, and the transactions involved in lending and returning books. Data persistence is achieved by integrating the application with a MySQL relational database.

✨ Features

The system implements a full set of CRUD (Create, Read, Update, Delete) operations and transaction logic:

📖 Book Management

  • Add a New Book: Register a new title with details (Title, Author, ISBN, Quantity).
  • Delete a Book: Remove a book record by its ID.
  • Update Book Details: Modify the available quantity of a book.
  • View Book Details: Retrieve details for a single book or list all books in a structured format.

🧑‍🦱 Member Management

  • Register a New Member: Add new members with their name, phone, and email.
  • View All Members: List all registered library members.

🔄 Transaction Management

  • Issue a Book: Decrements book quantity, logs a transaction record with an issue date, and prevents double-issuance of the same book to the same member.
  • Return a Book: Increments book quantity, and updates the transaction record with a return date.

⚙️ Technology Stack

Component Technology Role
Language Python 3.x Core application logic (OOP)
Database MySQL Secure and persistent data storage
Connector mysql-connector-python Python-to-MySQL communication
Structure Modular OOP Separation of Concerns (Data Models, Business Logic)

📁 Project Structure

📁Library_Management_System   # Root Folder
  ├── 📁core                  # Python Package containing all core logic
      ├── __init__.py         # Exposes core classes (Book, Member, Library and more)
      ├── book.py             # Book Class (Data Model  )
      ├── db_connector.py     # Database Connector Class
      ├── query_helper.py     # Query Helper Class (Utility Methods)
      ├── member.py           # Member Class (Data Model)
      └── library.py          # Library Class (Business Logic & DB Connector)
  ├── 📁schema                # SQL scripts for database setup
      └── library_schema.sql  # SQL script for database/table creation
  ├── .env.example            # Example environment variables file
  ├── .gitignore              # Git ignore file
  ├── app.py                  # Main execution script (User Interface/Menu)
  ├── requirements.txt        # List of Python dependencies
  └── README.md               # Project documentation and setup instructions

🚀 Setup and Installation

Follow these steps to get the project running on your local machine.

1. Prerequisites

  • Python 3.x: Ensure Python is installed.
  • MySQL Server: Ensure a local MySQL server instance is running (e.g., via XAMPP, Docker, or standalone installation).

2. Clone the Repository

git clone https://github.com/YourUsername/Library_Management_System.git
cd Library_Management_System

3. Install Dependencies

You only need the MySQL connector library.

pip install mysql-connector-python

4. Configure Database

You must set up the database and tables before running the script.

  1. Create Database Schema: Execute the SQL commands in docs/library_schema.sql on your MySQL server. This creates the library_db database and the books, members, and transactions tables.

    -- Example of the necessary tables:
    CREATE TABLE books (...);
    CREATE TABLE members (...);
    CREATE TABLE transactions (...);
  2. Update Credentials: Open the main.py file and update the database connection variables (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) to match your local MySQL configuration.

    # In main.py
    DB_HOST = "localhost"
    DB_USER = "root"
    DB_PASSWORD = "your_mysql_password"  # <-- CHANGE THIS
    DB_NAME = "library_db"

5. Run the Application

Execute the main script from the root directory:

python main.py

The console menu will appear, allowing you to interact with the system.

👩‍💻 OOP Implementation Details

The project rigorously follows OOP principles:

  • Encapsulation: Attributes in the Book and Member classes are marked as private (using __ prefix) and accessed via public getter @property methods.
  • Separation of Concerns:
    • Data Models (book.py, member.py) handle object data structure only.
    • Business Logic (library.py) handles all database connections, validation, and core transaction logic.
    • User Interface (main.py) handles only user interaction and input validation.

This structure allows for easy maintenance and future expansion (e.g., adding a GUI or a web interface).

🔮 Future Enhancements

  • Late Fee Calculation: Implement logic within return_book to calculate fees based on issue and return dates.
  • Search Functionality: Add robust search options (by title, author, or member name).
  • Data Export: Implement options to export book or member lists to CSV or Excel.

🌪 Todos

  • Implement add book functionality.
  • Implement view book details functionality.
  • Implement member registration functionality.
  • Implement issue book functionality.
  • Implement return book functionality.
  • Implement view member transactions functionality.
  • Add error handling for database operations.
  • Add search functionality for books and members.
  • Write unit tests for core classes and methods.
  • Create a GUI or web interface for better user experience.
  • Implement late fee calculation logic.
    • Calculate late fees based on issue and return dates.
    • Integrate fee calculation into the return_book method.
    • Add user prompts for fee payment during book return.
    • Update database schema to store late fee information.
    • Consider edge cases (e.g., lost books, damaged books).
    • Provide admin options to waive or adjust late fees.
    • Ensure compliance with local regulations regarding late fees.
    • Test late fee functionality thoroughly.

Developed by: Harsh Kesharwani

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages