An open API service indexing awesome lists of open source software.

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.

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!