Skip to main content

Advanced OOP file and directory management library with powerful search, logging and chainable file operations.

Project description

Tired of writing hundreds of lines with pathlib's verbose syntax? ๐Ÿคฏ

Meet NicePath.

A clean OOP path object with dozens of short, chainable methods and properties.

No try/except boilerplate. Just .read(), .write(), .move_to() โ€ฆ and it works.

โœจ Smart search ๐ŸŒณ Tree visualization ๐Ÿ“ Automatic logging of hundreds of files with a single method

Less code. More clarity.


๐Ÿš€ NicePy

Advanced OOP File & Directory Management Library for Python Built on top of pathlib with logging, search engine, tree view and smart utilities.


โœจ Why NicePy?

NicePath is a powerful wrapper around Pythonโ€™s built-in pathlib, designed to make file management:

โœ” Cleaner โœ” More readable โœ” More powerful โœ” Fully logged โœ” Searchable โœ” Tree-view ready


๐Ÿ“ฆ Installation

๐Ÿ”น Local Development Mode

pip install -e .

๐Ÿ”น Future PyPI Installation

pip install nicepython


๐Ÿš€ Quick Start

from nicepy import NicePath

Create path

p = NicePath("example.txt")

Write data

p.write("Hello NicePy!")

Read data

print(p.read())

Append

p.append("\nNew Line")

Show tree

root = NicePath(".") print(root.tree())

Search files

for f in root.search(suffix=".py"): print(f.path)


๐ŸŒณ Tree Visualization

root = NicePath("my_project") print(root.tree(ignore_hidden=False))

Example Output:

my_project โ”œโ”€โ”€ main.py โ”œโ”€โ”€ nicepy โ”‚ โ”œโ”€โ”€ core.py โ””โ”€โ”€ README.md


๐Ÿ”Ž Advanced Search

root.search( name_contains="core", suffix=".py", recursive=True, ignore_hidden=True )

Supported Filters:

  • name_contains
  • suffix
  • stem
  • regex
  • only_files
  • only_dirs
  • recursive
  • ignore_hidden

If nothing is found โ†’ returns [] (never raises error)


๐Ÿงพ logAll โ€“ Full Project Logger

Generate:

  • Full tree structure
  • Content of matched files
  • Save everything into a file

project = NicePath("my_project") output = NicePath("log.txt")

project.logAll( file_output=output, search_suffix=".py" )

Useful for:

  • Project snapshot
  • Debug logging
  • Code export
  • Archiving structure

๐Ÿ“š Available Methods

write(data) โ†’ Write text to file read() โ†’ Read file content append(data) โ†’ Append to file delete() โ†’ Remove file or directory copy_to(dest) โ†’ Copy file/folder move_to(dest) โ†’ Move file/folder search(...) โ†’ Smart search engine tree(...) โ†’ Visual tree display logAll(...) โ†’ Full structured log export

Properties: exists is_file is_dir size created_time modified_time


โš– NicePy vs pathlib

Feature | pathlib | NicePy

Basic read/write | Yes | Yes Append built-in | No | Yes Tree view | No | Yes Search engine | No | Yes Regex search | No | Yes Logging system | No | Yes Full project log export | No | Yes Unified OOP interface | Basic | Advanced Custom exceptions | No | Yes


โš ๏ธ Safety Limits in NicePath

NicePath library includes powerful methods like logAll, tree, and search that can traverse large directories or read/write many files.

To prevent accidental overloads, these methods have default safety limits:

  • logAll: limits the maximum number of files and total size it processes.
    • Default max_files=500
    • Default max_total_size=10_000_000 bytes (10 MB)
  • tree and search:
    • Can ignore virtual environments and library folders (ignore_venv=True by default)
    • Can limit recursion depth or number of entries if needed.

Behavior when limits are reached:

  • The operation does not crash.
  • Partial results are written to the output file.
  • A warning message is logged with logger.warning stating that safety limits were reached.

Customizing Safety:

You can override safety defaults in method calls:

`python dir = NicePath("D:/Projects") output_file = dir / "log.txt"

dir.logAll( file_output=output_file, search_suffix=".py", max_files=1000, # increase limit max_total_size=50_000_000, # 50 MB ignore_venv=False # include virtual environments )

๐Ÿ›  Logging System

All critical operations are logged:

  • Start
  • Success
  • Failure
  • Error reason

Helps debugging and production stability.


๐Ÿงช Testing

pytest -v


๐Ÿ— Project Structure

nicepy_python โ”œโ”€โ”€ pycache โ”‚ โ”œโ”€โ”€ init.pythonc โ”‚ โ””โ”€โ”€ main.cpython-314.pyc โ”œโ”€โ”€ nicepy โ”‚ โ”œโ”€โ”€ pycache โ”‚ โ”‚ โ”œโ”€โ”€ init.pyc โ”‚ โ”‚ โ””โ”€โ”€ logger.cpython-314.pyc โ”‚ โ”œโ”€โ”€ nicepath โ”‚ โ”‚ โ”œโ”€โ”€ pycache โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ init.pyc โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ core.cpython-314.pyc โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ exceptios.cpython-314.pyc โ”‚ โ”‚ โ”œโ”€โ”€ init.py โ”‚ โ”‚ โ”œโ”€โ”€ core.py โ”‚ โ”‚ โ””โ”€โ”€ exceptios.py โ”‚ โ”œโ”€โ”€ init.py โ”‚ โ””โ”€โ”€ logger.py โ”œโ”€โ”€ nicepy.egg-info โ”‚ โ”œโ”€โ”€ dependency_links.txt โ”‚ โ”œโ”€โ”€ PKG-INFO โ”‚ โ”œโ”€โ”€ SOURCES.txt โ”‚ โ””โ”€โ”€ top_level.txt โ”œโ”€โ”€ tests โ”‚ โ”œโ”€โ”€ pycache โ”‚ โ”‚ โ”œโ”€โ”€ test_nicepath.cpython-314-pytest-9.0.2.pyc โ”‚ โ”‚ โ””โ”€โ”€ test_nicepath.cpython-314.pyc โ”‚ โ”œโ”€โ”€ newfolder โ”‚ โ”‚ โ”œโ”€โ”€ ksc.txt โ”‚ โ”‚ โ”œโ”€โ”€ tet.txt โ”‚ โ”‚ โ””โ”€โ”€ text.txt โ”‚ โ””โ”€โ”€ test_nicepath.py โ”œโ”€โ”€ init.py โ”œโ”€โ”€ main.py โ”œโ”€โ”€ pyproject.toml โ””โ”€โ”€ README.md


๐Ÿ”ฎ Roadmap

[ ] PyPI release [ ] Async support [ ] Caching search engine [ ] Watchdog integration [ ] Colored tree output [ ] CLI interface


๐Ÿ‘ค Author

Amin GitHub: https://github.com/amin13m


๐Ÿ“œ License

MIT License


๐Ÿ’Ž Philosophy

Clean code. Predictable behavior. Zero surprise file handling.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nicepython-0.1.0.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nicepython-0.1.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file nicepython-0.1.0.tar.gz.

File metadata

  • Download URL: nicepython-0.1.0.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for nicepython-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3f8d13000e3f40dadaa521eb0b757ac62c4f75f3c1e85d9a5153e0e0d1b2c98e
MD5 cec0889db63e91b79cce535be09826a1
BLAKE2b-256 30d18508f10bd3bd8d387e50482435ec4c2dab07c0771a42aed0b57a10e616bc

See more details on using hashes here.

File details

Details for the file nicepython-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nicepython-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for nicepython-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65a41e402424b81994ac000748ab52d477d5adc074f128a8ee3d475baf3a8c3e
MD5 ccfe05ef68d6a7186177ef9938744f56
BLAKE2b-256 c6e27b1d5635ed0306b06fde19e0f95a23a01d19583b0c55f3bc16e762448d54

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page