laypatel13-library-manager 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- laypatel13_library_manager-0.1.0/PKG-INFO +85 -0
- laypatel13_library_manager-0.1.0/README.md +68 -0
- laypatel13_library_manager-0.1.0/laypatel13_library_manager.egg-info/PKG-INFO +85 -0
- laypatel13_library_manager-0.1.0/laypatel13_library_manager.egg-info/SOURCES.txt +10 -0
- laypatel13_library_manager-0.1.0/laypatel13_library_manager.egg-info/dependency_links.txt +1 -0
- laypatel13_library_manager-0.1.0/laypatel13_library_manager.egg-info/entry_points.txt +2 -0
- laypatel13_library_manager-0.1.0/laypatel13_library_manager.egg-info/requires.txt +2 -0
- laypatel13_library_manager-0.1.0/laypatel13_library_manager.egg-info/top_level.txt +1 -0
- laypatel13_library_manager-0.1.0/library_manager/__init__.py +0 -0
- laypatel13_library_manager-0.1.0/library_manager/main.py +182 -0
- laypatel13_library_manager-0.1.0/pyproject.toml +41 -0
- laypatel13_library_manager-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: laypatel13-library-manager
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A colorful CLI library manager for tracking books and reading progress
|
|
5
|
+
Author-email: Lay Patel <lay.patel.1313@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/laypatel13/library-manager
|
|
8
|
+
Keywords: cli,library,books,reading,manager
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
Requires-Dist: colorama==0.4.6
|
|
16
|
+
Requires-Dist: tabulate>=0.9.0
|
|
17
|
+
|
|
18
|
+
# 📚 Library Manager - CLI
|
|
19
|
+
|
|
20
|
+
A simple command-line Library Manager built using Python.
|
|
21
|
+
This project helps you track your books, manage reading progress, and maintain your personal library with a colorful and neatly formatted interface.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## ✨ Features
|
|
26
|
+
|
|
27
|
+
- Add books with title, author, and publication year
|
|
28
|
+
- View all books in a formatted table
|
|
29
|
+
- View only unread books
|
|
30
|
+
- Mark books as read
|
|
31
|
+
- Save data in a JSON file (`books.json`)
|
|
32
|
+
- Reset entire library when needed
|
|
33
|
+
- Colorful CLI output for better readability
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 📦 Install via pip
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install laypatel13-library-manager
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then run it from anywhere in your terminal:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
library-manager
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 🛠️ Install from source
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
git clone https://github.com/laypatel13/library-manager.git
|
|
55
|
+
cd library-manager
|
|
56
|
+
pip install -r requirements.txt
|
|
57
|
+
pip install -e .
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Then run:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
library-manager
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 📂 Project Structure
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
library-manager/
|
|
72
|
+
├── library_manager/
|
|
73
|
+
│ ├── __init__.py
|
|
74
|
+
│ └── main.py
|
|
75
|
+
├── pyproject.toml
|
|
76
|
+
├── requirements.txt
|
|
77
|
+
└── README.md
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 🧰 Built With
|
|
83
|
+
|
|
84
|
+
- Used [Colorama](https://pypi.org/project/colorama/) for colored terminal output.
|
|
85
|
+
- Used [Tabulate](https://pypi.org/project/tabulate/) for formatted table display.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# 📚 Library Manager - CLI
|
|
2
|
+
|
|
3
|
+
A simple command-line Library Manager built using Python.
|
|
4
|
+
This project helps you track your books, manage reading progress, and maintain your personal library with a colorful and neatly formatted interface.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## ✨ Features
|
|
9
|
+
|
|
10
|
+
- Add books with title, author, and publication year
|
|
11
|
+
- View all books in a formatted table
|
|
12
|
+
- View only unread books
|
|
13
|
+
- Mark books as read
|
|
14
|
+
- Save data in a JSON file (`books.json`)
|
|
15
|
+
- Reset entire library when needed
|
|
16
|
+
- Colorful CLI output for better readability
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 📦 Install via pip
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install laypatel13-library-manager
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then run it from anywhere in your terminal:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
library-manager
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 🛠️ Install from source
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
git clone https://github.com/laypatel13/library-manager.git
|
|
38
|
+
cd library-manager
|
|
39
|
+
pip install -r requirements.txt
|
|
40
|
+
pip install -e .
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then run:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
library-manager
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 📂 Project Structure
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
library-manager/
|
|
55
|
+
├── library_manager/
|
|
56
|
+
│ ├── __init__.py
|
|
57
|
+
│ └── main.py
|
|
58
|
+
├── pyproject.toml
|
|
59
|
+
├── requirements.txt
|
|
60
|
+
└── README.md
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 🧰 Built With
|
|
66
|
+
|
|
67
|
+
- Used [Colorama](https://pypi.org/project/colorama/) for colored terminal output.
|
|
68
|
+
- Used [Tabulate](https://pypi.org/project/tabulate/) for formatted table display.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: laypatel13-library-manager
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A colorful CLI library manager for tracking books and reading progress
|
|
5
|
+
Author-email: Lay Patel <lay.patel.1313@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/laypatel13/library-manager
|
|
8
|
+
Keywords: cli,library,books,reading,manager
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
Requires-Dist: colorama==0.4.6
|
|
16
|
+
Requires-Dist: tabulate>=0.9.0
|
|
17
|
+
|
|
18
|
+
# 📚 Library Manager - CLI
|
|
19
|
+
|
|
20
|
+
A simple command-line Library Manager built using Python.
|
|
21
|
+
This project helps you track your books, manage reading progress, and maintain your personal library with a colorful and neatly formatted interface.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## ✨ Features
|
|
26
|
+
|
|
27
|
+
- Add books with title, author, and publication year
|
|
28
|
+
- View all books in a formatted table
|
|
29
|
+
- View only unread books
|
|
30
|
+
- Mark books as read
|
|
31
|
+
- Save data in a JSON file (`books.json`)
|
|
32
|
+
- Reset entire library when needed
|
|
33
|
+
- Colorful CLI output for better readability
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 📦 Install via pip
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install laypatel13-library-manager
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then run it from anywhere in your terminal:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
library-manager
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 🛠️ Install from source
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
git clone https://github.com/laypatel13/library-manager.git
|
|
55
|
+
cd library-manager
|
|
56
|
+
pip install -r requirements.txt
|
|
57
|
+
pip install -e .
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Then run:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
library-manager
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 📂 Project Structure
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
library-manager/
|
|
72
|
+
├── library_manager/
|
|
73
|
+
│ ├── __init__.py
|
|
74
|
+
│ └── main.py
|
|
75
|
+
├── pyproject.toml
|
|
76
|
+
├── requirements.txt
|
|
77
|
+
└── README.md
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 🧰 Built With
|
|
83
|
+
|
|
84
|
+
- Used [Colorama](https://pypi.org/project/colorama/) for colored terminal output.
|
|
85
|
+
- Used [Tabulate](https://pypi.org/project/tabulate/) for formatted table display.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
laypatel13_library_manager.egg-info/PKG-INFO
|
|
4
|
+
laypatel13_library_manager.egg-info/SOURCES.txt
|
|
5
|
+
laypatel13_library_manager.egg-info/dependency_links.txt
|
|
6
|
+
laypatel13_library_manager.egg-info/entry_points.txt
|
|
7
|
+
laypatel13_library_manager.egg-info/requires.txt
|
|
8
|
+
laypatel13_library_manager.egg-info/top_level.txt
|
|
9
|
+
library_manager/__init__.py
|
|
10
|
+
library_manager/main.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
library_manager
|
|
File without changes
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
from colorama import init, Fore, Back, Style
|
|
4
|
+
from tabulate import tabulate
|
|
5
|
+
|
|
6
|
+
init(autoreset=True)
|
|
7
|
+
|
|
8
|
+
books = []
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def load_books():
|
|
12
|
+
if os.path.exists("books.json"):
|
|
13
|
+
try:
|
|
14
|
+
with open("books.json", "r") as f:
|
|
15
|
+
content = f.read()
|
|
16
|
+
if content.strip() == "":
|
|
17
|
+
return []
|
|
18
|
+
return json.loads(content)
|
|
19
|
+
except (json.JSONDecodeError, IOError) as e:
|
|
20
|
+
print(Fore.WHITE + Back.RED + f"Fatal Error: Failed To Load Books. {e}" + Style.RESET_ALL)
|
|
21
|
+
return []
|
|
22
|
+
return []
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def save_books():
|
|
26
|
+
try:
|
|
27
|
+
with open("books.json", "w") as f:
|
|
28
|
+
json.dump(books, f)
|
|
29
|
+
except IOError as e:
|
|
30
|
+
print(Fore.WHITE + Back.RED + f"Fatal Error: Failed To Save Books. {e}" + Style.RESET_ALL)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def add_book():
|
|
34
|
+
while True:
|
|
35
|
+
title = input(
|
|
36
|
+
Fore.WHITE + Style.NORMAL + "Enter Book Title (or 'quit' to finish): " + Style.RESET_ALL)
|
|
37
|
+
if title.lower() == "quit":
|
|
38
|
+
break
|
|
39
|
+
author = input(Fore.WHITE + Style.NORMAL + "Enter Author Name: " + Style.RESET_ALL)
|
|
40
|
+
|
|
41
|
+
year = input(Fore.WHITE + Style.NORMAL + "Enter Publication Year: " + Style.RESET_ALL)
|
|
42
|
+
|
|
43
|
+
new_book = {
|
|
44
|
+
"title": title,
|
|
45
|
+
"author": author,
|
|
46
|
+
"year": year,
|
|
47
|
+
"is_read": False
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
books.append(new_book)
|
|
51
|
+
|
|
52
|
+
print(Fore.GREEN + Back.BLACK + Style.BRIGHT + "Book Added Successfully!" + Style.RESET_ALL + "\n")
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def view_books():
|
|
56
|
+
if not books:
|
|
57
|
+
print(Fore.WHITE + Back.BLACK + Style.BRIGHT + "No Books In Library." + Style.RESET_ALL)
|
|
58
|
+
return
|
|
59
|
+
|
|
60
|
+
print("\n" + Fore.BLACK + Back.WHITE + "--- Library Books ---" + Style.RESET_ALL)
|
|
61
|
+
|
|
62
|
+
table_data = []
|
|
63
|
+
|
|
64
|
+
for index, book in enumerate(books, start=1):
|
|
65
|
+
|
|
66
|
+
status = "Read" if book["is_read"] else "Unread"
|
|
67
|
+
|
|
68
|
+
table_data.append([index, book["title"], book["author"], book["year"], status])
|
|
69
|
+
|
|
70
|
+
headers = ["Index", "Title", "Author", "Year", "Status"]
|
|
71
|
+
|
|
72
|
+
print(tabulate(table_data, headers=headers, tablefmt="pretty", disable_numparse=True))
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def view_unread_books():
|
|
76
|
+
unread_books = []
|
|
77
|
+
|
|
78
|
+
for book in books:
|
|
79
|
+
if not book["is_read"]:
|
|
80
|
+
unread_books.append(book)
|
|
81
|
+
|
|
82
|
+
if not unread_books:
|
|
83
|
+
print(Fore.WHITE + Back.BLACK + Style.BRIGHT + "No Unread Books Found." + Style.RESET_ALL)
|
|
84
|
+
return
|
|
85
|
+
|
|
86
|
+
print("\n" + Fore.BLACK + Back.WHITE + "--- Unread Books ---" + Style.RESET_ALL)
|
|
87
|
+
|
|
88
|
+
table_data = []
|
|
89
|
+
|
|
90
|
+
for index, book in enumerate(unread_books, start=1):
|
|
91
|
+
table_data.append([index, book["title"], book["author"], book["year"]])
|
|
92
|
+
|
|
93
|
+
headers = ["Index", "Title", "Author", "Year"]
|
|
94
|
+
|
|
95
|
+
print(tabulate(table_data, headers=headers, tablefmt="pretty", disable_numparse=True))
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def mark_book_as_read():
|
|
99
|
+
if not books:
|
|
100
|
+
print(Fore.WHITE + Back.BLACK + Style.BRIGHT + "No Books Available." + Style.RESET_ALL)
|
|
101
|
+
return
|
|
102
|
+
|
|
103
|
+
view_books()
|
|
104
|
+
|
|
105
|
+
try:
|
|
106
|
+
index_num = int(
|
|
107
|
+
input("\n" + Fore.CYAN + Style.BRIGHT + "Enter Book Index To Mark As Read: " + Style.RESET_ALL))
|
|
108
|
+
|
|
109
|
+
if index_num < 1 or index_num > len(books):
|
|
110
|
+
print(Fore.RED + Style.BRIGHT + "Invalid Index!" + Style.RESET_ALL)
|
|
111
|
+
return
|
|
112
|
+
|
|
113
|
+
books[index_num - 1]["is_read"] = True
|
|
114
|
+
|
|
115
|
+
save_books()
|
|
116
|
+
|
|
117
|
+
print(Fore.GREEN + Back.BLACK + Style.BRIGHT + "Book Marked As Read!" + Style.RESET_ALL)
|
|
118
|
+
|
|
119
|
+
except ValueError:
|
|
120
|
+
print(Fore.RED + Style.BRIGHT + "Please Enter A Valid Number." + Style.RESET_ALL)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def reset_library():
|
|
124
|
+
global books
|
|
125
|
+
|
|
126
|
+
confirm = input(Fore.RED + Style.BRIGHT + "Are You Sure You Want To Delete All Books? (yes/no): " + Style.RESET_ALL
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
if confirm.lower() == "yes":
|
|
130
|
+
books = []
|
|
131
|
+
save_books()
|
|
132
|
+
|
|
133
|
+
print(Fore.GREEN + Back.BLACK + "Library Reset Successfully!" + Style.RESET_ALL)
|
|
134
|
+
|
|
135
|
+
else:
|
|
136
|
+
print(Fore.RED + "Reset Cancelled." + Style.RESET_ALL)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def main():
|
|
140
|
+
global books
|
|
141
|
+
|
|
142
|
+
books = load_books()
|
|
143
|
+
|
|
144
|
+
while True:
|
|
145
|
+
|
|
146
|
+
print("\n" + Fore.BLACK + Back.WHITE + "--- Library Manager ---" + Style.RESET_ALL)
|
|
147
|
+
|
|
148
|
+
print(Fore.YELLOW + "(1) Add New Book" + Style.RESET_ALL)
|
|
149
|
+
print(Fore.YELLOW + "(2) View All Books" + Style.RESET_ALL)
|
|
150
|
+
print(Fore.YELLOW + "(3) View Unread Books" + Style.RESET_ALL)
|
|
151
|
+
print(Fore.YELLOW + "(4) Mark Book As Read" + Style.RESET_ALL)
|
|
152
|
+
print(Fore.YELLOW + "(5) Quit Library Manager" + Style.RESET_ALL)
|
|
153
|
+
print(Fore.YELLOW + "(6) Reset Library" + Style.RESET_ALL)
|
|
154
|
+
|
|
155
|
+
choice = input("\n" + Fore.CYAN + Style.BRIGHT + "Enter Your Choice: " + Style.RESET_ALL)
|
|
156
|
+
|
|
157
|
+
if choice == "1":
|
|
158
|
+
add_book()
|
|
159
|
+
save_books()
|
|
160
|
+
|
|
161
|
+
elif choice == "2":
|
|
162
|
+
view_books()
|
|
163
|
+
|
|
164
|
+
elif choice == "3":
|
|
165
|
+
view_unread_books()
|
|
166
|
+
|
|
167
|
+
elif choice == "4":
|
|
168
|
+
mark_book_as_read()
|
|
169
|
+
|
|
170
|
+
elif choice == "5":
|
|
171
|
+
print(Fore.WHITE + Style.BRIGHT + "Bye! Thanks For Using The Library Manager!" + Style.RESET_ALL)
|
|
172
|
+
break
|
|
173
|
+
|
|
174
|
+
elif choice == "6":
|
|
175
|
+
reset_library()
|
|
176
|
+
|
|
177
|
+
else:
|
|
178
|
+
print(Fore.RED + Style.BRIGHT + "Invalid Choice, Try Again!" + Style.RESET_ALL)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
if __name__ == "__main__":
|
|
182
|
+
main()
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "laypatel13-library-manager"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A colorful CLI library manager for tracking books and reading progress"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
|
|
13
|
+
authors = [
|
|
14
|
+
{name = "Lay Patel", email = "lay.patel.1313@gmail.com"}
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
keywords = [
|
|
18
|
+
"cli",
|
|
19
|
+
"library",
|
|
20
|
+
"books",
|
|
21
|
+
"reading",
|
|
22
|
+
"manager"
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
classifiers = [
|
|
26
|
+
"Programming Language :: Python :: 3",
|
|
27
|
+
"License :: OSI Approved :: MIT License",
|
|
28
|
+
"Operating System :: OS Independent",
|
|
29
|
+
"Environment :: Console",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
dependencies = [
|
|
33
|
+
"colorama==0.4.6",
|
|
34
|
+
"tabulate>=0.9.0",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.scripts]
|
|
38
|
+
library-manager = "library_manager.main:main"
|
|
39
|
+
|
|
40
|
+
[project.urls]
|
|
41
|
+
Homepage = "https://github.com/laypatel13/library-manager"
|