gitignore_lib
This library (and simple CLI application) parses and applies rules from
.gitignore files. It can be used to provide gitignore-like functionality
to your applications with a familiar syntax and behavior.
Installation
It is available on PyPI: https://pypi.org/project/gitignore-lib/. So use the default Python ways:
pip install gitignore_lib
If you are interested in using the CLI tool (it is not very exciting, but who
knows?), use pipx, uv or something similar:
pipx install gitignore_lib
Basic usage
Just open a .gitignore file and use the resulting object to match paths
against the rules. For example:
from gitignore import load # it also offers loads(), dump() and dumps()
ignore = load(".gitignore", base="/path/to/repo")
ignore("some/path/to/file.txt") # True, if the file is ignored
The ignore object also provides methods for filesystem traversal. For instance,
the walk() method behaves similarly to Path.walk() from pathlib:
for dirpath, dirnames, filenames in ignore.walk("/path/to/repo"):
for file in filenames:
print(dirpath / file) # non-ignored files only!
If you want to learn more, check the documentation.
Metadata
Release files for gitignore-lib 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gitignore_lib-0.1.1.tar.gz | 6.1 kB | Without provenance | Details for gitignore_lib-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gitignore_lib-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for gitignore_lib-0.1.1-py3-none-any.whl |
Total release size: 13.7 kB
Release files / gitignore_lib-0.1.1.tar.gz
| Download URL | gitignore_lib-0.1.1.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ed9c1b6e45b989f9c6857064012f2463cf158f9d4e60c2cce5ac2f5f1ba3021
|
|
BLAKE2b-256 checksum How to use checksums |
2740bb91bc8af9eda702ec80b2b8824d6b2f6aaed73c944469ed46ff9b78dd58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / gitignore_lib-0.1.1-py3-none-any.whl
| Download URL | gitignore_lib-0.1.1-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
46bc645b92c6dba202cf0f2b1f39a2bd5f711e9d9c4af9e47a95eeeda53eb50b
|
|
BLAKE2b-256 checksum How to use checksums |
e63fd9c04e2ff37a0c02af5293ab303201231d1b00f5c48dbd224f2a31d6880b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for gitignore-lib 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.