Skip to main content

A Python library that extends pathlib with enhanced path manipulation and directory listing capabilities.

Project description

pathlist

pathlist: A Python library that extends pathlib with enhanced path manipulation and directory listing capabilities. Easily navigate, query, and manipulate file system paths with added convenience and flexibility.

Features:

  • Enhanced Path class with additional methods for easy path manipulation.
  • Customizable and human-readable directory listing with filtering options.
  • Support for recursive file and directory exploration.
  • Intuitive and Pythonic interface, compatible with existing pathlib usage.

Installation:

pip install pathlist

Quick Start:

from pathlist import Path

# Create a Path object
path = Path('/some/directory')

# List files in the directory
print(path.ls())

# Recursively list all files in the directory and its subdirectories
print(path.rls())

# Check if a certain part exists in the path
print('folder_name' in path)

# Change parts of the path
new_path = path.change('old_folder', 'new_folder')

Usage Examples

List Directory Contents

from pathlist import Path

# List all items in the current directory
print(Path().ls())

"""
(#7) [Path('LICENSE'),
      Path('setup.py'),
      Path('src'),
      Path('dist'),
      Path('README.md'),
      Path('test'),
      Path('build')]
"""

List Files with Specific Extension

from pathlist import Path

# List all files with the .py extension in the current directory
print(Path().rls('.py'))

"""
(#7) [Path('setup.py'),
      Path('src/pathlist/__init__.py'),
      Path('src/pathlist/__pycache__/__init__.cpython-310.pyc'),
      Path('src/pathlist/__pycache__/path.cpython-310.pyc'),
      Path('src/pathlist/path.py'),
      Path('build/lib/pathlist/__init__.py'),
      Path('build/lib/pathlist/path.py')]
"""

Get Directory Tree Structure

from pathlist import get_directory_tree

# Print the directory tree structure for the src directory
print(get_directory_tree('src/'))

"""
|--[D] src
      |--[D] pathlist
            |--[F] __init__.py
            |--[D] __pycache__
                  |--[F] __init__.cpython-310.pyc
                  |--[F] path.cpython-310.pyc
            |--[F] path.py
      |--[D] pathlist.egg-info
            |--[F] PKG-INFO
            |--[F] SOURCES.txt
            |--[F] dependency_links.txt
            |--[F] top_level.txt
"""

About the Project:

PathList is designed to provide developers with a more powerful and flexible way to work with file system paths. By extending Python's built-in pathlib, PathList adds new features like directory listing with filtering, easier path manipulation, and more. It's perfect for developers who need more control and convenience when handling file paths in their projects.


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

pathlist-0.1.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

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

pathlist-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pathlist-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e1c8299400a7ff8951b162e8eb1b28f24cd0a333eed3d5d0af50cc10303e1530
MD5 ee87aa847bf23e949252b2347b7391ed
BLAKE2b-256 0e76777c80cabfe53dceb378aef361e1257967f76fcfbdaf1e0b87006a8e8b7b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pathlist-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b11ebdf52bdfe9dfcecaad8e9aa03e695925c290dcca4cc410f28019417b8dd1
MD5 c1d50a0b20799d7c17df87df5cbfbc34
BLAKE2b-256 c896bfc13eb5b934ac16d28992b508b3b2dcee11497253f3251e461336717e1a

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