Metadata-Version: 2.4
Name: smartpathlibrary
Version: 1.0.0
Summary: Library for working with paths to files and folders.
Home-page: https://github.com/smartlegionlab/smartpathlibrary/
Author: Alexander Suvorov
Author-email: smartlegiondev@gmail.com
License: BSD 3-Clause License
Project-URL: Documentation, https://github.com/smartlegionlab/smartpathlibrary/blob/master/README.md
Project-URL: Release notes, https://github.com/smartlegionlab/smartpathlibrary/releases
Keywords: smartpathlibrary,smartlegionlab
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# smartpathlibrary <sup>v1.0.0</sup>

---

Library for working with paths to files and folders.

---

[![PyPI Downloads](https://static.pepy.tech/badge/smartpathlib)](https://pepy.tech/projects/smartpathlib)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/smartlegionlab/smartpathlibrary)](https://github.com/smartlegionlab/smartpathlibrary/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/smartpathlibrary?label=pypi%20downloads)](https://pypi.org/project/smartpathlibrary/)
![GitHub top language](https://img.shields.io/github/languages/top/smartlegionlab/smartpathlibrary)
[![PyPI](https://img.shields.io/pypi/v/smartpathlibrary)](https://pypi.org/project/smartpathlibrary)
[![GitHub](https://img.shields.io/github/license/smartlegionlab/smartpathlibrary)](https://github.com/smartlegionlab/smartpathlibrary/blob/master/LICENSE)
[![PyPI - Format](https://img.shields.io/pypi/format/smartpathlibrary)](https://pypi.org/project/smartpathlibrary)

---

## ⚠️ Disclaimer

**By using this software, you agree to the full disclaimer terms.**

**Summary:** Software provided "AS IS" without warranty. You assume all risks.

**Full legal disclaimer:** See [DISCLAIMER.md](https://github.com/smartlegionlab/smartpathlibrary/blob/master/DISCLAIMER.md)

---

## Help:

`pip install smartpathlibrary`

```python
from smartpathlibrary.tools import PathManager, Dir, File, get_root_path, PathNormalizer, Counter, Folder

# ========== WORK WITH PATHS ==========

# Check existence
file = File("document.txt")
print(file.exists())  # False or True

folder = Folder("/home/user/docs")
print(folder.exists())

# Path normalization for different OS
normalized = PathNormalizer.normalize("/home/user/my file.txt")
# On Linux: '/home/user/my\ file.txt'
# On Windows: '/home/user/my file.txt'


# ========== DIRECTORY TRAVERSAL ==========

dir_obj = Dir("/home/user/project")

# Get all files recursively
for file in dir_obj.get_files(recursive=True):
    print(file)

# Only files in root folder (no subfolders)
for file in dir_obj.get_files(recursive=False):
    print(file)

# Get all subdirectories
for subdir in dir_obj.get_dirs(recursive=True):
    print(subdir)

# Count
print(f"Files: {dir_obj.get_count_files(recursive=True)}")
print(f"Folders: {dir_obj.get_count_dirs(recursive=True)}")


# ========== PATH MANAGER ==========

pm = PathManager()

# Add single paths
pm.add_path("/home/user/project")
pm.add_path("/home/user/notes.txt")

# Add multiple paths
pm.add_paths([
    "/home/user/docs",
    "/home/user/readme.md"
])

# Get all files (recursive through all added folders)
all_files = list(pm.get_files(recursive=True))
print(f"Files found: {len(all_files)}")

# Get all subfolders
all_dirs = list(pm.get_dirs(recursive=True))

# Statistics
print(f"Total paths added: {pm.count}")
print(f"Total files (recursive): {pm.get_count_files()}")
print(f"Total folders: {pm.get_count_dirs()}")

# Remove paths
pm.remove_path("/home/user/notes.txt")
pm.remove_paths(["/home/user/docs"])

print(pm)  # Paths(2)


# ========== GET ABSOLUTE PATH ==========

abs_path = get_root_path("data/config.json")
print(abs_path)  # /full/path/to/script/folder/data/config.json


# ========== COUNT ITEMS IN ITERABLE ==========

counter = Counter()
items = [1, 2, 3, 4, 5]
print(counter.get_count(items))  # 5
```

---

## License

**[BSD 3-Clause License](https://github.com/smartlegionlab/smartpathlibrary/blob/master/LICENSE)**

Copyright (©) 2026, [Alexander Suvorov](https://github.com/smartlegionlab)

---



