Installation | Usage | Testing | License
globmatch - Matching paths against globs
globmatch provides functions for matching a path against one ore more glob patterns in Python.
This differs from the glob module of the standard library, which matches a glob against the
file-tree on your system. globmatch does not interact with the filesystem at all, but relies on
generic matching. It also differs from the fnmatch module of the standard library in that it
accepts the double star (**) element, which matches zero or more directories. Additionally, the
star element (*) in fnmatch will also match across path separators. In globmatch the
star element matches zero or more characters of the current path element (directory/file name).
Installation
Install globmatch with pip:
pip install globmatch
or for a development install:
pip install -e git+https://github.com/vidartf/globmatch#egg=globmatch
Usage
from globmatch import glob_match
# Some paths that match (returns True):
glob_match('.git/gitconfig/', ['.git'])
glob_match('foo/config', ['**/config'])
glob_match('foo/config/bar', ['**/config'])
glob_match('.git/gitconfig/', ['.git', '**/config'])
glob_match('foo/config/bar', ['.git', '**/config'])
glob_match('/.git/gitconfig/', ['**/.git'])
# Some paths that do not match (returns False):
glob_match('/.git/gitconfig/', ['.git']) # Needs ** to match subdir of root dir
glob_match('foo/node_modules', ['node_modules']) # Will not match subdir without preceding **
Testing
Install the develop install with test requirements:
pip install -e globmatch[test]
To run Python tests locally, enter on the command line: pytest
Install the codecov browser extension to view test coverage in the source browser on github.
License
All code is licensed under the terms of the revised BSD license.
Resources
Metadata
Release files for globmatch 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| globmatch-2.0.0.tar.gz | 10.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| globmatch-2.0.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 17.9 kB
Release files / globmatch-2.0.0.tar.gz
| Download URL | globmatch-2.0.0.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f02e51158f4c6112a3ea8c691f7ff6510791e9caf10fc4e62cc8d013d224bf9d
|
|
BLAKE2b-256 checksum How to use checksums |
598f4e01e334765a425a200fdbe5568894e42d43f77994b4c86caa23927235a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
|
Release files / globmatch-2.0.0-py2.py3-none-any.whl
| Download URL | globmatch-2.0.0-py2.py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7aef5c66b112f1fcbbacae029e426555e31c7e7556c8542f35931db9b1a9b1d3
|
|
BLAKE2b-256 checksum How to use checksums |
67f1a50c00bd5d36b5f57a20c81fa37ee0ed095d0639298c1135913c25a1b0b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
|