Changed code to support older Python versions
This commit is contained in:
parent
eb92d2d36f
commit
582458cdd0
5027 changed files with 794942 additions and 4 deletions
|
|
@ -0,0 +1 @@
|
|||
pip
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
Metadata-Version: 2.4
|
||||
Name: rignore
|
||||
Version: 0.7.6
|
||||
Classifier: Programming Language :: Rust
|
||||
Classifier: Programming Language :: Python :: Implementation :: CPython
|
||||
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
||||
License-File: LICENSE
|
||||
Summary: Python Bindings for the ignore crate
|
||||
Author-email: Patrick Arminio <patrick.arminio@gmail.com>
|
||||
License: MIT
|
||||
Requires-Python: >=3.8
|
||||
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
||||
|
||||
# rignore 🚀🐍
|
||||
|
||||
`rignore` is a Python module that provides a high-performance, Rust-powered file system traversal functionality. It wraps the Rust `ignore` crate using PyO3, offering an efficient way to walk through directories while respecting various ignore rules.
|
||||
|
||||
## ✨ Features
|
||||
|
||||
- 🚀 Fast directory traversal powered by Rust
|
||||
- 🙈 Respects `.gitignore` rules
|
||||
- 🛠️ Customizable ignore patterns
|
||||
- 💾 Efficient memory usage
|
||||
- 🐍 Easy-to-use Python API
|
||||
|
||||
## 📦 Installation
|
||||
|
||||
You can install `rignore` using pip:
|
||||
|
||||
```bash
|
||||
pip install rignore
|
||||
```
|
||||
|
||||
## 🚀 Usage
|
||||
|
||||
The main function provided by `rignore` is `walk`, which returns an iterator of file paths:
|
||||
|
||||
```python
|
||||
import rignore
|
||||
|
||||
for file_path in rignore.walk("/path/to/directory"):
|
||||
print(file_path)
|
||||
```
|
||||
|
||||
### 🔧 Advanced Usage
|
||||
|
||||
The `walk` function accepts several optional parameters to customize its behavior:
|
||||
|
||||
```python
|
||||
rignore.walk(
|
||||
path,
|
||||
ignore_hidden=None,
|
||||
read_ignore_files=None,
|
||||
read_parents_ignores=None,
|
||||
read_git_ignore=None,
|
||||
read_global_git_ignore=None,
|
||||
read_git_exclude=None,
|
||||
require_git=None,
|
||||
additional_ignores=None,
|
||||
additional_ignore_paths=None,
|
||||
overrides=None,
|
||||
max_depth=None,
|
||||
max_filesize=None,
|
||||
follow_links=None,
|
||||
case_insensitive=None,
|
||||
same_file_system=None,
|
||||
filter_entry=None,
|
||||
)
|
||||
```
|
||||
|
||||
#### 📝 Parameters
|
||||
|
||||
- `path` (str): The root directory to start the walk from.
|
||||
- `ignore_hidden` (bool, optional): Whether to ignore hidden files and directories.
|
||||
- `read_ignore_files` (bool, optional): Whether to read `.ignore` files.
|
||||
- `read_parents_ignores` (bool, optional): Whether to read ignore files from parent directories.
|
||||
- `read_git_ignore` (bool, optional): Whether to respect `.gitignore` files.
|
||||
- `read_global_git_ignore` (bool, optional): Whether to respect global Git ignore rules.
|
||||
- `read_git_exclude` (bool, optional): Whether to respect Git exclude files.
|
||||
- `require_git` (bool, optional): Whether to require the directory to be a Git repository.
|
||||
- `additional_ignores` (List[str], optional): Additional ignore patterns to apply.
|
||||
- `additional_ignore_paths` (List[str], optional): Additional ignore file paths to read.
|
||||
- `overrides` (List[str], optional): Override globs with the same semantics as gitignore. Globs provided here are treated as whitelist matches, meaning only files matching these patterns will be included. Use `!` at the beginning of a glob to exclude files (e.g., `["*.txt", ".env.example", "!secret.txt"]` will include all `.txt` files and `.env.example`, but exclude `secret.txt`).
|
||||
- `max_depth` (int, optional): Maximum depth to traverse.
|
||||
- `max_filesize` (int, optional): Maximum file size to consider (in bytes).
|
||||
- `follow_links` (bool, optional): Whether to follow symbolic links.
|
||||
- `case_insensitive` (bool, optional): Whether to use case-insensitive matching for ignore patterns.
|
||||
- `same_file_system` (bool, optional): Whether to stay on the same file system.
|
||||
- `filter_entry` (Callable[[str, bool], optional): Custom filter function to exclude entries.
|
||||
|
||||
## ⚡ Performance
|
||||
|
||||
`rignore` leverages the power of Rust to provide high-performance directory traversal. It's significantly faster than pure Python implementations, especially for large directory structures.
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
Contributions are welcome! Please feel free to submit a Pull Request.
|
||||
|
||||
## 📄 License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
||||
|
||||
## 🙏 Acknowledgements
|
||||
|
||||
- [ignore](https://github.com/BurntSushi/ripgrep/tree/master/crates/ignore) - The Rust crate that powers this project
|
||||
- [PyO3](https://github.com/PyO3/pyo3) - The library used to create Python bindings for Rust code
|
||||
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
rignore-0.7.6.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
rignore-0.7.6.dist-info/METADATA,sha256=fnNgnet6RR86udcSmYvPA84C4ct0wQLNK9SLFGn0ZAg,4172
|
||||
rignore-0.7.6.dist-info/RECORD,,
|
||||
rignore-0.7.6.dist-info/WHEEL,sha256=V-nRmWteMHF99cdHiqNRprMeNvFExwDHdG-6uj8yckI,129
|
||||
rignore-0.7.6.dist-info/licenses/LICENSE,sha256=cVeSUfwn7g0UsWhiiGCIB-PKRr-Fut9GSN5NKDzYpTI,1072
|
||||
rignore/__init__.py,sha256=w1wxNNym5aUET3jqoi3Wf_qpMXvrKA6-yO4ApthRWXg,111
|
||||
rignore/__init__.pyi,sha256=l2Ehmi-ORhVwLAreS-K9Z-RSUS-ujWwjWvpJeoN2Z_4,1853
|
||||
rignore/__pycache__/__init__.cpython-311.pyc,,
|
||||
rignore/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
rignore/rignore.cpython-311-x86_64-linux-gnu.so,sha256=sA4Oq6NJyn0aVfeBQEFFc6TDc7WnDG2UTKdVVCDNKc4,2551216
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
Wheel-Version: 1.0
|
||||
Generator: maturin (1.9.6)
|
||||
Root-Is-Purelib: false
|
||||
Tag: cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2024 Patrick Arminio
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
Loading…
Add table
Add a link
Reference in a new issue