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.
- Modular & OOP-based
– Classes forBook
,Author
,User
, and a separateRepository
layer keep business logic neatly encapsulated. - SQLAlchemy ORM
– Smooth integration with SQLite; sessions are managed appropriately in each repository. - Kivy GUI
– Declarative.kv
layout 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.py
orpyproject.toml
so users canpip install .
and run via a console entry-point. - Tests
– Add atests/
folder with unit tests for each repository usingpytest
and an in-memory SQLite DB. - Logging
– Integrate Python’slogging
module to capture runtime errors and user actions.
- Error Handling & Validation
- ➕ 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
- Language: Python 3.7+
- GUI: Kivy
- Database: SQLite (via SQLAlchemy ORM)
- Architecture: OOP + Repository Pattern
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
-
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
-
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.
-
Run tests (once you add them)
pytest
-
Lint & format
black src flake8 src
- ✅ 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)
-
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.
This project is licensed under the MIT License. See LICENSE for details.
Pari Coder
- GitHub: @PariCoderDeveloper
- Email: parisaalizadeh13821382@gmail.com
Feel free to open an issue if you run into any problems or have suggestions!