Skip to content

Aravind9712/library-management-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

📚 Library Management System (Python OOP Project)

🧭 Overview

This is a console-based Library Management System built using Python’s Object-Oriented Programming (OOP) concepts.
It helps manage books and borrowers, handle borrowing/returning of books, and check availability — all through a simple terminal interface.
This project is beginner-friendly and focuses on class design, modular coding, and data handling.


🎯 Objective

To design a mini library system that demonstrates:

  • Python OOP concepts
  • Clean and modular project structure
  • In-memory data management
  • Console-based user input/output

⚙️ Technical Requirements

Component Description
Language Python 3.8 or higher
Libraries Only standard libraries (datetime, sys)
IDE Visual Studio Code / PyCharm / Any text editor
Version Control Git & GitHub
Execution Run from terminal or command prompt
Hardware 4GB RAM or more

🧩 Project Structure

library-management-python/ ├── src/ │ ├── book.py # Book class definition │ ├── borrower.py # Borrower class definition │ ├── library.py # Library management logic ├── main.py # Entry point with menu loop ├── README.md # Project overview and usage guide └── .gitignore # Ignore cache and temporary files


💡 Features

✅ Add, update, and view books
✅ Add borrowers and manage memberships
✅ Borrow and return books
✅ Track due dates using datetime
✅ Check availability of books
✅ Simple console menu system


🏗️ Step-by-Step Flow

  1. Plan Classes — Identify Book, Borrower, and Library.
  2. Create Book Class — Handles book info (title, author, ISBN, quantity).
  3. Create Borrower Class — Stores user info and borrowed book list.
  4. Create Library Class — Manages all books and borrowers.
  5. Add Borrowing Logic — Uses datetime for due dates.
  6. Build main.py Menu — Console-based interaction system.
  7. Test and Handle Errors — Validate user inputs and logic.
  8. Push to GitHub — Use Git for version control and sharing.

🧠 Example Code Snippets

Book Class (src/book.py)

class Book:
    def __init__(self, title, author, isbn, genre, quantity):
        self.title = title
        self.author = author
        self.isbn = isbn
        self.genre = genre
        self.quantity = quantity

    def update_quantity(self, new_quantity):
        if new_quantity >= 0:
            self.quantity = new_quantity
        else:
            print("Quantity cannot be negative.")

from src.book import Book
from src.borrower import Borrower
from src.library import Library

library = Library()

while True:
    print("\n==== Library Management System ====")
    print("1. Add Book")
    print("2. Add Borrower")
    print("3. Borrow Book")
    print("4. Exit")
    choice = input("Enter your choice: ")

    if choice == '1':
        title = input("Book Title: ")
        author = input("Author: ")
        isbn = input("ISBN: ")
        genre = input("Genre: ")
        quantity = int(input("Quantity: "))
        library.add_book(Book(title, author, isbn, genre, quantity))
        print("✅ Book added successfully!")

    elif choice == '2':
        name = input("Borrower Name: ")
        contact = input("Contact: ")
        mid = input("Membership ID: ")
        library.add_borrower(Borrower(name, contact, mid))
        print("✅ Borrower added successfully!")

    elif choice == '3':
        mid = input("Membership ID: ")
        isbn = input("Book ISBN: ")
        library.borrow_book(mid, isbn)

    elif choice == '4':
        print("👋 Exiting... Thank you!")
        break

    else:
        print("❌ Invalid choice! Try again.")


Run the main program
    python main.py

Example Output

==== Library Management System ====
1. Add Book
2. Add Borrower
3. Borrow Book
4. Exit
Enter your choice: 1
Book Title: Python Basics
Author: John Doe
ISBN: 12345
Genre: Programming
Quantity: 5Book added successfully!

Author

Aravind M
🎓 B.Com | 💻 Full Stack Developer (Nxtwave)
📍 Dharmapuri, India
📬 Open to collaboration and learning

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages