Skip to main content

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

Project description

NicePy Logo

NicePy

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

Less code. More clarity.


What is 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 .

PyPI Installation (Future):

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

Returns empty list if nothing is found. Never raises error.


logAll – Full Project Logger

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

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

Generates:

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

Use for project snapshot, debug logging, code export, or archiving structure.


Available Methods

Method Description
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

Methods like logAll, tree, and search have default limits to prevent overload:

  • logAll: max_files=500, max_total_size=10_000_000 bytes (10 MB)
  • tree & search: ignore_venv=True, can limit recursion/depth

Behavior on limit reach:

  • Operation does not crash
  • Partial results written
  • Warning logged via logger.warning

Override safety:

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

dir.logAll(
    file_output=output_file,
    search_suffix=".py",
    max_files=1000,
    max_total_size=50_000_000,
    ignore_venv=False
)

Logging System

All critical operations are logged:

  • Start
  • Success
  • Failure
  • Error reason

Ensures debugging & production stability.


Testing

pytest -v

Project Structure

nicepy_python/
├── nicepy/
│   ├── nicepath/
│   │   ├── core.py
│   │   └── exceptios.py
│   └── logger.py
├── tests/
├── main.py
├── README.md
├── pyproject.toml
└── docs/
    └── index.html

Roadmap

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

Documentation

Live SPA Documentation: https://amin13m.github.io/nicepy_python/


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.1.tar.gz (14.3 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.1-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nicepython-0.1.1.tar.gz
  • Upload date:
  • Size: 14.3 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.1.tar.gz
Algorithm Hash digest
SHA256 05c53aef5d2266dc9f7ecc1cdeefa277cb242515aae586533834b316065457f1
MD5 cb0da16fc2795ae3a35a61af4cb76a43
BLAKE2b-256 d70d30411ece35a517a067ac510a57bd87f6e1e8d9a153db150df79badb7aa9e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nicepython-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 66348b7afa205e53b6c56a5776e4c3f0d907b00aec92448f3d4607821bdb9054
MD5 22892ab5ac19b845754c72b72beb8770
BLAKE2b-256 f3ead910bbc7ff9c1a17536c7f565e09ba8b94d77318708601d92eb6ed015349

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