nicepython 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.
- nicepython-0.1.0/PKG-INFO +320 -0
- nicepython-0.1.0/README.md +299 -0
- nicepython-0.1.0/license +9 -0
- nicepython-0.1.0/nicepy/__init__.py +4 -0
- nicepython-0.1.0/nicepy/logger.py +51 -0
- nicepython-0.1.0/nicepy/nicepath/__init__.py +1 -0
- nicepython-0.1.0/nicepy/nicepath/core.py +702 -0
- nicepython-0.1.0/nicepy/nicepath/exceptios.py +28 -0
- nicepython-0.1.0/nicepython.egg-info/PKG-INFO +320 -0
- nicepython-0.1.0/nicepython.egg-info/SOURCES.txt +13 -0
- nicepython-0.1.0/nicepython.egg-info/dependency_links.txt +1 -0
- nicepython-0.1.0/nicepython.egg-info/top_level.txt +1 -0
- nicepython-0.1.0/pyproject.toml +43 -0
- nicepython-0.1.0/setup.cfg +4 -0
- nicepython-0.1.0/tests/test_nicepath.py +201 -0
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nicepython
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Advanced OOP file and directory management library with powerful search, logging and chainable file operations.
|
|
5
|
+
Author-email: amin13m <aminm13aminm@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/amin13m/nicepy
|
|
8
|
+
Project-URL: Repository, https://github.com/amin13m/nicepy
|
|
9
|
+
Project-URL: Issues, https://github.com/amin13m/nicepy/issues
|
|
10
|
+
Keywords: pathlib,filesystem,path,file,search,logging,oop
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Requires-Python: >=3.9
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: license
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
Tired of writing hundreds of lines with pathlib's verbose syntax? ๐คฏ
|
|
23
|
+
|
|
24
|
+
Meet NicePath.
|
|
25
|
+
|
|
26
|
+
A clean OOP path object with dozens of short, chainable methods and properties.
|
|
27
|
+
|
|
28
|
+
No try/except boilerplate.
|
|
29
|
+
Just .read(), .write(), .move_to() โฆ and it works.
|
|
30
|
+
|
|
31
|
+
โจ Smart search
|
|
32
|
+
๐ณ Tree visualization
|
|
33
|
+
๐ Automatic logging of hundreds of files with a single method
|
|
34
|
+
|
|
35
|
+
Less code. More clarity.
|
|
36
|
+
|
|
37
|
+
------------------------------------------------------------
|
|
38
|
+
|
|
39
|
+
๐ NicePy
|
|
40
|
+
|
|
41
|
+
Advanced OOP File & Directory Management Library for Python
|
|
42
|
+
Built on top of pathlib with logging, search engine, tree view and smart utilities.
|
|
43
|
+
|
|
44
|
+
------------------------------------------------------------
|
|
45
|
+
|
|
46
|
+
โจ Why NicePy?
|
|
47
|
+
|
|
48
|
+
NicePath is a powerful wrapper around Pythonโs built-in pathlib, designed to make file management:
|
|
49
|
+
|
|
50
|
+
โ Cleaner
|
|
51
|
+
โ More readable
|
|
52
|
+
โ More powerful
|
|
53
|
+
โ Fully logged
|
|
54
|
+
โ Searchable
|
|
55
|
+
โ Tree-view ready
|
|
56
|
+
|
|
57
|
+
------------------------------------------------------------
|
|
58
|
+
|
|
59
|
+
๐ฆ Installation
|
|
60
|
+
|
|
61
|
+
๐น Local Development Mode
|
|
62
|
+
|
|
63
|
+
pip install -e .
|
|
64
|
+
|
|
65
|
+
๐น Future PyPI Installation
|
|
66
|
+
|
|
67
|
+
pip install nicepython
|
|
68
|
+
|
|
69
|
+
------------------------------------------------------------
|
|
70
|
+
|
|
71
|
+
๐ Quick Start
|
|
72
|
+
|
|
73
|
+
from nicepy import NicePath
|
|
74
|
+
|
|
75
|
+
# Create path
|
|
76
|
+
p = NicePath("example.txt")
|
|
77
|
+
|
|
78
|
+
# Write data
|
|
79
|
+
p.write("Hello NicePy!")
|
|
80
|
+
|
|
81
|
+
# Read data
|
|
82
|
+
print(p.read())
|
|
83
|
+
|
|
84
|
+
# Append
|
|
85
|
+
p.append("\nNew Line")
|
|
86
|
+
|
|
87
|
+
# Show tree
|
|
88
|
+
root = NicePath(".")
|
|
89
|
+
print(root.tree())
|
|
90
|
+
|
|
91
|
+
# Search files
|
|
92
|
+
for f in root.search(suffix=".py"):
|
|
93
|
+
print(f.path)
|
|
94
|
+
|
|
95
|
+
------------------------------------------------------------
|
|
96
|
+
|
|
97
|
+
๐ณ Tree Visualization
|
|
98
|
+
|
|
99
|
+
root = NicePath("my_project")
|
|
100
|
+
print(root.tree(ignore_hidden=False))
|
|
101
|
+
|
|
102
|
+
Example Output:
|
|
103
|
+
|
|
104
|
+
my_project
|
|
105
|
+
โโโ main.py
|
|
106
|
+
โโโ nicepy
|
|
107
|
+
โ โโโ core.py
|
|
108
|
+
โโโ README.md
|
|
109
|
+
|
|
110
|
+
------------------------------------------------------------
|
|
111
|
+
|
|
112
|
+
๐ Advanced Search
|
|
113
|
+
|
|
114
|
+
root.search(
|
|
115
|
+
name_contains="core",
|
|
116
|
+
suffix=".py",
|
|
117
|
+
recursive=True,
|
|
118
|
+
ignore_hidden=True
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
Supported Filters:
|
|
122
|
+
|
|
123
|
+
- name_contains
|
|
124
|
+
- suffix
|
|
125
|
+
- stem
|
|
126
|
+
- regex
|
|
127
|
+
- only_files
|
|
128
|
+
- only_dirs
|
|
129
|
+
- recursive
|
|
130
|
+
- ignore_hidden
|
|
131
|
+
|
|
132
|
+
If nothing is found โ returns [] (never raises error)
|
|
133
|
+
|
|
134
|
+
------------------------------------------------------------
|
|
135
|
+
|
|
136
|
+
๐งพ logAll โ Full Project Logger
|
|
137
|
+
|
|
138
|
+
Generate:
|
|
139
|
+
- Full tree structure
|
|
140
|
+
- Content of matched files
|
|
141
|
+
- Save everything into a file
|
|
142
|
+
|
|
143
|
+
project = NicePath("my_project")
|
|
144
|
+
output = NicePath("log.txt")
|
|
145
|
+
|
|
146
|
+
project.logAll(
|
|
147
|
+
file_output=output,
|
|
148
|
+
search_suffix=".py"
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
Useful for:
|
|
152
|
+
- Project snapshot
|
|
153
|
+
- Debug logging
|
|
154
|
+
- Code export
|
|
155
|
+
- Archiving structure
|
|
156
|
+
|
|
157
|
+
------------------------------------------------------------
|
|
158
|
+
|
|
159
|
+
๐ Available Methods
|
|
160
|
+
|
|
161
|
+
write(data) โ Write text to file
|
|
162
|
+
read() โ Read file content
|
|
163
|
+
append(data) โ Append to file
|
|
164
|
+
delete() โ Remove file or directory
|
|
165
|
+
copy_to(dest) โ Copy file/folder
|
|
166
|
+
move_to(dest) โ Move file/folder
|
|
167
|
+
search(...) โ Smart search engine
|
|
168
|
+
tree(...) โ Visual tree display
|
|
169
|
+
logAll(...) โ Full structured log export
|
|
170
|
+
|
|
171
|
+
Properties:
|
|
172
|
+
exists
|
|
173
|
+
is_file
|
|
174
|
+
is_dir
|
|
175
|
+
size
|
|
176
|
+
created_time
|
|
177
|
+
modified_time
|
|
178
|
+
|
|
179
|
+
------------------------------------------------------------
|
|
180
|
+
|
|
181
|
+
โ NicePy vs pathlib
|
|
182
|
+
|
|
183
|
+
Feature | pathlib | NicePy
|
|
184
|
+
------------------------------------------------------------
|
|
185
|
+
Basic read/write | Yes | Yes
|
|
186
|
+
Append built-in | No | Yes
|
|
187
|
+
Tree view | No | Yes
|
|
188
|
+
Search engine | No | Yes
|
|
189
|
+
Regex search | No | Yes
|
|
190
|
+
Logging system | No | Yes
|
|
191
|
+
Full project log export | No | Yes
|
|
192
|
+
Unified OOP interface | Basic | Advanced
|
|
193
|
+
Custom exceptions | No | Yes
|
|
194
|
+
|
|
195
|
+
------------------------------------------------------------
|
|
196
|
+
|
|
197
|
+
## โ ๏ธ Safety Limits in NicePath
|
|
198
|
+
|
|
199
|
+
NicePath library includes powerful methods like logAll, tree, and search that can traverse large directories or read/write many files.
|
|
200
|
+
|
|
201
|
+
To prevent accidental overloads, these methods have default safety limits:
|
|
202
|
+
|
|
203
|
+
- logAll: limits the maximum number of files and total size it processes.
|
|
204
|
+
- Default max_files=500
|
|
205
|
+
- Default max_total_size=10_000_000 bytes (10 MB)
|
|
206
|
+
- tree and search:
|
|
207
|
+
- Can ignore virtual environments and library folders (ignore_venv=True by default)
|
|
208
|
+
- Can limit recursion depth or number of entries if needed.
|
|
209
|
+
|
|
210
|
+
Behavior when limits are reached:
|
|
211
|
+
|
|
212
|
+
- The operation does not crash.
|
|
213
|
+
- Partial results are written to the output file.
|
|
214
|
+
- A warning message is logged with logger.warning stating that safety limits were reached.
|
|
215
|
+
|
|
216
|
+
Customizing Safety:
|
|
217
|
+
|
|
218
|
+
You can override safety defaults in method calls:
|
|
219
|
+
|
|
220
|
+
`python
|
|
221
|
+
dir = NicePath("D:/Projects")
|
|
222
|
+
output_file = dir / "log.txt"
|
|
223
|
+
|
|
224
|
+
dir.logAll(
|
|
225
|
+
file_output=output_file,
|
|
226
|
+
search_suffix=".py",
|
|
227
|
+
max_files=1000, # increase limit
|
|
228
|
+
max_total_size=50_000_000, # 50 MB
|
|
229
|
+
ignore_venv=False # include virtual environments
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
๐ Logging System
|
|
233
|
+
|
|
234
|
+
All critical operations are logged:
|
|
235
|
+
|
|
236
|
+
- Start
|
|
237
|
+
- Success
|
|
238
|
+
- Failure
|
|
239
|
+
- Error reason
|
|
240
|
+
|
|
241
|
+
Helps debugging and production stability.
|
|
242
|
+
|
|
243
|
+
------------------------------------------------------------
|
|
244
|
+
|
|
245
|
+
๐งช Testing
|
|
246
|
+
|
|
247
|
+
pytest -v
|
|
248
|
+
|
|
249
|
+
------------------------------------------------------------
|
|
250
|
+
|
|
251
|
+
๐ Project Structure
|
|
252
|
+
|
|
253
|
+
nicepy_python
|
|
254
|
+
โโโ pycache
|
|
255
|
+
โ โโโ init.pythonc
|
|
256
|
+
โ โโโ main.cpython-314.pyc
|
|
257
|
+
โโโ nicepy
|
|
258
|
+
โ โโโ pycache
|
|
259
|
+
โ โ โโโ init.pyc
|
|
260
|
+
โ โ โโโ logger.cpython-314.pyc
|
|
261
|
+
โ โโโ nicepath
|
|
262
|
+
โ โ โโโ pycache
|
|
263
|
+
โ โ โ โโโ init.pyc
|
|
264
|
+
โ โ โ โโโ core.cpython-314.pyc
|
|
265
|
+
โ โ โ โโโ exceptios.cpython-314.pyc
|
|
266
|
+
โ โ โโโ init.py
|
|
267
|
+
โ โ โโโ core.py
|
|
268
|
+
โ โ โโโ exceptios.py
|
|
269
|
+
โ โโโ init.py
|
|
270
|
+
โ โโโ logger.py
|
|
271
|
+
โโโ nicepy.egg-info
|
|
272
|
+
โ โโโ dependency_links.txt
|
|
273
|
+
โ โโโ PKG-INFO
|
|
274
|
+
โ โโโ SOURCES.txt
|
|
275
|
+
โ โโโ top_level.txt
|
|
276
|
+
โโโ tests
|
|
277
|
+
โ โโโ pycache
|
|
278
|
+
โ โ โโโ test_nicepath.cpython-314-pytest-9.0.2.pyc
|
|
279
|
+
โ โ โโโ test_nicepath.cpython-314.pyc
|
|
280
|
+
โ โโโ newfolder
|
|
281
|
+
โ โ โโโ ksc.txt
|
|
282
|
+
โ โ โโโ tet.txt
|
|
283
|
+
โ โ โโโ text.txt
|
|
284
|
+
โ โโโ test_nicepath.py
|
|
285
|
+
โโโ init.py
|
|
286
|
+
โโโ main.py
|
|
287
|
+
โโโ pyproject.toml
|
|
288
|
+
โโโ README.md
|
|
289
|
+
|
|
290
|
+
------------------------------------------------------------
|
|
291
|
+
|
|
292
|
+
๐ฎ Roadmap
|
|
293
|
+
|
|
294
|
+
[ ] PyPI release
|
|
295
|
+
[ ] Async support
|
|
296
|
+
[ ] Caching search engine
|
|
297
|
+
[ ] Watchdog integration
|
|
298
|
+
[ ] Colored tree output
|
|
299
|
+
[ ] CLI interface
|
|
300
|
+
|
|
301
|
+
------------------------------------------------------------
|
|
302
|
+
|
|
303
|
+
๐ค Author
|
|
304
|
+
|
|
305
|
+
Amin
|
|
306
|
+
GitHub: https://github.com/amin13m
|
|
307
|
+
|
|
308
|
+
------------------------------------------------------------
|
|
309
|
+
|
|
310
|
+
๐ License
|
|
311
|
+
|
|
312
|
+
MIT License
|
|
313
|
+
|
|
314
|
+
------------------------------------------------------------
|
|
315
|
+
|
|
316
|
+
๐ Philosophy
|
|
317
|
+
|
|
318
|
+
Clean code.
|
|
319
|
+
Predictable behavior.
|
|
320
|
+
Zero surprise file handling.
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
Tired of writing hundreds of lines with pathlib's verbose syntax? ๐คฏ
|
|
2
|
+
|
|
3
|
+
Meet NicePath.
|
|
4
|
+
|
|
5
|
+
A clean OOP path object with dozens of short, chainable methods and properties.
|
|
6
|
+
|
|
7
|
+
No try/except boilerplate.
|
|
8
|
+
Just .read(), .write(), .move_to() โฆ and it works.
|
|
9
|
+
|
|
10
|
+
โจ Smart search
|
|
11
|
+
๐ณ Tree visualization
|
|
12
|
+
๐ Automatic logging of hundreds of files with a single method
|
|
13
|
+
|
|
14
|
+
Less code. More clarity.
|
|
15
|
+
|
|
16
|
+
------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
๐ NicePy
|
|
19
|
+
|
|
20
|
+
Advanced OOP File & Directory Management Library for Python
|
|
21
|
+
Built on top of pathlib with logging, search engine, tree view and smart utilities.
|
|
22
|
+
|
|
23
|
+
------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
โจ Why NicePy?
|
|
26
|
+
|
|
27
|
+
NicePath is a powerful wrapper around Pythonโs built-in pathlib, designed to make file management:
|
|
28
|
+
|
|
29
|
+
โ Cleaner
|
|
30
|
+
โ More readable
|
|
31
|
+
โ More powerful
|
|
32
|
+
โ Fully logged
|
|
33
|
+
โ Searchable
|
|
34
|
+
โ Tree-view ready
|
|
35
|
+
|
|
36
|
+
------------------------------------------------------------
|
|
37
|
+
|
|
38
|
+
๐ฆ Installation
|
|
39
|
+
|
|
40
|
+
๐น Local Development Mode
|
|
41
|
+
|
|
42
|
+
pip install -e .
|
|
43
|
+
|
|
44
|
+
๐น Future PyPI Installation
|
|
45
|
+
|
|
46
|
+
pip install nicepython
|
|
47
|
+
|
|
48
|
+
------------------------------------------------------------
|
|
49
|
+
|
|
50
|
+
๐ Quick Start
|
|
51
|
+
|
|
52
|
+
from nicepy import NicePath
|
|
53
|
+
|
|
54
|
+
# Create path
|
|
55
|
+
p = NicePath("example.txt")
|
|
56
|
+
|
|
57
|
+
# Write data
|
|
58
|
+
p.write("Hello NicePy!")
|
|
59
|
+
|
|
60
|
+
# Read data
|
|
61
|
+
print(p.read())
|
|
62
|
+
|
|
63
|
+
# Append
|
|
64
|
+
p.append("\nNew Line")
|
|
65
|
+
|
|
66
|
+
# Show tree
|
|
67
|
+
root = NicePath(".")
|
|
68
|
+
print(root.tree())
|
|
69
|
+
|
|
70
|
+
# Search files
|
|
71
|
+
for f in root.search(suffix=".py"):
|
|
72
|
+
print(f.path)
|
|
73
|
+
|
|
74
|
+
------------------------------------------------------------
|
|
75
|
+
|
|
76
|
+
๐ณ Tree Visualization
|
|
77
|
+
|
|
78
|
+
root = NicePath("my_project")
|
|
79
|
+
print(root.tree(ignore_hidden=False))
|
|
80
|
+
|
|
81
|
+
Example Output:
|
|
82
|
+
|
|
83
|
+
my_project
|
|
84
|
+
โโโ main.py
|
|
85
|
+
โโโ nicepy
|
|
86
|
+
โ โโโ core.py
|
|
87
|
+
โโโ README.md
|
|
88
|
+
|
|
89
|
+
------------------------------------------------------------
|
|
90
|
+
|
|
91
|
+
๐ Advanced Search
|
|
92
|
+
|
|
93
|
+
root.search(
|
|
94
|
+
name_contains="core",
|
|
95
|
+
suffix=".py",
|
|
96
|
+
recursive=True,
|
|
97
|
+
ignore_hidden=True
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
Supported Filters:
|
|
101
|
+
|
|
102
|
+
- name_contains
|
|
103
|
+
- suffix
|
|
104
|
+
- stem
|
|
105
|
+
- regex
|
|
106
|
+
- only_files
|
|
107
|
+
- only_dirs
|
|
108
|
+
- recursive
|
|
109
|
+
- ignore_hidden
|
|
110
|
+
|
|
111
|
+
If nothing is found โ returns [] (never raises error)
|
|
112
|
+
|
|
113
|
+
------------------------------------------------------------
|
|
114
|
+
|
|
115
|
+
๐งพ logAll โ Full Project Logger
|
|
116
|
+
|
|
117
|
+
Generate:
|
|
118
|
+
- Full tree structure
|
|
119
|
+
- Content of matched files
|
|
120
|
+
- Save everything into a file
|
|
121
|
+
|
|
122
|
+
project = NicePath("my_project")
|
|
123
|
+
output = NicePath("log.txt")
|
|
124
|
+
|
|
125
|
+
project.logAll(
|
|
126
|
+
file_output=output,
|
|
127
|
+
search_suffix=".py"
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
Useful for:
|
|
131
|
+
- Project snapshot
|
|
132
|
+
- Debug logging
|
|
133
|
+
- Code export
|
|
134
|
+
- Archiving structure
|
|
135
|
+
|
|
136
|
+
------------------------------------------------------------
|
|
137
|
+
|
|
138
|
+
๐ Available Methods
|
|
139
|
+
|
|
140
|
+
write(data) โ Write text to file
|
|
141
|
+
read() โ Read file content
|
|
142
|
+
append(data) โ Append to file
|
|
143
|
+
delete() โ Remove file or directory
|
|
144
|
+
copy_to(dest) โ Copy file/folder
|
|
145
|
+
move_to(dest) โ Move file/folder
|
|
146
|
+
search(...) โ Smart search engine
|
|
147
|
+
tree(...) โ Visual tree display
|
|
148
|
+
logAll(...) โ Full structured log export
|
|
149
|
+
|
|
150
|
+
Properties:
|
|
151
|
+
exists
|
|
152
|
+
is_file
|
|
153
|
+
is_dir
|
|
154
|
+
size
|
|
155
|
+
created_time
|
|
156
|
+
modified_time
|
|
157
|
+
|
|
158
|
+
------------------------------------------------------------
|
|
159
|
+
|
|
160
|
+
โ NicePy vs pathlib
|
|
161
|
+
|
|
162
|
+
Feature | pathlib | NicePy
|
|
163
|
+
------------------------------------------------------------
|
|
164
|
+
Basic read/write | Yes | Yes
|
|
165
|
+
Append built-in | No | Yes
|
|
166
|
+
Tree view | No | Yes
|
|
167
|
+
Search engine | No | Yes
|
|
168
|
+
Regex search | No | Yes
|
|
169
|
+
Logging system | No | Yes
|
|
170
|
+
Full project log export | No | Yes
|
|
171
|
+
Unified OOP interface | Basic | Advanced
|
|
172
|
+
Custom exceptions | No | Yes
|
|
173
|
+
|
|
174
|
+
------------------------------------------------------------
|
|
175
|
+
|
|
176
|
+
## โ ๏ธ Safety Limits in NicePath
|
|
177
|
+
|
|
178
|
+
NicePath library includes powerful methods like logAll, tree, and search that can traverse large directories or read/write many files.
|
|
179
|
+
|
|
180
|
+
To prevent accidental overloads, these methods have default safety limits:
|
|
181
|
+
|
|
182
|
+
- logAll: limits the maximum number of files and total size it processes.
|
|
183
|
+
- Default max_files=500
|
|
184
|
+
- Default max_total_size=10_000_000 bytes (10 MB)
|
|
185
|
+
- tree and search:
|
|
186
|
+
- Can ignore virtual environments and library folders (ignore_venv=True by default)
|
|
187
|
+
- Can limit recursion depth or number of entries if needed.
|
|
188
|
+
|
|
189
|
+
Behavior when limits are reached:
|
|
190
|
+
|
|
191
|
+
- The operation does not crash.
|
|
192
|
+
- Partial results are written to the output file.
|
|
193
|
+
- A warning message is logged with logger.warning stating that safety limits were reached.
|
|
194
|
+
|
|
195
|
+
Customizing Safety:
|
|
196
|
+
|
|
197
|
+
You can override safety defaults in method calls:
|
|
198
|
+
|
|
199
|
+
`python
|
|
200
|
+
dir = NicePath("D:/Projects")
|
|
201
|
+
output_file = dir / "log.txt"
|
|
202
|
+
|
|
203
|
+
dir.logAll(
|
|
204
|
+
file_output=output_file,
|
|
205
|
+
search_suffix=".py",
|
|
206
|
+
max_files=1000, # increase limit
|
|
207
|
+
max_total_size=50_000_000, # 50 MB
|
|
208
|
+
ignore_venv=False # include virtual environments
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
๐ Logging System
|
|
212
|
+
|
|
213
|
+
All critical operations are logged:
|
|
214
|
+
|
|
215
|
+
- Start
|
|
216
|
+
- Success
|
|
217
|
+
- Failure
|
|
218
|
+
- Error reason
|
|
219
|
+
|
|
220
|
+
Helps debugging and production stability.
|
|
221
|
+
|
|
222
|
+
------------------------------------------------------------
|
|
223
|
+
|
|
224
|
+
๐งช Testing
|
|
225
|
+
|
|
226
|
+
pytest -v
|
|
227
|
+
|
|
228
|
+
------------------------------------------------------------
|
|
229
|
+
|
|
230
|
+
๐ Project Structure
|
|
231
|
+
|
|
232
|
+
nicepy_python
|
|
233
|
+
โโโ pycache
|
|
234
|
+
โ โโโ init.pythonc
|
|
235
|
+
โ โโโ main.cpython-314.pyc
|
|
236
|
+
โโโ nicepy
|
|
237
|
+
โ โโโ pycache
|
|
238
|
+
โ โ โโโ init.pyc
|
|
239
|
+
โ โ โโโ logger.cpython-314.pyc
|
|
240
|
+
โ โโโ nicepath
|
|
241
|
+
โ โ โโโ pycache
|
|
242
|
+
โ โ โ โโโ init.pyc
|
|
243
|
+
โ โ โ โโโ core.cpython-314.pyc
|
|
244
|
+
โ โ โ โโโ exceptios.cpython-314.pyc
|
|
245
|
+
โ โ โโโ init.py
|
|
246
|
+
โ โ โโโ core.py
|
|
247
|
+
โ โ โโโ exceptios.py
|
|
248
|
+
โ โโโ init.py
|
|
249
|
+
โ โโโ logger.py
|
|
250
|
+
โโโ nicepy.egg-info
|
|
251
|
+
โ โโโ dependency_links.txt
|
|
252
|
+
โ โโโ PKG-INFO
|
|
253
|
+
โ โโโ SOURCES.txt
|
|
254
|
+
โ โโโ top_level.txt
|
|
255
|
+
โโโ tests
|
|
256
|
+
โ โโโ pycache
|
|
257
|
+
โ โ โโโ test_nicepath.cpython-314-pytest-9.0.2.pyc
|
|
258
|
+
โ โ โโโ test_nicepath.cpython-314.pyc
|
|
259
|
+
โ โโโ newfolder
|
|
260
|
+
โ โ โโโ ksc.txt
|
|
261
|
+
โ โ โโโ tet.txt
|
|
262
|
+
โ โ โโโ text.txt
|
|
263
|
+
โ โโโ test_nicepath.py
|
|
264
|
+
โโโ init.py
|
|
265
|
+
โโโ main.py
|
|
266
|
+
โโโ pyproject.toml
|
|
267
|
+
โโโ README.md
|
|
268
|
+
|
|
269
|
+
------------------------------------------------------------
|
|
270
|
+
|
|
271
|
+
๐ฎ Roadmap
|
|
272
|
+
|
|
273
|
+
[ ] PyPI release
|
|
274
|
+
[ ] Async support
|
|
275
|
+
[ ] Caching search engine
|
|
276
|
+
[ ] Watchdog integration
|
|
277
|
+
[ ] Colored tree output
|
|
278
|
+
[ ] CLI interface
|
|
279
|
+
|
|
280
|
+
------------------------------------------------------------
|
|
281
|
+
|
|
282
|
+
๐ค Author
|
|
283
|
+
|
|
284
|
+
Amin
|
|
285
|
+
GitHub: https://github.com/amin13m
|
|
286
|
+
|
|
287
|
+
------------------------------------------------------------
|
|
288
|
+
|
|
289
|
+
๐ License
|
|
290
|
+
|
|
291
|
+
MIT License
|
|
292
|
+
|
|
293
|
+
------------------------------------------------------------
|
|
294
|
+
|
|
295
|
+
๐ Philosophy
|
|
296
|
+
|
|
297
|
+
Clean code.
|
|
298
|
+
Predictable behavior.
|
|
299
|
+
Zero surprise file handling.
|
nicepython-0.1.0/license
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 amin13m
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from functools import wraps
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
logger = logging.getLogger("nicepy")
|
|
6
|
+
|
|
7
|
+
if not logger.handlers:
|
|
8
|
+
handler = logging.StreamHandler()
|
|
9
|
+
formatter = logging.Formatter(
|
|
10
|
+
"(%(filename)s-%(lineno)d)[%(levelname)s] %(name)s | %(message)s"
|
|
11
|
+
)
|
|
12
|
+
handler.setFormatter(formatter)
|
|
13
|
+
logger.addHandler(handler)
|
|
14
|
+
|
|
15
|
+
logger.setLevel(30)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
from functools import wraps
|
|
20
|
+
from nicepy.logger import logger
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def log_operation(func):
|
|
24
|
+
@wraps(func)
|
|
25
|
+
def wrapper(self ):
|
|
26
|
+
logger.debug(f"{func.__name__} started -> {self._path}")
|
|
27
|
+
try:
|
|
28
|
+
result = func(self)
|
|
29
|
+
logger.info(f"{func.__name__} success -> {self._path}")
|
|
30
|
+
return result
|
|
31
|
+
except Exception as e:
|
|
32
|
+
logger.exception(
|
|
33
|
+
f"{func.__name__} failed -> {self._path} | Reason: {e}"
|
|
34
|
+
)
|
|
35
|
+
raise
|
|
36
|
+
return wrapper
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
from nicepy.logger import logger
|
|
40
|
+
|
|
41
|
+
def log_start(instance, func_name):
|
|
42
|
+
path_info = getattr(instance, "_path", "unknown")
|
|
43
|
+
logger.debug(f"{func_name} started -> {path_info}")
|
|
44
|
+
|
|
45
|
+
def log_end(instance, func_name):
|
|
46
|
+
path_info = getattr(instance, "_path", "unknown")
|
|
47
|
+
logger.info(f"{func_name} finished -> {path_info}")
|
|
48
|
+
|
|
49
|
+
def log_error(instance, func_name, e):
|
|
50
|
+
path_info = getattr(instance, "_path", "unknown")
|
|
51
|
+
logger.exception(f"{func_name} failed -> {path_info} | Reason: {e}")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .core import NicePath
|