**[Installation](#installation)** |
**[Usage](#usage)** |
**[Testing](#testing)** |
**[License](#license)**
# [globmatch](https://github.com/vidartf/globmatch) - Matching paths against globs
[![codecov.io](https://codecov.io/github/vidartf/globmatch/coverage.svg?branch=master)](https://codecov.io/github/vidartf/globmatch?branch=master)
`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:
```bash
pip install globmatch
```
or for a development install:
```bash
pip install -e git+https://github.com/vidartf/globmatch#egg=globmatch
```
## Usage
```python
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](https://github.com/codecov/browser-extension#codecov-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
- [Reporting Issues](https://github.com/vidartf/globmatch/issues)
Raw data
{
"_id": null,
"home_page": "https://github.com/vidartf/globmatch",
"name": "globmatch",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "glob,fnmatch,matching",
"author": "Vidar Tonaas Fauske",
"author_email": "vidartf@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/59/8f/4e01e334765a425a200fdbe5568894e42d43f77994b4c86caa23927235a5/globmatch-2.0.0.tar.gz",
"platform": "",
"description": "**[Installation](#installation)** |\n**[Usage](#usage)** |\n**[Testing](#testing)** |\n**[License](#license)**\n\n# [globmatch](https://github.com/vidartf/globmatch) - Matching paths against globs\n\n[![codecov.io](https://codecov.io/github/vidartf/globmatch/coverage.svg?branch=master)](https://codecov.io/github/vidartf/globmatch?branch=master)\n\n`globmatch` provides functions for matching a path against one ore more glob patterns in Python.\nThis differs from the `glob` module of the standard library, which matches a glob against the\nfile-tree on your system. `globmatch` does not interact with the filesystem at all, but relies on\ngeneric matching. It also differs from the `fnmatch` module of the standard library in that it\naccepts the double star (`**`) element, which matches zero or more directories. Additionally, the\nstar element (`*`) in `fnmatch` will also match across path separators. In `globmatch` the\nstar element matches zero or more characters of the current path element (directory/file name).\n\n\n## Installation\n\nInstall globmatch with pip:\n\n```bash\npip install globmatch\n```\n\nor for a development install:\n\n```bash\npip install -e git+https://github.com/vidartf/globmatch#egg=globmatch\n```\n\n## Usage\n\n```python\nfrom globmatch import glob_match\n\n# Some paths that match (returns True):\nglob_match('.git/gitconfig/', ['.git'])\nglob_match('foo/config', ['**/config'])\nglob_match('foo/config/bar', ['**/config'])\nglob_match('.git/gitconfig/', ['.git', '**/config'])\nglob_match('foo/config/bar', ['.git', '**/config'])\nglob_match('/.git/gitconfig/', ['**/.git'])\n\n# Some paths that do not match (returns False):\nglob_match('/.git/gitconfig/', ['.git']) # Needs ** to match subdir of root dir\nglob_match('foo/node_modules', ['node_modules']) # Will not match subdir without preceding **\n\n```\n\n\n\n## Testing\n\nInstall the develop install with test requirements:\n\n pip install -e globmatch[test]\n\nTo run Python tests locally, enter on the command line: `pytest`\n\nInstall the [codecov browser extension](https://github.com/codecov/browser-extension#codecov-extension)\nto view test coverage in the source browser on github.\n\n## License\n\nAll code is licensed under the terms of the revised BSD license.\n\n## Resources\n\n- [Reporting Issues](https://github.com/vidartf/globmatch/issues)\n\n\n\n",
"bugtrack_url": null,
"license": "BSD-3",
"summary": "Matching paths against globs",
"version": "2.0.0",
"project_urls": {
"Homepage": "https://github.com/vidartf/globmatch"
},
"split_keywords": [
"glob",
"fnmatch",
"matching"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "67f1a50c00bd5d36b5f57a20c81fa37ee0ed095d0639298c1135913c25a1b0b8",
"md5": "5b0d7e1f1a34d5437ff0b3ea08106f8c",
"sha256": "7aef5c66b112f1fcbbacae029e426555e31c7e7556c8542f35931db9b1a9b1d3"
},
"downloads": -1,
"filename": "globmatch-2.0.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "5b0d7e1f1a34d5437ff0b3ea08106f8c",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 7714,
"upload_time": "2021-01-07T14:30:45",
"upload_time_iso_8601": "2021-01-07T14:30:45.467791Z",
"url": "https://files.pythonhosted.org/packages/67/f1/a50c00bd5d36b5f57a20c81fa37ee0ed095d0639298c1135913c25a1b0b8/globmatch-2.0.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "598f4e01e334765a425a200fdbe5568894e42d43f77994b4c86caa23927235a5",
"md5": "eef5ae23f789d625c2452d4e5378e297",
"sha256": "f02e51158f4c6112a3ea8c691f7ff6510791e9caf10fc4e62cc8d013d224bf9d"
},
"downloads": -1,
"filename": "globmatch-2.0.0.tar.gz",
"has_sig": false,
"md5_digest": "eef5ae23f789d625c2452d4e5378e297",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10199,
"upload_time": "2021-01-07T14:30:46",
"upload_time_iso_8601": "2021-01-07T14:30:46.632633Z",
"url": "https://files.pythonhosted.org/packages/59/8f/4e01e334765a425a200fdbe5568894e42d43f77994b4c86caa23927235a5/globmatch-2.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-01-07 14:30:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vidartf",
"github_project": "globmatch",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "globmatch"
}