diff --git a/NEWS.rst b/NEWS.rst index 1668ad04bb5a24067b3b979e61b779f4b6d72fe4_TkVXUy5yc3Q=..4fb82a9fdbd2bb5929359d0ce1d642a4deba03b2_TkVXUy5yc3Q= 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -7,6 +7,8 @@ Declare compatibility with changes in converter 18.0.6.0.0. +requests_unixsocket is now an optional dependency, only needed when connecting to redner on a unix socket. + 18.0.1.5.0 ---------- diff --git a/__manifest__.py b/__manifest__.py index 1668ad04bb5a24067b3b979e61b779f4b6d72fe4_X19tYW5pZmVzdF9fLnB5..4fb82a9fdbd2bb5929359d0ce1d642a4deba03b2_X19tYW5pZmVzdF9fLnB5 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -44,6 +44,5 @@ ], }, "installable": True, - "external_dependencies": {"python": ["requests_unixsocket"]}, "images": ["static/description/thumbnail.png"], } diff --git a/pyproject.toml b/pyproject.toml index 1668ad04bb5a24067b3b979e61b779f4b6d72fe4_cHlwcm9qZWN0LnRvbWw=..4fb82a9fdbd2bb5929359d0ce1d642a4deba03b2_cHlwcm9qZWN0LnRvbWw= 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,10 +16,6 @@ "Framework :: Odoo :: 18.0", "License :: OSI Approved :: GNU Affero General Public License v3", ] -dependencies = [ - "odoo==18.0.*", - "requests_unixsocket", - "odoo-addon-converter >=18.0.4,<18.0.7", -] +dependencies = ["odoo==18.0.*", "odoo-addon-converter >=18.0.4,<18.0.7"] [project.optional-dependencies] @@ -24,5 +20,6 @@ [project.optional-dependencies] +unixsocket = ["requests_unixsocket"] doc = ["sphinx"] test = [] diff --git a/redner.py b/redner.py index 1668ad04bb5a24067b3b979e61b779f4b6d72fe4_cmVkbmVyLnB5..4fb82a9fdbd2bb5929359d0ce1d642a4deba03b2_cmVkbmVyLnB5 100644 --- a/redner.py +++ b/redner.py @@ -23,7 +23,6 @@ from urllib.parse import quote import requests -import requests_unixsocket # type: ignore[import-untyped] from odoo import _ # type: ignore[import-untyped] from odoo.exceptions import ValidationError # type: ignore[import-untyped] @@ -48,6 +47,9 @@ self.timeout = timeout if server_url.startswith("/"): + # import here as this is an optional requirement + import requests_unixsocket # type: ignore[import-untyped] + self.session = requests_unixsocket.Session() self.server_url = "http+unix://{}/".format(quote(server_url, safe="")) else: