Repository navigation
Description
Student: Raj Manoj Patil
Task: R23-T039 · 9 of 10
Repository: https://github.com/S-AI-Projects/TheAlgorithms-Python
Assigned working branch: student/e26b07f0759
Goal
Explore how the repository's CI collects, runs and reports on this file. build.yml skips digital_image_processing/ entirely. Why? Run this file's doctests locally with opencv-python-headless on Python 3.12 and propose how CI could cover it.
Steps
- Read .github/workflows/build.yml (the pytest command, the --ignore list, coverage) and pyproject.toml [tool.pytest].
- Run the CI-equivalent command for just this file with
-vand coverage:uv run --python 3.12 --with numpy --with opencv-python-headless --with pytest --with pytest-cov pytest digital_image_processing/dithering/burkes.py --cov=digital_image_processing/dithering --cov-report=term-missing -v. - Find this file in DIRECTORY.md and explain how scripts/build_directory_md.py and scripts/validate_filenames.py treat it.
- Write work/R23-T039/CI_NOTES.md answering the question in the goal with evidence.
- Make the code change in the repository: digital_image_processing/dithering/burkes.py: doctests that use a tiny numpy array instead of an image file, so the file can be tested whenever cv2 is installed. Re-run the automated check and the repo's own tests afterwards.
- Prepare the PR: on branch R23-T039, commit the code change plus your work/R23-T039/ evidence, put your findings in the PR description and open the PR against the org fork. For a later upstream PR, create a second branch containing only the code change (no work/ folder).
Done when
☐ CI_NOTES.md quotes the --ignore=digital_image_processing/ line in build.yml and explains why (no cv2 wheel for 3.15t).
☐ digital_image_processing/dithering/burkes.py gains doctests that use a tiny numpy array (no image file) for process(), and Burkes.init gains its missing hints.
☐ uv run --python 3.12 --with numpy --with opencv-python-headless --with pytest pytest <file> passes (output pasted); a CI change is proposed in the PR.
Additional task guidance
Additional curated task guidance
Item:
digital_image_processing/dithering/burkes.py (98 lines; 3 doctests)
Task type:
CI & repo tooling
Code change (goes into the PR):
digital_image_processing/dithering/burkes.py: doctests that use a tiny numpy array instead of an image file, so the file can be tested whenever cv2 is installed.
Automated check:
uv run --python 3.12 --with numpy --with opencv-python-headless --with pytest --with pytest-cov pytest digital_image_processing/dithering/burkes.py --cov=digital_image_processing/dithering --cov-report=term-missing -v
Prerequisites:
Linux/WSL2/Codespaces with uv (https://docs.astral.sh/uv/getting-started/installation/); run uv sync --group=test once – it installs the Python version CI uses (.python-version = 3.15t) and the test dependencies, about 1–2 GB; files importing cv2 need uv run --python 3.12 --with numpy --with opencv-python-headless … because CI skips digital_image_processing/ (no 3.15t wheel)
Upstream PR rules:
Follow CONTRIBUTING.md: type hints on every parameter/return, doctests for valid and erroneous input, snake_case file names, no duplicate of an existing implementation, no hand edits to DIRECTORY.md. CI (pytest with doctests, ruff) must pass – bots close PRs without tests or type hints. Keep work/ (benchmarks, notes, property tests) out of the upstream branch; put results in the PR description.
Source (pinned):
https://github.com/TheAlgorithms/Python/blob/574d100b7181956e9c8384552fd078165e4cc326/digital_image_processing/dithering/burkes.py
Change:
No change recorded
PR destination:
Preserved pilot guidance
Submission checklist
- Complete this task and its checks.
- Add the required evidence and link your pull request here.
- Select this S-AI-Projects fork as the PR base repository.
- Request instructor review.
Keep this PR focused on this task. Do not submit assignment PRs to the upstream repository.
Activity