Skip to main content

Python Test PyPI version MIT License

oglob

The oglob is a Python module designed to offer composable file searching capabilities beyond the traditional glob.glob functionality. It enables users to perform complex pattern-based searches for files and directories within a file system, offering a blend of flexibility, performance, and ease of use.

The Key feature is the composable file pattern matching: Utilizes logical operators such as AND, OR, NOT, and AND NOT (DIFF) to construct intricate search patterns, allowing for precise file and directory selection criteria.

Getting Started

The module is easy to integrate and use within any Python project. It's compatible with standard Python workflows and can be used alongside other file manipulation libraries.

from oglob import files
root = '.'
pattern = files.sec(lambda parts: 'tests' in parts)
pattern &= files.path(lambda p: p.suffix == '.py')
required_files = files(root, pattern, recursive=True)
# required_files: Iterable[Path]

API Reference

  • files(root: str | Path, pattern: PathPattern, ...), see the docstrings for more details.
  • files.sec(predicate: 'tuple[str, ...] -> bool') -> PathPattern
  • files.full(predicate: 'str -> bool') -> PathPattern
  • files.path(predicate: 'Path -> bool') -> PathPattern
  • files.name(predicate: 'str -> bool') -> PathPattern

For PathPattern objects, logical operators are supported:

  • p1 & p2: p1 and p2 must be satisfied.
  • p1 | p2: p1 or p2 must be satisfied.
  • ~p: p must not be satisfied.
  • p1 - p2: p1 must be satisfied, but p2 must not be satisfied.

Contributing

Feature enhancement, bug fixes, and documentation improvements are welcome, community input is highly valued.

LICENSE

This project is licensed under the MIT License - see the LICENSE file for details

Metadata

Release files for oglob 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oglob 0.1.0
File Size Uploaded
oglob-0.1.0.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for oglob 0.1.0
File Interpreter ABI Platform
oglob-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.3 kB

Release files / oglob-0.1.0.tar.gz

Download URL oglob-0.1.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
99aa298cfcc43f8b86bae3f5ca565de9e10d13801872eeba62d1d63c65ad566a
BLAKE2b-256 checksum
How to use checksums
473486902dce97c27fb0536e6530d12eedff70ccc86c5efb4b4c62891df8cee2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / oglob-0.1.0-py3-none-any.whl

Download URL oglob-0.1.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17a60678d0f88c4368c747eb5ff57b2622307740961b1e495afb2b7c7133a2ea
BLAKE2b-256 checksum
How to use checksums
5426629f0b327bb6668c708bbb28b5e5d8b7efb815376d31cd5c3b1c6c71ce83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page