Skip to content

Commit e9fd435

Browse files
authored
refactor: use src layout to simplify packaging with uv (#434)
* refactor: use src layout to simplify packaging with uv * chore: only run mypy on src dir
1 parent be2d214 commit e9fd435

24 files changed

+15
-2
lines changed

β€Ž.github/workflows/ci.ymlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: Launch quality checks
3737
run: |
3838
uv run ruff check .
39-
uv run mypy .
39+
uv run mypy src
4040
- name: Test with pytest
4141
run: |
4242
uv run pytest tests

β€Žpyproject.tomlβ€Ž

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,16 @@ dev = [
7171
redis = ["redis[hiredis]~=7.1.1"]
7272
pillow = ["Pillow>=9.3,<12.2"]
7373
ml = ["tritonclient[grpc]>2.0.0,<3.0.0", "opencv-python-headless>4.0.0,<5.0.0", "Pillow", "albumentations>=2.0.0"]
74+
75+
76+
[tool.pytest.ini_options]
77+
# Use importlib mode as some test names have duplicate basename
78+
# (ex: test_utils.py is both in tests/ml and in tests/unit). See:
79+
# https://docs.pytest.org/en/stable/explanation/pythonpath.html#import-modes
80+
addopts = [
81+
"--import-mode=importlib",
82+
]
83+
# Add the `src` directory to Python path, so that the openfoodfacts module can
84+
# be imported:
85+
# https://docs.pytest.org/en/stable/reference/reference.html#confval-pythonpath
86+
pythonpath = ["src"]
File renamed without changes.

0 commit comments

Comments
Β (0)