Skip to content

Commit

Permalink
chore: Make httpx dependency optional
Browse files Browse the repository at this point in the history
The usecase for the http powersupply is very rare. Maybe we will remove
that entirely in the future once we have ported
[this](https://github.com/rumpelsepp/opennetzteil/blob/master/devices/rnd/rnd320.go)
to gallia.
  • Loading branch information
rumpelsepp committed Sep 24, 2024
1 parent 9ac4975 commit 272c77f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
15 changes: 9 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ msgspec = ">=0.11,<0.19"
pydantic = "^2.0"
platformdirs = ">=2.6,<5.0"
psutil = ">=5.9.4,<7.0.0"
httpx = ">=0.26,<0.28"
httpx = { version = ">=0.26,<0.28", optional = true }
more-itertools = "^10.3.0"

[tool.poetry.extras]
http-powersupply = ["httpx"]

[tool.poetry.group.dev.dependencies]
Sphinx = ">=5.2,<8.0"
mypy = "^1.0"
Expand Down
10 changes: 8 additions & 2 deletions src/opennetzteil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
#
# SPDX-License-Identifier: Apache-2.0

from opennetzteil.devices.http.client import HTTPNetzteil
from opennetzteil.devices.rs.hmc804 import HMC804
from opennetzteil.netzteil import BaseNetzteil

netzteile: list[type[BaseNetzteil]] = [HTTPNetzteil, HMC804]
netzteile: list[type[BaseNetzteil]] = [HMC804]

try:
from opennetzteil.devices.http.client import HTTPNetzteil

netzteile.append(HTTPNetzteil)
except ImportError:
pass

0 comments on commit 272c77f

Please sign in to comment.