0% found this document useful (0 votes)
6 views

Project Report

Uploaded by

shouryamalvi001
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Project Report

Uploaded by

shouryamalvi001
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

Project Report: Library Management

System in Python

1.Introduction
The Library Management System is a comprehensive
software application designed to efficiently manage library
operations. This Python-based system facilitates various
essential functions such as book borrowing, returning, adding
new books, and maintaining a detailed record of members. By
automating repetitive tasks, the system ensures enhanced
productivity, reduced manual errors, and user convenience for
both librarians and library members. The project aims to
modernize library management by integrating technology into
traditional processes.

2. Objectives
 Automate routine library operations such as book
issuance, returns, and member registration.
 Provide a user-friendly interface that caters to both
technical and non-technical users.
 Enhance the efficiency, accuracy, and reliability of
library management tasks.
 Ensure secure storage and easy retrieval of library data.
 Enable seamless access to information about books and
members.
Features of the System
 Book Management: Comprehensive functionalities to
add, update, delete, and search for books. Includes
tracking of book availability.
 Member Management: Enables easy registration,
updates, and record maintenance for library members.
 Borrowing and Returning: Streamlines the tracking of
issued books, due dates, and return processing.
 Search Functionality: Advanced search options for
finding books by title, author, genre, or ISBN.
 Report Generation: Automated generation of detailed
reports on issued books, overdue records, and overall
library statistics

 Frameworks and Libraries:


 Tkinter: For creating a graphical user interface (GUI).
 SQLite3: To manage database operations.
 Pandas: For efficient data handling, analysis, and
reporting.
System Design
The Library Management System follows a modular design
approach to ensure scalability, maintainability, and ease of
development. The system consists of the following modules:
 User Interface Module: Delivers an intuitive graphical
user interface (GUI) for smooth interaction.
 Database Module: Manages the underlying database,
ensuring secure data storage and retrieval.
 Logic Module: Implements the core functionalities of
the system, including book issuance, returns, and
availability checks.

 Database Schema
The system’s database comprises three primary tables:
 Books: Stores book details such as ISBN, title, author,
and availability status.
 Members: Maintains records of library members,
including their name, contact details, and unique
membership ID.
 Transactions: Logs every book issuance and return,
including member details, dates, and transaction IDs.
Advantages of the Program
 Ease of Use: The user-friendly interface ensures that
both librarians and members can navigate the system
effortlessly.
 Time Efficiency: Automating repetitive tasks like book
tracking and member management saves significant time
for library staff.
 Accuracy: Reduces the chances of human errors in
record-keeping and transactions.
 Scalability: The modular design allows for easy addition
of new features as library needs grow.
 Cost-Effective: Built using free and open-source tools,
the system is a budget-friendly solution for libraries of
all sizes.
 Enhanced Reporting: Provides detailed insights into
library operations through automated reports.
 Security: Ensures secure data storage and minimizes the
risk of data loss through robust database management.
 Customizability: Easily customizable to meet the
specific requirements of different libraries.
SOURCE CODE
import sqlite3

# Function to connect to SQLite database

def connect_to_database():
try:
# Connect to the SQLite database (creates the file if it
doesn't exist)
conn = sqlite3.connect("library.db")

# Create the 'books' table if it doesn't exist


cursor = conn.cursor()
cursor.execute("""
CREATE TABLE IF NOT EXISTS books (
book_id INTEGER PRIMARY KEY,
title TEXT NOT NULL,
author TEXT NOT NULL,
publication_year INTEGER NOT NULL,
quantity INTEGER NOT NULL,
is_rented INTEGER DEFAULT 0
)
""")
conn.commit()
return conn
except sqlite3.Error as e:
print("Database connection failed:", e)
return None

# Function to add a book

def add_book(conn):
try:
book_id = int(input("Enter Book ID: "))
title = input("Enter Book Title: ")
author = input("Enter Author Name: ")
publication_year = int(input("Enter Publication Year: "))
quantity = int(input("Enter Quantity: "))

cursor = conn.cursor()
cursor.execute(
"INSERT INTO books (book_id, title, author,
publication_year, quantity, is_rented) VALUES (?, ?, ?, ?, ?,
0)",
(book_id, title, author, publication_year, quantity)
)
conn.commit()
print("Book added successfully.")
except sqlite3.Error as e:
print("Error adding book:", e)

# Function to view all books

def view_books(conn):
try:
cursor = conn.cursor()
cursor.execute("SELECT * FROM books")
books = cursor.fetchall()

print("\nBooks in Library:")
print(f"{'ID':<10}{'Title':<30}{'Author':<30}
{'Year':<10}{'Quantity':<10}{'Rented':<10}")
print("-" * 100)
for book in books:
rented_status = "Yes" if book[5] else "No"
print(f"{book[0]:<10}{book[1]:<30}{book[2]:<30}
{book[3]:<10}{book[4]:<10}{rented_status:<10}")
except sqlite3.Error as e:
print("Error fetching books:", e)

# Function to delete a book

def delete_book(conn):
try:
book_id = int(input("Enter Book ID to delete: "))

cursor = conn.cursor()
cursor.execute("DELETE FROM books WHERE
book_id = ?", (book_id,))
conn.commit()

if cursor.rowcount > 0:
print("Book deleted successfully.")
else:
print("Book not found.")
except sqlite3.Error as e:
print("Error deleting book:", e)

# Function to rent multiple books


def rent_multiple_books(conn):
try:
book_ids = input("Enter Book IDs to rent (comma-
separated): ").split(",")
book_ids = [int(book_id.strip()) for book_id in book_ids]

cursor = conn.cursor()

for book_id in book_ids:


cursor.execute("SELECT quantity, is_rented FROM
books WHERE book_id = ?", (book_id,))
result = cursor.fetchone()

if result is None:
print(f"Book ID {book_id} not found.")
elif result[0] <= 0:
print(f"Book ID {book_id} is out of stock.")
elif result[1] == 1:
print(f"Book ID {book_id} is already rented.")
else:
cursor.execute("UPDATE books SET is_rented = 1,
quantity = quantity - 1 WHERE book_id = ?", (book_id,))
conn.commit()
print(f"Book ID {book_id} rented successfully.")
except sqlite3.Error as e:
print("Error renting books:", e)
except ValueError:
print("Invalid input. Please enter valid book IDs.")

# Function to return a rented book


def return_book(conn):
try:
book_id = int(input("Enter Book ID to return: "))

cursor = conn.cursor()
cursor.execute("SELECT is_rented FROM books
WHERE book_id = ?", (book_id,))
result = cursor.fetchone()
if result is None:
print("Book not found.")
elif result[0] == 0:
print("Book is not rented.")
else:
cursor.execute("UPDATE books SET is_rented = 0,
quantity = quantity + 1 WHERE book_id = ?", (book_id,))
conn.commit()
print("Book returned successfully.")
except sqlite3.Error as e:
print("Error returning book:", e)

# Main menu
def main():
connection = connect_to_database()
if not connection:
print("Failed to connect to the database. Exiting...")
return

while True:
print("\nLibrary Management System")
print("1. Add Book")
print("2. View Books")
print("3. Delete Book")
print("4. Rent Books")
print("5. Return Book")
print("6. Exit")

choice = input("Enter your choice: ")

if choice == "1":
add_book(connection)
elif choice == "2":
view_books(connection)
elif choice == "3":
delete_book(connection)
elif choice == "4":
rent_multiple_books(connection)
elif choice == "5":
return_book(connection)
elif choice == "6":
print("Exiting the program.")
connection.close()
break
else:
print("Invalid choice. Please try again.")

if __name__ == "__main__":
main()
OUTPUT

1.Adding a book to the library


2.For Viewing a book

3.To delete a book


Before deleting maths book

After deleting maths book


4. To rent a book
5.For returning a book
Testing and Validation
The Library Management System underwent extensive testing to
ensure functionality, reliability, and performance:

 Unit Testing: Each module was tested independently to confirm


accurate functionality.
 Integration Testing: Modules were integrated and tested
collectively to ensure seamless communication between
components.
 Usability Testing: Feedback was gathered from potential users to
improve the user interface and system workflows.
 Performance Testing: The system was evaluated for efficiency
with increasing data loads and concurrent transactions.
Conclusion
The Library Management System in Python is a robust
solution for automating library operations, ensuring accuracy,
and enhancing user experience. With its modular design and
thoughtful implementation, the system is adaptable to diverse
library requirements. Future enhancements will further
improve its functionality, making it a comprehensive tool for
modern libraries.

Future Enhancements
 Cloud Integration: Transitioning to cloud-based databases
to facilitate remote access and scalability.
 Advanced Notifications: Introducing SMS or email
reminders for overdue books and due dates.
 Mobile Application: Developing a companion mobile app
for easy access to library functionalities on the go.
 Enhanced Reporting: Adding real-time dashboards and
visual analytics for better insights into library operations.
 Book Reservations: Enabling members to reserve books
online, with automatic notifications upon availability.

BIBLIOGRAPHY

 Computer Science with Python Textbook for Class


12
Publisher: Dhanpat Rai Publications
Source for Python programming concepts and
database management details.

 ChatGPT-Utilized for coding assistance,


explanations, and conceptual clarifications related
to the project.

You might also like