No project description provided
Project description
gitignore-find
查找指定目录下所有被.gitignore
文件忽略的路径,功能与git check-ignore **/*
类似:
- 允许指定多个目录并检查其中所有的
.gitignore
文件 - 被
.gitignore
文件忽略的路径会尝试合并避免路径过多 - 超级快!
常见的用法是找出home目录下所有git仓库下忽略的目录用于从备份目录中排除
安装
目前只提供python扩展,使用pip从pypi安装
pip install gitignore-find
提供了一个简单的命令行程序find但只能使用源码构建
cargo build --example find -r
运行
import gitignore_find
import logging
logging.basicConfig(level=5)
# logging.basicConfig(level=logging.DEBUG)
ignoreds = gitignore_find.find_ignoreds(
["."],
excludes=["**/.git/**", "**/.cargo", "**/.vscode*"],
exclude_ignoreds=["**/.venv/bin/**", "**/.env"],
)
print("\n".join(ignoreds))
性能
使用cargo bench
测试当前目录22196个路径仅需要200ms
$ cargo bench
Finished `bench` profile [optimized + debuginfo] target(s) in 0.10s
Running unittests src/lib.rs (target/release/deps/gitignore_find-c0f4f12deaf970af)
# ...
Running benches/bench_find.rs (target/release/deps/bench_find-79a4c8a597bc913b)
Gnuplot not found, using plotters backend
gitignore find time: [208.50 ms 211.79 ms 215.37 ms]
change: [-2.6305% -0.7100% +1.1692%] (p = 0.50 > 0.05)
No change in performance detected.
在6核9750H SSD设备 wsl debian中运行下面是测试示例从home目录60万个路径中的1024个.gitignore
文件找出忽略路径的用时是21秒左右
$ time cargo run --example find -r -- -i '**/.env*' -e '**/.vscode/**' ~
Finished `release` profile [optimized] target(s) in 0.09s
Running `target/release/examples/find -i '**/.env*' -e '**/.vscode/**' /home/navyd`
[2024-11-25T10:20:54.037Z DEBUG gitignore_find] Finding git ignored paths with exclude globs ["**/.vscode/**"] and exclude ignored globs ["**/.env*"] in 1 paths: ["/home/navyd"]
[2024-11-25T10:20:54.037Z DEBUG gitignore_find] Traversing paths in directory /home/navyd
[2024-11-25T10:20:54.483Z DEBUG gitignore_find] Finding git ignored paths with exclude patterns ["**/.env*"] in all 603140 paths
[2024-11-25T10:20:56.514Z DEBUG gitignore_find] Finding .gitignore files in 603140 paths
[2024-11-25T10:20:56.853Z DEBUG gitignore_find] Finding ignored paths with 1024 gitignores and exclude pattern GlobPathPattern { patterns: ["**/.env*"] } from all 603140 paths
[2024-11-25T10:21:14.117Z DEBUG gitignore_find] Mergeing 116753 ignored paths in 603140 paths
[2024-11-25T10:21:14.117Z DEBUG gitignore_find] Generating subpath digests for 116753 paths
[2024-11-25T10:21:14.559Z DEBUG gitignore_find] Merging 116753 paths for all 603140 paths
[2024-11-25T10:21:14.596Z DEBUG gitignore_find] Found 884 ignored paths for ["/home/navyd"]
# ...
cargo run --example find -r -- -i '**/.env*' -e '**/.vscode/**' ~ 210.91s user 3.57s system 1035% cpu 20.712 total
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file gitignore_find-0.3.2.tar.gz
.
File metadata
- Download URL: gitignore_find-0.3.2.tar.gz
- Upload date:
- Size: 26.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8d1240727fe63ee49e0d60df12373e822c05237b8a230d78e2d16cd5859d896 |
|
MD5 | 46e81e0604ab2771aa985e0f03c5e581 |
|
BLAKE2b-256 | 4b1929d2be5ecfbe9bc0f919ef3c6c00ed00d3d0cc774d138dfe7334a7507cbc |
File details
Details for the file gitignore_find-0.3.2-cp39-abi3-win_amd64.whl
.
File metadata
- Download URL: gitignore_find-0.3.2-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 882.1 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b931935b2b465d7cc55842bdb47a5bdf12f9b56296deea80305f8e1a7532a9b |
|
MD5 | eea411aabfbd2b6f4de0b3b074962509 |
|
BLAKE2b-256 | a87001ed339c14e0167d79385b4ad284294205e6d7f9c98fe4f0cdeac8a578f5 |
File details
Details for the file gitignore_find-0.3.2-cp39-abi3-win32.whl
.
File metadata
- Download URL: gitignore_find-0.3.2-cp39-abi3-win32.whl
- Upload date:
- Size: 785.0 kB
- Tags: CPython 3.9+, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41fb17d34810e25a6453198a4781e380b70293075cb2db6bbd241fadc7e237d4 |
|
MD5 | f45b08bf613d9a75187705f3215b1e19 |
|
BLAKE2b-256 | 8a3886cc40828f58a9dbe70f8b46fd749bf0a4cfb96a43bca3247a1bca7ad3a4 |
File details
Details for the file gitignore_find-0.3.2-cp39-abi3-musllinux_1_2_x86_64.whl
.
File metadata
- Download URL: gitignore_find-0.3.2-cp39-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.9+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1793e62e593aa3b8ef9d076c555b03d28b226a24bc00cbe715a831453a013270 |
|
MD5 | 6ab603f2d2b0cf7c5b1f8426b133153d |
|
BLAKE2b-256 | 15ea3dd4927e584d8c4b7e213d9450ab55f5197ddde5c0312b3bbae7603cb1f3 |
File details
Details for the file gitignore_find-0.3.2-cp39-abi3-musllinux_1_2_i686.whl
.
File metadata
- Download URL: gitignore_find-0.3.2-cp39-abi3-musllinux_1_2_i686.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.9+, musllinux: musl 1.2+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5451f4c38fb72d71f20fd7bcd76457e16e68853fa6ff8b08d6c86b7db13f306b |
|
MD5 | 4db1eadb2d9f754d0bda091e5a59770f |
|
BLAKE2b-256 | 525f5344c09a5e2fd5d1ff57837e373c91f99b877c6923c824fc587e8c43b14f |
File details
Details for the file gitignore_find-0.3.2-cp39-abi3-musllinux_1_2_armv7l.whl
.
File metadata
- Download URL: gitignore_find-0.3.2-cp39-abi3-musllinux_1_2_armv7l.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.9+, musllinux: musl 1.2+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 314284f5a50d079569d9df4dcec32d3f8e40bd79ca45b2e93b3675813f34ab1e |
|
MD5 | 265ea421ee38f139d5d0e04f20895bc0 |
|
BLAKE2b-256 | 04173938a9bca36cb082b3766e4c14b267060477f48dbb9faf17840e7e87749d |
File details
Details for the file gitignore_find-0.3.2-cp39-abi3-musllinux_1_2_aarch64.whl
.
File metadata
- Download URL: gitignore_find-0.3.2-cp39-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.9+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96e7156d707d58ffa3b5740f3de574f59dc8c2543153ecfa78a68b7eab27abba |
|
MD5 | 0ab08853752113bb08dd44d2ada1d679 |
|
BLAKE2b-256 | faea3520d06fef7c76bbe24f76194144e5453165eeaf35f34079550dcaf49b60 |
File details
Details for the file gitignore_find-0.3.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: gitignore_find-0.3.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62cc4e79e2a10da94a47fd635532a4bb6a8fdc7ca416a9235c6388ade7b2bca8 |
|
MD5 | 5f2e580df8408ebd2eff0baf1fb35afe |
|
BLAKE2b-256 | 6a1484b75c9ffa30fb25fdccca54a0ef9165ed750b7cc6ff5c099ac5605028b8 |
File details
Details for the file gitignore_find-0.3.2-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
.
File metadata
- Download URL: gitignore_find-0.3.2-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ s390x
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e7c26e90f69de14eeb5526abbade21f783ed2eebd1c0a65faafc691828dea41 |
|
MD5 | dff7d4ffd989823c6821d163692a84ce |
|
BLAKE2b-256 | 61e60fb706258bb25b73815ac889e0641cc6603fd6c96e57cf3118447f06054a |
File details
Details for the file gitignore_find-0.3.2-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
.
File metadata
- Download URL: gitignore_find-0.3.2-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ppc64le
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dda3e3ade3cbabf56bd28fff96099e08f8b0b09240b146e97964ff931994f8dc |
|
MD5 | 12ac720de302a88f94afc15418994230 |
|
BLAKE2b-256 | 381852ced9accea2c1a465b55655305f2ec8db120a36274906d288a23f84fffd |
File details
Details for the file gitignore_find-0.3.2-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: gitignore_find-0.3.2-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8058cb86f124372842649c67b7ce6af7b292bad76a447034cd67a5efe629632 |
|
MD5 | 5edd2b11e34105647e71111ae776c528 |
|
BLAKE2b-256 | 4b7516f1c05dfbb8eca74210a710ae4e43cb4c74cc2950228a10baca43336d20 |
File details
Details for the file gitignore_find-0.3.2-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
.
File metadata
- Download URL: gitignore_find-0.3.2-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6aa0dbe5e8693d6916b2fa13c8eac2c9bbeda942037730ea3e71c47f5b13922c |
|
MD5 | 2cdd7c544823a19497b4a91e924dc318 |
|
BLAKE2b-256 | 9d9a015cb650d1491763671f3d68a230373f0be226604bfe0bb6f80829fdcb16 |
File details
Details for the file gitignore_find-0.3.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: gitignore_find-0.3.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72fd785dd071e3a61a42d24efaafae2f1dd893d8c85b4bd26e26fc2a7cdd5ead |
|
MD5 | 29507dfbefe590dcfbc7e854560cb000 |
|
BLAKE2b-256 | 38e9635be77cfd2640b97cb4dd81f3bc64cc16b4f895b6815963df8bed5875d7 |
File details
Details for the file gitignore_find-0.3.2-cp39-abi3-macosx_11_0_arm64.whl
.
File metadata
- Download URL: gitignore_find-0.3.2-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 971.5 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e588cea3d3e3fcfc4c8fb77134f07969e1fdc718008453bad45f2ff3adb0d818 |
|
MD5 | 2720feaff53faaafb4e38a47ba08165e |
|
BLAKE2b-256 | 2110a6550c7dbbdaf252b256b38c2fe31822c2abf27e8d60cc33ccce7c4c8aa4 |
File details
Details for the file gitignore_find-0.3.2-cp39-abi3-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: gitignore_find-0.3.2-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5e44473e8a2e37c2b11c82d91d4f8b02c91f9b5d49ecd746b4f06a89d177809 |
|
MD5 | e4ab8e81e5dd6216ffede94e80ed491c |
|
BLAKE2b-256 | 191b1c40bd1ec27ab1c17837b0b9168c21a2dc61bf70d79560270f8736ca2797 |