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.1.tar.gz
.
File metadata
- Download URL: gitignore_find-0.3.1.tar.gz
- Upload date:
- Size: 26.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5464d1ae670f3463b5c734f3e02c1305f1b10240e7d2bb08b979ad163d19d216 |
|
MD5 | c74e58fe041f0c3cb8d1f36f3524fd85 |
|
BLAKE2b-256 | 5573f460a7981c064097849fe51ab184fc2e01fcc4b70d4de6451607f589b241 |
File details
Details for the file gitignore_find-0.3.1-cp39-abi3-win_amd64.whl
.
File metadata
- Download URL: gitignore_find-0.3.1-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 882.2 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 | 7510ddfbe91ba3669ff2db0209b745a18b3b91ebd59ee0d228dbea0bd3f66247 |
|
MD5 | 6811ca2988a0cee8965e1fac40c721ff |
|
BLAKE2b-256 | 28e546b08be15ceade5bb189efe2af65ae12e9cf2e5a98dd7d73fa9d147b27d4 |
File details
Details for the file gitignore_find-0.3.1-cp39-abi3-win32.whl
.
File metadata
- Download URL: gitignore_find-0.3.1-cp39-abi3-win32.whl
- Upload date:
- Size: 785.1 kB
- Tags: CPython 3.9+, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 811b3cab821df434f12e85213a714ad713166680baeb3fa142597fd2f338ec88 |
|
MD5 | eb2bc52c0896daa1a8da73830ca341e8 |
|
BLAKE2b-256 | c65fe88b768c040a785cf4ddea498c6f382534738cc20bc311fba4b4faa8e9d1 |
File details
Details for the file gitignore_find-0.3.1-cp39-abi3-musllinux_1_2_x86_64.whl
.
File metadata
- Download URL: gitignore_find-0.3.1-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 | 78269549f256f533363ff900143fabb1c0dd1e2a355f2211e09ec07491bd650a |
|
MD5 | 13ea305da9cb6bc64a9cde9ab34712e2 |
|
BLAKE2b-256 | 58d09b9f36e1d940cdc8b83792e4d40388d3d7280240a4c5f4085012f2a7b18b |
File details
Details for the file gitignore_find-0.3.1-cp39-abi3-musllinux_1_2_i686.whl
.
File metadata
- Download URL: gitignore_find-0.3.1-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 | 75e5965dcc7e6f5e0515fd89701462499af2f62be867cdc68bab027df3299ffb |
|
MD5 | 9bfb7e86ae48eb2b580a46f166323899 |
|
BLAKE2b-256 | 62dc34ec7df8fe065cde49ede3e5641d8dc23f170050813cb8932c20c9cadad2 |
File details
Details for the file gitignore_find-0.3.1-cp39-abi3-musllinux_1_2_armv7l.whl
.
File metadata
- Download URL: gitignore_find-0.3.1-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 | 63f482582fa4f616948d21e09d6fc0abde98ca02e58d20dfdae670ffd948fc14 |
|
MD5 | 3c5e08cfd5c461f54afcf39f02d49350 |
|
BLAKE2b-256 | e0244610352cd477270a4ee451d7a6c4f19b5022762cd004638d43a576559e0f |
File details
Details for the file gitignore_find-0.3.1-cp39-abi3-musllinux_1_2_aarch64.whl
.
File metadata
- Download URL: gitignore_find-0.3.1-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 | dd4c33c58f065b538d270691df1dc8715a647421cab1802e795d4bee57092f6e |
|
MD5 | bba26f3e24f5a2d024ab650feb494d6d |
|
BLAKE2b-256 | a8a094b5d98f8aec6d5d80ba5809ef960932c6addc51a6ef553eb556b959ce09 |
File details
Details for the file gitignore_find-0.3.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: gitignore_find-0.3.1-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 | 517e9406c9fe7c478bacdd7a973a21f5dbcf3d7d5d0e4c56203ac32111643013 |
|
MD5 | f89bb9264b5bf4ed809725957881a2ab |
|
BLAKE2b-256 | 47be399a727854ef9e8a69b3acd93593b203ecabd728a3c5f8b9e9021b547bd6 |
File details
Details for the file gitignore_find-0.3.1-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
.
File metadata
- Download URL: gitignore_find-0.3.1-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 | 3ff6522c15500fbca3d385624438887b1f77ab2f9188b0ecc3d06015ed567f3b |
|
MD5 | ba6820d22cc909be116f3245d9f68f35 |
|
BLAKE2b-256 | 8ffe24b6ab0139948bb84a28b3db074a62bed50bf9ec251ba34ebaa3eb57a955 |
File details
Details for the file gitignore_find-0.3.1-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
.
File metadata
- Download URL: gitignore_find-0.3.1-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 | b16260a3c16e56d22c698503f40a6b475aff2fe75be871dc7cb52b8c7cc46d6c |
|
MD5 | f20f55fdbe0e5eb5204c9f52adfd3885 |
|
BLAKE2b-256 | 345ec458121acef4615107ed1ffa8771894f1864caf4d2a7a004e8ed624d6a7e |
File details
Details for the file gitignore_find-0.3.1-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: gitignore_find-0.3.1-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 | fae2e6441343a374d118c971766f4bf26b39ee42a952e3bf32f5673fe615b9f4 |
|
MD5 | aa9139cea5aa5e1d56558fc801189990 |
|
BLAKE2b-256 | 2e177973ceaab880a4a6ac559c984245b61915ef3fa2848536d5e7d0160a40d7 |
File details
Details for the file gitignore_find-0.3.1-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
.
File metadata
- Download URL: gitignore_find-0.3.1-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 | 678af197665fc2cb0330482e6b77f546545507b4a87fae5d08a8928d53458b5b |
|
MD5 | 1f1e86c1c5733244ed898f6f029c1706 |
|
BLAKE2b-256 | 97010387ea367ffbb8f832a0b5dece6b1a22a61e4fc8b9aacecf1123fd903614 |
File details
Details for the file gitignore_find-0.3.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: gitignore_find-0.3.1-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 | c450e488881be3fed9b83f5e284a5006e8485273321dc3cc3debda48967cf8a2 |
|
MD5 | 3078fed28e300c1f52263741f400d2be |
|
BLAKE2b-256 | 5499a145b75586ba86bbcf11878c1b9463e18b49bf75ed47953042fa700ab6a0 |
File details
Details for the file gitignore_find-0.3.1-cp39-abi3-macosx_11_0_arm64.whl
.
File metadata
- Download URL: gitignore_find-0.3.1-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 | f9a7db498fdfc66ba7a6aea4ccaf4bb4f288d73e283b42891b77f5edefe78423 |
|
MD5 | 9e808f062a4378f9fd6c7b51e67275da |
|
BLAKE2b-256 | 1ec5b0b193f97a1d8f15fce3cd857274028b9aa9bf8256178b6c6e04679f1ddd |
File details
Details for the file gitignore_find-0.3.1-cp39-abi3-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: gitignore_find-0.3.1-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 | da50d36fa6ed5b0431a0e8e205a2ab470853c411273ef4cdccbd2db967777fb0 |
|
MD5 | a7c8d9cab402ec2072d950ba79086974 |
|
BLAKE2b-256 | 43f991962881afb8a538e72fdd9223973020a116f15b988a3d8cdd85d5ae8c17 |