https://github.com/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.
https://github.com/paricoderdeveloper/library_managment
alembic crudoperations databasemanagement librarymanagementsystem orm python repositorypattern sqlalchemy sqlite
Last synced: 4 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/paricoderdeveloper/library_managment
- Owner: PariCoderDeveloper
- License: mit
- Created: 2025-03-31T07:03:12.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-05-25T05:23:42.000Z (8 months ago)
- Last Synced: 2025-06-08T08:09:16.949Z (8 months ago)
- Topics: alembic, crudoperations, databasemanagement, librarymanagementsystem, orm, python, repositorypattern, sqlalchemy, sqlite
- Language: Python
- Homepage:
- Size: 77.1 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# π 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 for `Book`, `Author`, `User`, and a separate `Repository` 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 a `ScreenManager`.
- **Areas for Improvement**
1. **Error Handling & Validation**
β Validate user input (e.g. non-empty strings, numeric fields). Wrap DB commits in try/except.
2. **Packaging & CLI**
β Consider a `setup.py` or `pyproject.toml` so users can `pip install .` and run via a console entry-point.
3. **Tests**
β Add a `tests/` folder with unit tests for each repository using `pytest` and an in-memory SQLite DB.
4. **Logging**
β Integrate Pythonβs `logging` module to capture runtime errors and user actions.
---
## β¨ 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
```plaintext
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
1. **Clone this repository**
```bash
git clone https://github.com/PariCoderDeveloper/Library_Managment.git
cd Library_Managment
```
2. **Create & activate a virtual environment** (recommended)
```bash
python3 -m venv venv
source venv/bin/activate # macOS/Linux
venv\Scripts\activate # Windows
```
3. **Install dependencies**
```bash
pip install -r requirements.txt
```
> *requirements.txt* should include at least:
>
> ```
> kivy
> SQLAlchemy
> ```
---
## βΆοΈ Usage
1. **Initialize the database** (first run only)
```bash
python -c "from database import init_db; init_db()"
```
2. **Launch the application**
```bash
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)
```bash
pytest
```
* **Lint & format**
```bash
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
1. **Fork** this repo
2. **Create** your feature branch:
```bash
git checkout -b feature/my-feature
```
3. **Commit** your changes:
```bash
git commit -m "Add my feature"
```
4. **Push** to your branch:
```bash
git push origin feature/my-feature
```
5. **Open** a Pull Request here on GitHub.
---
## π License
This project is licensed under the **MIT License**. See [LICENSE](LICENSE) for details.
---
## π¬ Contact
**Pari Coder**
* GitHub: [@PariCoderDeveloper](https://github.com/PariCoderDeveloper)
* Email: [parisaalizadeh13821382@gmail.com](mailto:parisaalizadeh13821382@gmail.com)
Feel free to open an issue if you run into any problems or have suggestions!