Skip to content

Commit 1017208

Browse files
Merge branch 'openfoodfacts:develop' into feat/facet-container
2 parents 7b4b5a0 + 3f11470 commit 1017208

24 files changed

Lines changed: 2404 additions & 2052 deletions

.github/labeler.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ images:
1515
OCR:
1616
- changed-files:
1717
- any-glob-to-any-file: 'tests/​test_ocr.py'
18-
18+
1919
tests:
2020
- changed-files:
2121
- any-glob-to-any-file: 'tests/test_utils.py'
22-
- any-glob-to-any-file: 'tests/test_api.py'
23-
- any-glob-to-any-file: 'tests/test_ocr.py'
24-
- any-glob-to-any-file: 'tests/test_redis.py'
25-
- any-glob-to-any-file: 'tests/test_images.py'
26-
- any-glob-to-any-file: 'tests/test_api_config.py'
22+
- any-glob-to-any-file: 'tests/test_api.py'
23+
- any-glob-to-any-file: 'tests/test_ocr.py'
24+
- any-glob-to-any-file: 'tests/test_redis.py'
25+
- any-glob-to-any-file: 'tests/test_images.py'
26+
- any-glob-to-any-file: 'tests/test_api_config.py'
2727

2828
utils:
2929
- changed-files:
@@ -32,7 +32,7 @@ utils:
3232

3333
dependencies:
3434
- changed-files:
35-
- any-glob-to-any-file: 'poetry.lock'
35+
- any-glob-to-any-file: 'uv.lock'
3636

3737
documentation:
3838
- changed-files:

.github/workflows/ci.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
paths:
66
- "openfoodfacts/**"
77
- "pyproject.toml"
8-
- "poetry.lock"
8+
- "uv.lock"
99
- "tests/**"
1010

1111
jobs:
@@ -19,27 +19,24 @@ jobs:
1919
- uses: actions/setup-python@v5
2020
with:
2121
python-version: ${{ matrix.python-version }}
22-
- name: Install Poetry
23-
uses: snok/install-poetry@v1.4
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v7
2424
with:
25-
virtualenvs-create: true
26-
virtualenvs-in-project: true
25+
version: "0.10.2"
2726
- name: Load cached venv
28-
id: cached-poetry-dependencies
27+
id: cached-uv-dependencies
2928
uses: actions/cache@v4
3029
with:
3130
path: .venv
32-
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
31+
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/uv.lock') }}
3332
- name: Install dependencies
34-
run: poetry install --with=dev --all-extras
35-
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
33+
run: uv sync --all-extras
34+
if: steps.cached-uv-dependencies.outputs.cache-hit != 'true'
3635

3736
- name: Launch quality checks
3837
run: |
39-
poetry run flake8 .
40-
poetry run black --check .
41-
poetry run mypy .
42-
poetry run isort --check .
38+
uv run ruff check .
39+
uv run mypy .
4340
- name: Test with pytest
4441
run: |
45-
poetry run pytest tests
42+
uv run pytest tests

.github/workflows/github-projects.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,9 @@ jobs:
9595
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
9696
labeled: 🚦 Nutri-Score
9797
label-operator: OR
98+
- uses: actions/add-to-project@main
99+
with:
100+
project-url: https://github.com/orgs/openfoodfacts/projects/5 # Add issue to the Folksonomy Engine project
101+
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
102+
labeled: Folksonomy Engine
103+
label-operator: OR

.github/workflows/pypi.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ jobs:
1414
uses: actions/setup-python@v5
1515
with:
1616
python-version: 3.11
17-
- uses: abatilo/actions-poetry@v4.0.0
17+
- name: Install uv
18+
uses: astral-sh/setup-uv@v7
1819
with:
19-
poetry-version: 2.3.2
20-
- name: Run poetry build
21-
run: poetry build
22-
- name: Run poetry publish
23-
run: POETRY_PYPI_TOKEN_PYPI=${{ secrets.PYPI_TOKEN }} poetry publish
20+
version: "0.10.2"
21+
- name: Run uv build
22+
run: uv build
23+
- name: Run uv publish
24+
run: UV_PUBLISH_TOKEN=${{ secrets.PYPI_TOKEN }} uv publish

.pre-commit-config.yaml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
# SPDX-FileCopyrightText: 2020 Free Software Foundation Europe e.V.
22
# SPDX-License-Identifier: CC0-1.0
33
repos:
4-
- repo: https://github.com/fsfe/reuse-tool
5-
rev: v5.0.2
6-
hooks:
7-
- id: reuse-lint-file
4+
- repo: https://github.com/fsfe/reuse-tool
5+
rev: v6.2.0
6+
hooks:
7+
- id: reuse-lint-file
8+
9+
- repo: https://github.com/astral-sh/ruff-pre-commit
10+
# Ruff version.
11+
rev: v0.15.0
12+
hooks:
13+
# Run the linter.
14+
- id: ruff-check
15+
# Run the formatter.
16+
- id: ruff-format

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "3.4.2"
2+
".": "3.4.3"
33
}

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## [3.4.3](https://github.com/openfoodfacts/openfoodfacts-python/compare/v3.4.2...v3.4.3) (2026-02-13)
4+
5+
6+
### Technical
7+
8+
* **deps-dev:** bump cryptography from 43.0.3 to 46.0.5 ([#424](https://github.com/openfoodfacts/openfoodfacts-python/issues/424)) ([c5b4349](https://github.com/openfoodfacts/openfoodfacts-python/commit/c5b43496fea0dec61b499ca1bcd04203527a3238))
9+
* **deps:** bump protobuf from 5.29.5 to 5.29.6 ([#419](https://github.com/openfoodfacts/openfoodfacts-python/issues/419)) ([4e0c58a](https://github.com/openfoodfacts/openfoodfacts-python/commit/4e0c58a7ad9b97e1ee035df308e7c23cbc6af588))
10+
* **deps:** upgrade dependencies ([#426](https://github.com/openfoodfacts/openfoodfacts-python/issues/426)) ([93be8e5](https://github.com/openfoodfacts/openfoodfacts-python/commit/93be8e587d7c1bdecea9cc84d8f6e278c475d5c3))
11+
* improve tooling ([#430](https://github.com/openfoodfacts/openfoodfacts-python/issues/430)) ([c18d93f](https://github.com/openfoodfacts/openfoodfacts-python/commit/c18d93f72a62ecb6367e262d4e99d305ea4016ce))
12+
* move NutritionV3 from robotoff to SDK ([#433](https://github.com/openfoodfacts/openfoodfacts-python/issues/433)) ([0b2bc01](https://github.com/openfoodfacts/openfoodfacts-python/commit/0b2bc01ff4e04bdf29fc22d8aa3b6bdcde0aae5e))
13+
* remove reference to last release sha ([bef76a3](https://github.com/openfoodfacts/openfoodfacts-python/commit/bef76a3a9b113533f92f683ec10a660f20aa185e))
14+
* replace black/isort/flake8 by ruff ([#429](https://github.com/openfoodfacts/openfoodfacts-python/issues/429)) ([3d3c20c](https://github.com/openfoodfacts/openfoodfacts-python/commit/3d3c20c43176cfda3ddff5fdefd0f6d0702da326))
15+
* switch from poetry to uv ([#431](https://github.com/openfoodfacts/openfoodfacts-python/issues/431)) ([dcbd4fc](https://github.com/openfoodfacts/openfoodfacts-python/commit/dcbd4fc1491632460e406ebcc8a4067cfb689575))
16+
317
## [3.4.2](https://github.com/openfoodfacts/openfoodfacts-python/compare/v3.4.1...v3.4.2) (2026-02-10)
418

519

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ Contributors:
111111
- [Benoît Prieur](https://github.com/benprieur)
112112
- [Aadarsh A](https://github.com/aadarsh-ram)
113113

114+
We use uv as a dependency manager and ruff as a linter/formatter.
115+
114116
## Copyright and License
115117

116118
Copyright 2016-2024 Open Food Facts

openfoodfacts/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@
3030
"normalize_barcode",
3131
]
3232

33-
__version__ = "3.4.2"
33+
__version__ = "3.4.3"

openfoodfacts/api.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,8 @@ def parse_ingredients(
397397

398398
if not api_version.startswith("v3"):
399399
logger.warning(
400-
"ingredient parsing is only available in v3 of the API (here: %s), using v3",
400+
"ingredient parsing is only available in v3 of the API (here: %s), "
401+
"using v3",
401402
self.api_config.version,
402403
)
403404
api_version = "v3"
@@ -431,11 +432,12 @@ def parse_ingredients(
431432
) as e:
432433
raise RuntimeError(
433434
f"Unable to parse ingredients: error during HTTP request: {e}"
434-
)
435+
) from e
435436

436437
if not r.ok:
437438
raise RuntimeError(
438-
f"Unable to parse ingredients (non-200 status code): {r.status_code}, {r.text}"
439+
"Unable to parse ingredients (non-200 status code): "
440+
f"{r.status_code}, {r.text}"
439441
)
440442

441443
response_data = r.json()
@@ -486,8 +488,9 @@ def upload_image(
486488
api_version = self.api_config.version
487489
if not self.api_config.version.startswith("v3"):
488490
warnings.warn(
489-
"image upload is only available in v3 of the API (here: %s), forcing use of v3"
490-
% self.api_config.version,
491+
"image upload is only available in v3 of the API (here: %s), "
492+
"forcing use of v3" % self.api_config.version,
493+
stacklevel=2,
491494
)
492495
api_version = "v3"
493496

@@ -534,7 +537,8 @@ def upload_image(
534537
)
535538
if not isinstance(value, dict):
536539
raise ValueError(
537-
f"selected[{key}][{lang_code}] must be a dict, got {type(value)}"
540+
f"selected[{key}][{lang_code}] must be a dict, got "
541+
f"{type(value)}"
538542
)
539543

540544
# copy the config but force v3 of the API
@@ -665,11 +669,12 @@ def parse_ingredients(text: str, lang: str, api_config: APIConfig) -> list[JSONT
665669
) as e:
666670
raise RuntimeError(
667671
f"Unable to parse ingredients: error during HTTP request: {e}"
668-
)
672+
) from e
669673

670674
if not r.ok:
671675
raise RuntimeError(
672-
f"Unable to parse ingredients (non-200 status code): {r.status_code}, {r.text}"
676+
"Unable to parse ingredients (non-200 status code): "
677+
f"{r.status_code}, {r.text}"
673678
)
674679

675680
response_data = r.json()

0 commit comments

Comments
 (0)