Release 0.4.0
This pull request introduces a new feature to exclude specific file extensions from processing in the readium tool. The changes include updates to the CLI, configuration, core logic, and documentation, as well as the addition of comprehensive tests to ensure the feature works as expected.
New Feature: Exclude File Extensions
CLI and Configuration Updates:
- Added a new
--exclude-extoption to the CLI, allowing users to specify file extensions to exclude from processing. This option can be used multiple times (e.g.,--exclude-ext .json --exclude-ext .yml) (src/readium/cli.py, src/readium/cli.pyR87-R92). - Updated the
ReadConfigclass to include anexclude_extensionsattribute, which takes precedence overinclude_extensionsduring processing (src/readium/config.py, src/readium/config.pyR179). - Documented the new
exclude_extensionsattribute in theReadConfigdocstring (src/readium/config.py, src/readium/config.pyL163-R169).
Core Logic Enhancements:
- Modified the
should_process_filemethod to check for excluded extensions (case-insensitive) and skip processing files with those extensions (src/readium/core.py, src/readium/core.pyR240-R244).
Documentation:
- Updated the
README.mdto explain the new--exclude-extoption and clarify that exclusions take precedence over inclusions (README.md, [1] [2] [3].
Testing
- Added a new test file,
tests/test_extension_exclusion.py, with multiple test cases to validate the behavior of theexclude_extensionsfeature:- Basic exclusion of single and multiple extensions.
- Interaction between
include_extensionsandexclude_extensions. - Case-insensitive matching of extensions.
- CLI integration tests for the
--exclude-extoption. - Tests for excluding all extensions and ensuring no files are processed.
- Tests for extension exclusion in Git repositories (
tests/test_extension_exclusion.py, tests/test_extension_exclusion.pyR1-R147).