Skip to content

Allow matching regex patterns with glob file resolution #357

@fmigneault

Description

@fmigneault

In the following code snippet:

glob_flags = glob.GLOBSTAR | glob.FORCEUNIX | glob.SPLIT
for filename_glob in glob.glob(file_cfg.glob, flags=glob_flags, exclude=exclude):

The glob.EXTGLOB option should be added, such that one can define a configuration as follows:

[[tool.bumpversion.files]]
glob = "**/*.@(json|yml|yaml|py|md)"

That would help greatly simplifying and shortening the definition of the bump configuration, given that the current alternative is to duplicate the entire section parameters for each glob = "**/*.json, glob = "**/*.yml, etc. Depending on the search/replace pattern and exclusion list, duplicating the configuration makes a massive definition with many extensions to look for similar contents.

Example:

# current code
list(glob.glob("**/*.@(json|yml|yaml|py|md)", flags=glob.GLOBSTAR | glob.FORCEUNIX | glob.SPLIT, exclude=exclude))
[]

# with extra flag
list(glob.glob("**/*.@(json|yml|yaml|py|md)", flags=glob.GLOBSTAR | glob.FORCEUNIX | glob.SPLIT | glob.EXTGLOB, exclude=exclude))
['best-practices.md', 'CHANGELOG.md', 'CONTRIBUTING.md', 'docs/legacy/dlm.md', 'docs/legacy/ml-model.md', 'examples/collection.json', 'examples/item_bands_expression.json', 'examples/item_basic.json', 'examples/item_eo_and_raster_bands.json', 'examples/item_eo_bands.json', 'examples/item_eo_bands_summarized.json', 'examples/item_multi_io.json', 'examples/item_raster_bands.json', 'htmlcov/status.json', 'json-schema/schema.json', 'package-lock.json', 'package.json', 'README.md', 'README_STAC_MODEL.md', 'stac_model/base.py', 'stac_model/examples.py', 'stac_model/input.py', 'stac_model/output.py', 'stac_model/runtime.py', 'stac_model/schema.py', 'stac_model/__init__.py', 'stac_model/__main__.py', 'tests/conftest.py', 'tests/test_schema.py', 'tests/test_stac_model.py']

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions