diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 0bb8003..eb88655 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -9,29 +9,29 @@ body: - type: markdown attributes: value: " -Thanks for taking the time to fill out this bug report! + Thanks for taking the time to fill out this bug report! -Before submitting, make sure you search in the [issue list](https://github.com/BlueBrain/dir-content-diff/issues) that a similar issue was not already reported. -If it is not the case, please read the following guidelines. + Before submitting, make sure you search in the [issue list](https://github.com/BlueBrain/dir-content-diff/issues) that a similar issue was not already reported. + If it is not the case, please read the following guidelines. -### GUIDELINES FOR REPORTING BUGS + ### GUIDELINES FOR REPORTING BUGS -Bug reports that are not properly formulated and formatted or without enough details can be very hard for us to understand and fix. -In order to ensure we can help you fixing your bug, please follow these guidelines. + Bug reports that are not properly formulated and formatted or without enough details can be very hard for us to understand and fix. + In order to ensure we can help you fixing your bug, please follow these guidelines. -Your reports must include the following features: + Your reports must include the following features: -1. **succinct description** of the problem - typically a line or two at most. + 1. **succinct description** of the problem - typically a line or two at most. -2. **succinct, dependency-free code** which reproduces the problem, otherwise known as a [Minimal, Complete, and Verifiable](https://stackoverflow.com/help/mcve) example. - IF YOU DO NOT HAVE A COMPLETE, RUNNABLE TEST CASE WRITTEN DIRECTLY IN THE TEXTAREA BELOW, YOUR ISSUE MAY BE CLOSED. + 2. **succinct, dependency-free code** which reproduces the problem, otherwise known as a [Minimal, Complete, and Verifiable](https://stackoverflow.com/help/mcve) example. + IF YOU DO NOT HAVE A COMPLETE, RUNNABLE TEST CASE WRITTEN DIRECTLY IN THE TEXTAREA BELOW, YOUR ISSUE MAY BE CLOSED. -3. **complete stack traces for all errors** - please avoid screenshots, use formatted text inside issues. + 3. **complete stack traces for all errors** - please avoid screenshots, use formatted text inside issues. -4. other relevant things as applicable: **dependencies**, **comparative performance timings** for performance issues, etc. -" + 4. other relevant things as applicable: **dependencies**, **comparative performance timings** for performance issues, etc. + " - type: textarea attributes: @@ -45,8 +45,8 @@ Your reports must include the following features: attributes: label: Optional link from https://dir-content-diff.readthedocs.io which documents the behavior that is expected description: " -Please make sure the behavior you are seeing is definitely in contradiction to what's documented as the correct behavior. -" + Please make sure the behavior you are seeing is definitely in contradiction to what's documented as the correct behavior. + " validations: required: false @@ -54,7 +54,8 @@ Please make sure the behavior you are seeing is definitely in contradiction to w attributes: label: To Reproduce description: " -Provide your [Minimal, Complete, and Verifiable](https://stackoverflow.com/help/mcve) example here." + Provide your [Minimal, Complete, and Verifiable](https://stackoverflow.com/help/mcve) example here. + " placeholder: "# Insert code here (text area already python formatted)" render: Python validations: @@ -64,9 +65,9 @@ Provide your [Minimal, Complete, and Verifiable](https://stackoverflow.com/help/ attributes: label: Error description: " -Provide the complete text of any errors received **including the complete stack trace**. -If the message is a warning, run your program with the ``-Werror`` flag: ``python -Werror myprogram.py`` -" + Provide the complete text of any errors received **including the complete stack trace**. + If the message is a warning, run your program with the ``-Werror`` flag: ``python -Werror myprogram.py`` + " placeholder: "# Copy the complete stack trace and error message here (text area already formatted for Python backtrace)" render: Python traceback validations: diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index ff62655..bd6f497 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -9,26 +9,26 @@ body: - type: markdown attributes: value: " -Thanks for taking the time to fill out this feature request! + Thanks for taking the time to fill out this feature request! -Before submitting, make sure the feature does not already exist in the [documentation](https://dir-content-diff.readthedocs.io) and that you searched in the [issue list](https://github.com/BlueBrain/dir-content-diff/issues) that a similar feature request has not already been reported. -If it is not the case, please read the following guidelines. + Before submitting, make sure the feature does not already exist in the [documentation](https://dir-content-diff.readthedocs.io) and that you searched in the [issue list](https://github.com/BlueBrain/dir-content-diff/issues) that a similar feature request has not already been reported. + If it is not the case, please read the following guidelines. -### GUIDELINES FOR REQUESTING HELP + ### GUIDELINES FOR REQUESTING HELP -Feature requests that are not properly formulated and formatted or without enough details can be very hard for us to understand. -In order to ensure we can help you, please follow these guidelines. + Feature requests that are not properly formulated and formatted or without enough details can be very hard for us to understand. + In order to ensure we can help you, please follow these guidelines. -Your requests must include the following features: + Your requests must include the following features: -1. **succinct description** of the feature - typically a line or two at most to describe what the new feature would do. + 1. **succinct description** of the feature - typically a line or two at most to describe what the new feature would do. -2. **succinct, dependency-free code** which shows how you would like to use this feature, otherwise known as a [Minimal, Complete, and Verifiable](https://stackoverflow.com/help/mcve) example. + 2. **succinct, dependency-free code** which shows how you would like to use this feature, otherwise known as a [Minimal, Complete, and Verifiable](https://stackoverflow.com/help/mcve) example. -3. Why do you need this feature? What would be the use cases? -" + 3. Why do you need this feature? What would be the use cases? + " - type: textarea attributes: diff --git a/.github/ISSUE_TEMPLATE/how_to_use.yaml b/.github/ISSUE_TEMPLATE/how_to_use.yaml index 6db7358..363c633 100644 --- a/.github/ISSUE_TEMPLATE/how_to_use.yaml +++ b/.github/ISSUE_TEMPLATE/how_to_use.yaml @@ -9,31 +9,31 @@ body: - type: markdown attributes: value: " -Thanks for using this package and taking the time to fill out this help request! + Thanks for using this package and taking the time to fill out this help request! -Before submitting, make sure you read the [documentation](https://dir-content-diff.readthedocs.io) carefully. -If you still have a question, you should search in the [issue list](https://github.com/BlueBrain/dir-content-diff/issues) that a similar issue has not already been reported, you might find your answer there. -If it is not the case, please read the following guidelines. + Before submitting, make sure you read the [documentation](https://dir-content-diff.readthedocs.io) carefully. + If you still have a question, you should search in the [issue list](https://github.com/BlueBrain/dir-content-diff/issues) that a similar issue has not already been reported, you might find your answer there. + If it is not the case, please read the following guidelines. -### GUIDELINES FOR REQUESTING HELP + ### GUIDELINES FOR REQUESTING HELP -Questions that are not properly formulated and formatted or without enough details can be very hard for us to understand. -In order to ensure we can help you, please follow these guidelines. + Questions that are not properly formulated and formatted or without enough details can be very hard for us to understand. + In order to ensure we can help you, please follow these guidelines. -Your requests must include the following features: + Your requests must include the following features: -1. **succinct description** of the problem - typically a line or two at most to describe what you want to achieve. + 1. **succinct description** of the problem - typically a line or two at most to describe what you want to achieve. -2. **succinct, dependency-free code** which shows what you tried to do, otherwise known as a [Minimal, Complete, and Verifiable Example](https://stackoverflow.com/help/mcve). + 2. **succinct, dependency-free code** which shows what you tried to do, otherwise known as a [Minimal, Complete, and Verifiable Example](https://stackoverflow.com/help/mcve). -3. **expected results** + 3. **expected results** -4. **complete stack traces for all errors** if you have any - please avoid screenshots, use formatted text inside issues. + 4. **complete stack traces for all errors** if you have any - please avoid screenshots, use formatted text inside issues. -5. other relevant things: **dependencies**, **operating system**, **comparative performance timings** for performance issues. -" + 5. other relevant things: **dependencies**, **operating system**, **comparative performance timings** for performance issues. + " - type: textarea attributes: @@ -46,7 +46,8 @@ Your requests must include the following features: attributes: label: Show what you tried to do. description: " -Provide your [Minimal, Complete, and Verifiable Example](https://stackoverflow.com/help/mcve) here." + Provide your [Minimal, Complete, and Verifiable Example](https://stackoverflow.com/help/mcve) here. + " placeholder: "# Insert code here (text area already python formatted)" render: Python validations: @@ -63,9 +64,9 @@ Provide your [Minimal, Complete, and Verifiable Example](https://stackoverflow.c attributes: label: Error description: " -If you are facing an arror, provide the complete text of any errors received **including the complete stack trace**. -If the message is a warning, run your program with the ``-Werror`` flag: ``python -Werror myprogram.py`` -" + If you are facing an arror, provide the complete text of any errors received **including the complete stack trace**. + If the message is a warning, run your program with the ``-Werror`` flag: ``python -Werror myprogram.py`` + " placeholder: "# Copy the complete stack trace and error message here (text area already formatted for Python backtrace)" render: Python traceback validations: diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index ff3c640..e63f26a 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -11,7 +11,7 @@ jobs: env: PR_TITLE: ${{ github.event.pull_request.title }} steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - uses: actions/setup-node@v6 with: node-version: '20' diff --git a/.github/workflows/publish-sdist.yml b/.github/workflows/publish-sdist.yml index d99216c..a3c4c0e 100644 --- a/.github/workflows/publish-sdist.yml +++ b/.github/workflows/publish-sdist.yml @@ -10,7 +10,7 @@ jobs: name: Build and publish on PyPI runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Set up Python 3.10 uses: actions/setup-python@v6 with: diff --git a/.github/workflows/run-tox.yml b/.github/workflows/run-tox.yml index 9147af5..79d2ae2 100644 --- a/.github/workflows/run-tox.yml +++ b/.github/workflows/run-tox.yml @@ -15,16 +15,16 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.10", "3.11", "3.12"] min_versions: ["min_versions", "latest_versions"] exclude: - min_versions: "min_versions" include: - - python-version: "3.9" + - python-version: "3.10" min_versions: "min_versions" steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v6 with: @@ -35,13 +35,13 @@ jobs: - name: Install APT Packages run: | sudo apt-get install -y poppler-utils imagemagick - - name: Cache tox and precommit environments + - name: Cache tox and prek environments uses: actions/cache@v5 with: path: | .tox - ~/.cache/pre-commit - key: ${{ runner.os }}-${{ matrix.python-version }}-${{ steps.date.outputs.date }}-${{ hashFiles('setup.py') }}-${{ hashFiles('.pre-commit-config.yaml') }} + ~/.cache/prek + key: ${{ runner.os }}-${{ matrix.python-version }}-${{ steps.date.outputs.date }}-${{ hashFiles('setup.py', 'pyproject.toml', 'tox.ini', 'dir_content_diff/comparators/dependencies.json', '.pre-commit-config.yaml') }} - name: Clear results in tox environments run: | rm -rf .tox/*/tmp @@ -49,13 +49,13 @@ jobs: if: ${{ matrix.min_versions == 'latest_versions' }} run: | python -m pip install --upgrade pip setuptools - pip install tox-gh-actions + pip install tox-uv tox-gh-actions tox - name: Run tox with min versions if: ${{ matrix.min_versions == 'min_versions' }} run: | python -m pip install --upgrade pip setuptools - pip install tox + pip install tox-uv tox run -e min_versions - name: JUnit Report Action uses: mikepenz/action-junit-report@v6 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8321d73..9a0946a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,7 @@ +default_install_hook_types: + - pre-commit + - commit-msg + repos: - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.7.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 19b3728..1e59f79 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -59,7 +59,7 @@ When you wish to contribute to the code base, please consider the following guid or ```shell - tox run -e py39,lint,docs,check-packaging + tox run -e py310,lint,docs,check-packaging ``` * Commit your changes using a descriptive commit message. diff --git a/dir_content_diff/comparators/dependencies.json b/dir_content_diff/comparators/dependencies.json index 8953f84..2f32556 100644 --- a/dir_content_diff/comparators/dependencies.json +++ b/dir_content_diff/comparators/dependencies.json @@ -5,5 +5,5 @@ "tables>=3.7" ], "morphio": ["morphio>=3.3.6", "morph_tool>=2.9"], - "voxcell": ["voxcell>=3.1.1", "pynrrd>=0.4,<1.1"] + "voxcell": ["voxcell>=3.1.1", "pynrrd>=0.4,<1.1", "nptyping>=2.5"] } diff --git a/pyproject.toml b/pyproject.toml index ec62bc1..158f953 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ authors = [ ] description = "Simple tool to compare directory contents." readme = "README.md" -requires-python = ">=3.9" +requires-python = ">=3.10" license = { text = "Apache License 2.0" } classifiers = [ "Development Status :: 5 - Production/Stable", @@ -13,7 +13,6 @@ classifiers = [ "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -57,7 +56,6 @@ include = ["dir_content_diff*"] [tool.black] line-length = 100 target-version = [ - "py39", "py310", "py311", "py312", diff --git a/tests/test_missing_deps.py b/tests/test_missing_deps.py index 970282a..0b332e3 100644 --- a/tests/test_missing_deps.py +++ b/tests/test_missing_deps.py @@ -10,12 +10,11 @@ # LICENSE HEADER MANAGED BY add-license-header import importlib +import sys from subprocess import run import pytest -import dir_content_diff.comparators - @pytest.mark.comparators_missing_deps def test_missing_deps(tmp_path): @@ -23,15 +22,14 @@ def test_missing_deps(tmp_path): root_dir = importlib.resources.files("dir_content_diff") # pylint: disable=no-member comparator_dir = root_dir / "comparators" imported_comparators = [ - f"import dir_content_diff.comparators.{i}\n" - for i in dir(dir_content_diff.comparators) - if "_" not in i and (comparator_dir / i).with_suffix(".py").exists() + f"import dir_content_diff.comparators.{path.stem}\n" + for path in sorted(comparator_dir.glob("*.py")) ] missing_deps_file = tmp_path / "test_missing_deps.py" with missing_deps_file.open(mode="w", encoding="utf8") as f: f.writelines(imported_comparators) f.flush() - res = run(["python", str(missing_deps_file)], capture_output=True, check=True) + res = run([sys.executable, str(missing_deps_file)], capture_output=True, check=True) assert res.stderr.decode() == ( "Loading the morphio module without the required dependencies installed " "(requirements are the following: morphio>=3.3.6 and morph_tool>=2.9). " @@ -39,7 +37,8 @@ def test_missing_deps(tmp_path): "These dependencies can be installed with 'pip install dir-content-diff[morphio]'." "\n" "Loading the voxcell module without the required dependencies installed " - "(requirement is the following: voxcell>=3.1.1). " + "(requirements are the following: voxcell>=3.1.1, pynrrd<1.1,>=0.4 and " + "nptyping>=2.5). " "Will crash at runtime if the related functionalities are used. " "These dependencies can be installed with 'pip install dir-content-diff[voxcell]'.\n" ) diff --git a/tests/test_parallel_execution.py b/tests/test_parallel_execution.py index 7f7ca7f..0c0c63c 100644 --- a/tests/test_parallel_execution.py +++ b/tests/test_parallel_execution.py @@ -187,11 +187,11 @@ def test_parallel_single_file_fallback( generate_test_files.create_json(empty_res_tree / "file.json") # Mock the parallel executors and configure logs - with patch( - "concurrent.futures.ThreadPoolExecutor" - ) as mock_thread_executor, patch( - "concurrent.futures.ProcessPoolExecutor" - ) as mock_process_executor, caplog.at_level(logging.DEBUG): + with ( + patch("concurrent.futures.ThreadPoolExecutor") as mock_thread_executor, + patch("concurrent.futures.ProcessPoolExecutor") as mock_process_executor, + caplog.at_level(logging.DEBUG), + ): result = compare_trees( empty_ref_tree, empty_res_tree, executor_type="thread", max_workers=4 ) diff --git a/tox.ini b/tox.ini index b801660..cda702b 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,7 @@ envlist = docs min_versions missing_deps - py{39,310,311,312} + py{310,311,312} coverage minversion = 3.18 @@ -56,7 +56,7 @@ commands = twine check {envtmpdir}/dist/* [testenv:min_versions] -basepython = python3.9 +basepython = python3.10 deps = Requirements-Builder setuptools<82 @@ -83,23 +83,24 @@ commands = {posargs} [testenv:lint] -basepython = python3.9 +basepython = python3.10 deps = - pre-commit + prek pylint + setuptools commands = - pre-commit run --all-files --show-diff-on-failure + prek run --all-files --show-diff-on-failure pylint -j {env:PYLINT_NPROCS:1} {[base]files} [testenv:format] -basepython = python3.9 +basepython = python3.10 skip_install = true deps = codespell - pre-commit + prek commands = codespell -i 3 -x .codespellignorelines -w {[base]files} README.md CHANGELOG.md docs/source - pre-commit run --all-files + prek run --all-files [testenv:docs] changedir = docs @@ -111,7 +112,6 @@ commands = make html SPHINXOPTS=-W [gh-actions] python = - 3.9: py39, lint - 3.10: py310, check-packaging + 3.10: py310, lint 3.11: py311, docs - 3.12: py312 + 3.12: py312, check-packaging