PariCoderDeveloper/Library_Managment
The Library Management System is a desktop application for managing books, authors, and user profiles. It allows users to add, update, and delete data, using SQLAlchemy for database management. The system follows the Repository Design Pattern for organized and efficient data access.
π Library Management System
A cross-platform desktop application for managing a libraryβs collection of books, authors, and user profiles.
Built with Python 3, Kivy for the GUI, and SQLite via SQLAlchemy for data persistence.
Follows the Repository Design Pattern for clean separation of concerns.
π§ Code Review Summary
- Modular & OOP-based
β Classes forBook,Author,User, and a separateRepositorylayer keep business logic neatly encapsulated. - SQLAlchemy ORM
β Smooth integration with SQLite; sessions are managed appropriately in each repository. - Kivy GUI
β Declarative.kvlayout files paired with well-named Python callbacks; screens are organized via aScreenManager. - Areas for Improvement
- Error Handling & Validation
β Validate user input (e.g. non-empty strings, numeric fields). Wrap DB commits in try/except. - Packaging & CLI
β Consider asetup.pyorpyproject.tomlso users canpip install .and run via a console entry-point. - Tests
β Add atests/folder with unit tests for each repository usingpytestand an in-memory SQLite DB. - Logging
β Integrate Pythonβsloggingmodule to capture runtime errors and user actions.
- Error Handling & Validation
β¨ Features
- β Add, edit, and delete books
- π€ Manage authors and user profiles
- π Search and filter the book collection
- πΎ Persistent storage using SQLite (no external DB server needed)
- π₯οΈ Modern, touch-friendly GUI built with Kivy
- ποΈ Clean data access via Repository Pattern
π οΈ Tech Stack
- Language: Python 3.7+
- GUI: Kivy
- Database: SQLite (via SQLAlchemy ORM)
- Architecture: OOP + Repository Pattern
π Project Structure
Library_Managment/
βββ src/
β βββ models/ # SQLAlchemy ORM models
β β βββ book.py
β β βββ author.py
β β βββ user.py
β βββ repositories/ # Repository classes wrapping session & CRUD
β β βββ book_repo.py
β β βββ author_repo.py
β β βββ user_repo.py
β βββ gui/ # Kivy app code & KV layout files
β β βββ main.py # App entry point and ScreenManager setup
β β βββ library.kv # Kivy language file defining screens & widgets
β β βββ book_screen.py
β β βββ author_screen.py
β β βββ user_screen.py
β βββ database.py # Engine & session factory (with init_db())
β βββ main.py # Top-level launcher (imports and runs gui/main.py)
βββ requirements.txt # SQLAlchemy, Kivy, etc.
βββ library.db # (auto-created) SQLite data file
βββ LICENSE
βββ README.md
πΎ Installation
-
Clone this repository
git clone https://github.com/PariCoderDeveloper/Library_Managment.git cd Library_Managment -
Create & activate a virtual environment (recommended)
python3 -m venv venv source venv/bin/activate # macOS/Linux venv\Scripts\activate # Windows
-
Install dependencies
pip install -r requirements.txt
requirements.txt should include at least:
kivy SQLAlchemy
βΆοΈ Usage
-
Initialize the database (first run only)
python -c "from database import init_db; init_db()" -
Launch the application
python src/gui/main.py
The Kivy window will open, letting you switch between Books, Authors, and Users screens. All changes persist to library.db in the project root.
π οΈ Development
-
Run tests (once you add them)
pytest
-
Lint & format
black src flake8 src
π Future Improvements
- β Add user authentication & roles (e.g. Admin vs. Member)
- β Export/import book data as CSV
- π Theme support (using Kivyβs styles or third-party themes)
- π§ͺ Comprehensive unit & integration tests
- π¦ Build distributable packages (e.g. via PyInstaller or Buildozer)
π€ Contributing
-
Fork this repo
-
Create your feature branch:
git checkout -b feature/my-feature
-
Commit your changes:
git commit -m "Add my feature" -
Push to your branch:
git push origin feature/my-feature
-
Open a Pull Request here on GitHub.
π License
This project is licensed under the MIT License. See LICENSE for details.
π¬ Contact
Pari Coder
- GitHub: @PariCoderDeveloper
- Email: parisaalizadeh13821382@gmail.com
Feel free to open an issue if you run into any problems or have suggestions!