From 2a6ddb9251b8d71bde802dd23c081e6809be776b Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sun, 17 May 2026 00:27:47 +0200 Subject: [PATCH 1/5] Chore: Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88a6bda..f70d996 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Change Log - Verify support for Python 3.14 +- Made `raise_for_status` configurable. Thanks, @ofipify. ## 4.2.1 (2025-09-09) From 33a88abc338925ffcd0461b32d3ce22602a12215 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sun, 17 May 2026 00:37:13 +0200 Subject: [PATCH 2/5] Project: Fix `versioningit` configuration --- pyproject.toml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c56708a..8a64cc5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -105,7 +105,6 @@ max-complexity = 7 [tool.versioningit] - -[tool.versioningit.vcs] -method = "git" -default-tag = "0.0.0" +vcs.method = "git-archive" +vcs.default-tag = "v0.0.0" +vcs.describe-subst = "$Format:%(describe:tags,match=v*)$" From 62a7568bc68d4e54e28b4797befbe757904209ed Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sun, 17 May 2026 00:37:49 +0200 Subject: [PATCH 3/5] Project: Modernize `setup.py` - SPDX license identifier - Find packages without warnings --- setup.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index e98ad3f..f89f5ff 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ import codecs from os import path -from setuptools import setup +from setuptools import find_packages, setup from versioningit import get_cmdclasses here = path.abspath(path.dirname(__file__)) @@ -15,6 +15,7 @@ description=( "Python client for EPO OPS, the European Patent Office's Open Patent Services API." ), + license="Apache-2.0", long_description_content_type="text/markdown", long_description=readme, author="George Song", @@ -23,8 +24,9 @@ maintainer_email="andreas.motl@ip-tools.org", url="https://github.com/ip-tools/python-epo-ops-client", download_url="https://pypi.org/project/python-epo-ops-client/#files", - packages=["epo_ops", "epo_ops.middlewares"], - package_dir={"epo_ops": "epo_ops"}, + packages=find_packages( + include=["epo_ops*"], + ), include_package_data=True, install_requires=[ "dogpile.cache<1.6", @@ -52,7 +54,6 @@ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Natural Language :: English", - "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", From 0a03da34b0eaf07be17a0d4941122a60c9a2e1a1 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sun, 17 May 2026 00:40:14 +0200 Subject: [PATCH 4/5] Chore: Format code using Ruff --- epo_ops/models.py | 2 +- pyproject.toml | 1 + tests/helpers/api_helpers.py | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/epo_ops/models.py b/epo_ops/models.py index f2add30..e5d7fda 100644 --- a/epo_ops/models.py +++ b/epo_ops/models.py @@ -10,6 +10,7 @@ log = logging.getLogger(__name__) + def _prepare_part(part): return "({0})".format(quote(part)) @@ -107,7 +108,6 @@ def _request(self, callback, url, data=None, **kwargs): self.reset_env() return response - def _post_callback(self, url, data, **kwargs): return requests.post(url, data, **kwargs, timeout=self.timeout) diff --git a/pyproject.toml b/pyproject.toml index 8a64cc5..b37e25a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,6 +58,7 @@ lint.select = [ extend-exclude = ["__init__.py"] lint.ignore = [ + "B905", # B905 `zip()` without an explicit `strict=` parameter "E203", "E266", "E501", diff --git a/tests/helpers/api_helpers.py b/tests/helpers/api_helpers.py index 0728deb..fe02d0a 100644 --- a/tests/helpers/api_helpers.py +++ b/tests/helpers/api_helpers.py @@ -48,12 +48,14 @@ def assert_image_success(client): assert_request_success(response) return response + def assert_legal_success(client): response = client.legal(*data) assert_request_success(response) assert "ops:legal" in response.text return response + def assert_published_data_success(client): response = client.published_data(*data) assert_request_success(response) From 073a771479c9492408eca131644ad5d99c62e011 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sun, 17 May 2026 00:43:16 +0200 Subject: [PATCH 5/5] Chore: Format `pyproject.toml` using `pyproject-fmt` --- Makefile | 1 + pyproject.toml | 113 +++++++++++++++++++++---------------------------- setup.py | 1 + 3 files changed, 51 insertions(+), 64 deletions(-) diff --git a/Makefile b/Makefile index cfce5e4..be007cf 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,7 @@ lint: ## lint the project ruff format --check . format: ## Run code formatting + pyproject-fmt --keep-full-version pyproject.toml ruff format . # Configure Ruff not to auto-fix (remove!): # Ignore unused imports (F401), unused variables (F841), `print` statements (T201), and commented-out code (ERA001). diff --git a/pyproject.toml b/pyproject.toml index b37e25a..c816df0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,64 +1,45 @@ -# ================== -# Build system setup -# ================== - [build-system] +build-backend = "setuptools.build_meta" requires = [ "setuptools>=42", # At least v42 of setuptools required! "versioningit", ] -build-backend = "setuptools.build_meta" - -[tool.pytest.ini_options] -minversion = "2.0" -addopts = """ - -rsfEX -p pytester --strict-markers --verbosity=3 - --cov=epo_ops tests --cov-report=term-missing --cov-report=xml - """ -log_level = "DEBUG" -log_cli_level = "DEBUG" -testpaths = ["tests"] -xfail_strict = true -markers = [] [tool.ruff] line-length = 80 - +extend-exclude = [ "__init__.py" ] lint.select = [ - # Bandit - "S", - # Bugbear - "B", # Builtins "A", + # Bugbear + "B", + "B9", # comprehensions "C", + # Pycodestyle + "E", # eradicate "ERA", - # flake8-2020 - "YTT", + # Pyflakes + "F", # isort "I", # pandas-vet "PD", - # print - "T20", - # Pycodestyle - "E", - "W", - # Pyflakes - "F", # return "RET", + # Bandit + "S", # from `.flake8` file - "T", # T4 - "B9", + "T", # T4 + # print + "T20", + "W", + # flake8-2020 + "YTT", ] - -extend-exclude = ["__init__.py"] - lint.ignore = [ - "B905", # B905 `zip()` without an explicit `strict=` parameter + "B905", # B905 `zip()` without an explicit `strict=` parameter "E203", "E266", "E501", @@ -66,12 +47,25 @@ lint.ignore = [ "RET505", # Unnecessary `else` after `return` statement # "W503", # Unknown rule selector ] - +# FIXME: Improve this situation wrt. SQL injection, even it is not be an actual attack vector. +lint.per-file-ignores."*sqlite.py" = [ + "S608", # Possible SQL injection vector through string-based query construction +] +lint.per-file-ignores."epo_ops/api.py" = [ + "A001", # Variable `range` is shadowing a Python builtin + "A002", # Argument `input` is shadowing a Python builtin + "C408", # Unnecessary `dict` call (rewrite as a literal) +] +lint.per-file-ignores."tests/*" = [ + "S101", # Use of `assert` detected +] +lint.per-file-ignores."tests/middlewares/throttle/conftest.py" = [ + "S311", # Standard pseudo-random generators are not suitable for cryptographic purposes +] # from `.isort.cfg` file -[tool.ruff.lint.isort] -combine-as-imports = true -force-wrap-aliases = true -known-third-party = [ +lint.isort.combine-as-imports = true +lint.isort.force-wrap-aliases = true +lint.isort.known-third-party = [ "dateutil", "dogpile", "dotenv", @@ -79,31 +73,22 @@ known-third-party = [ "requests", "six", ] -split-on-trailing-comma = false - +lint.isort.split-on-trailing-comma = false # from `.flake8` file -[tool.ruff.lint.mccabe] # Flag errors (`C901`) whenever the complexity level exceeds the configured value. -max-complexity = 7 - - -[tool.ruff.lint.per-file-ignores] -"tests/*" = [ - "S101", # Use of `assert` detected -] -"epo_ops/api.py" = [ - "A001", # Variable `range` is shadowing a Python builtin - "A002", # Argument `input` is shadowing a Python builtin - "C408", # Unnecessary `dict` call (rewrite as a literal) -] -# FIXME: Improve this situation wrt. SQL injection, even it is not be an actual attack vector. -"*sqlite.py" = [ - "S608", # Possible SQL injection vector through string-based query construction -] -"tests/middlewares/throttle/conftest.py" = [ - "S311", # Standard pseudo-random generators are not suitable for cryptographic purposes -] +lint.mccabe.max-complexity = 7 +[tool.pytest] +ini_options.minversion = "2.0" +ini_options.addopts = """ + -rsfEX -p pytester --strict-markers --verbosity=3 + --cov=epo_ops tests --cov-report=term-missing --cov-report=xml + """ +ini_options.log_level = "DEBUG" +ini_options.log_cli_level = "DEBUG" +ini_options.testpaths = [ "tests" ] +ini_options.xfail_strict = true +ini_options.markers = [] [tool.versioningit] vcs.method = "git-archive" diff --git a/setup.py b/setup.py index f89f5ff..c7851f0 100644 --- a/setup.py +++ b/setup.py @@ -37,6 +37,7 @@ ], extras_require={ "develop": [ + "pyproject-fmt<3", "ruff<0.16; python_version >= '3.7'", "twine<7", "wheel<1",