Skip to content

Commit fd733d1

Browse files
authored
Bump pye3dc from 0.9.3 to 0.10.0 (#26)
* Bump pye3dc from 0.9.3 to 0.10.0 * Remove github test running with python 3.9 * lint: Remove typing Optional Used X | None instead (new standard for python 3.10+)
1 parent 2df9b50 commit fd733d1

7 files changed

Lines changed: 24 additions & 27 deletions

File tree

.github/workflows/python-pdm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
17+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
1818
os: [ubuntu-latest, macOS-latest, windows-latest]
1919

2020
steps:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Changes can be followed at [CHANGELOG.md](https://github.com/waldbaer/e3dc-cli/b
4040

4141
## Requirements ##
4242

43-
- [Python 3.9](https://www.python.org/)
43+
- [Python 3.10](https://www.python.org/)
4444
- [pip](https://pip.pypa.io/) or [pipx](https://pipx.pypa.io/stable/)
4545

4646
For development:

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ authors = [{ name = "Sebastian Waldvogel", email = "sebastian@waldvogels.de" }]
66
license = { text = "MIT" }
77
readme = "README.md"
88

9-
requires-python = ">=3.9"
9+
requires-python = ">=3.10"
1010
dependencies = [
11-
"pye3dc==0.9.3",
11+
"pye3dc==0.10.0",
1212
"tzlocal==5.3.1",
1313
"jsonargparse==4.42.0",
1414
"rich-argparse==1.7.2",

src/e3dc_cli/argparse.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# ---- Imports ----
44
import sys
5-
from typing import Any, Dict, List, Optional
5+
from typing import Any, Dict, List
66

77
from jsonargparse import ArgumentParser, DefaultHelpFormatter
88
from pydantic import SecretStr
@@ -86,7 +86,7 @@ def parse_config(prog: str, version: str, copy_right: str, author: str, arg_list
8686
arg_parser.add_argument(
8787
"-o",
8888
"--output",
89-
type=Optional[str],
89+
type=str | None,
9090
help="Path of JSON output file. If not set JSON output is written to console / stdout",
9191
)
9292

@@ -103,7 +103,7 @@ def parse_config(prog: str, version: str, copy_right: str, author: str, arg_list
103103
)
104104
arg_parser.add_argument(
105105
"--connection.address",
106-
type=Optional[str],
106+
type=str | None,
107107
help="""IP or DNS address of the E3/DC system.
108108
Only relevant for connection type 'local'.
109109
""",
@@ -120,14 +120,14 @@ def parse_config(prog: str, version: str, copy_right: str, author: str, arg_list
120120
)
121121
arg_parser.add_argument(
122122
"--connection.rscp_password",
123-
type=Optional[SecretStr],
123+
type=SecretStr | None,
124124
help="""RSCP password. Set on the device via Main Page -> Personalize -> User profile -> RSCP password.
125125
Only relevant for connection type 'local',
126126
""",
127127
)
128128
arg_parser.add_argument(
129129
"--connection.serial_number",
130-
type=Optional[SecretStr],
130+
type=SecretStr | None,
131131
help="""Serial number of the system (see 'SN' in E3/DC portal).
132132
Only relevant for connection type 'web'.
133133
""",
@@ -168,7 +168,7 @@ def parse_config(prog: str, version: str, copy_right: str, author: str, arg_list
168168
# ---- Setter ----
169169
arg_parser.add_argument(
170170
"--set.power_limits.enable",
171-
type=Optional[bool],
171+
type=bool | None,
172172
metavar="{true,false}",
173173
help="""true: enable manual SmartPower limits. false: Use automatic mode.
174174
Automatically set to 'true' if not explicitly set and any other manual limit
@@ -177,23 +177,23 @@ def parse_config(prog: str, version: str, copy_right: str, author: str, arg_list
177177
)
178178
arg_parser.add_argument(
179179
"--set.power_limits.max_charge",
180-
type=Optional[int],
180+
type=int | None,
181181
help="""SmartPower maximum charging power. Unit: Watt.
182182
Automatically set to the systems max. battery charge power limit if not explicitly set.
183183
Only relevant if set.power_limits.enable is 'true' or not explicitly configured.
184184
""",
185185
)
186186
arg_parser.add_argument(
187187
"--set.power_limits.max_discharge",
188-
type=Optional[int],
188+
type=int | None,
189189
help="""SmartPower maximum discharging power. Unit: Watt.
190190
Automatically set to the systems max. battery discharge power limit if not explicitly set.
191191
Only relevant if set.power_limits.enable is 'true' or not explicitly configured.
192192
""",
193193
)
194194
arg_parser.add_argument(
195195
"--set.power_limits.discharge_start",
196-
type=Optional[int],
196+
type=int | None,
197197
help="""SmartPower lower charge / discharge threshold. Unit: Watt.
198198
Automatically set to the systems discharge default threshold if not explicitly set.
199199
Only relevant if set.power_limits.enable is 'true' or not explicitly configured.
@@ -202,13 +202,13 @@ def parse_config(prog: str, version: str, copy_right: str, author: str, arg_list
202202

203203
arg_parser.add_argument(
204204
"--set.powersave",
205-
type=Optional[bool],
205+
type=bool | None,
206206
metavar="{true,false}",
207207
help="Enable / Disable PowerSave of the inverter (inverter switches to standby mode when not in use).",
208208
)
209209
arg_parser.add_argument(
210210
"--set.weather_regulated_charge",
211-
type=Optional[bool],
211+
type=bool | None,
212212
metavar="{true,false}",
213213
help="Enabled / Disable optimized charging based on the weather forecast.",
214214
)

tests/test_queries.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import os
44
import re
5-
from typing import Optional
65

76
import pytest
87
from pytest_mock.plugin import MockerFixture
@@ -223,7 +222,7 @@ def test_ct_query_single(
223222
@pytest.mark.parametrize("connection_type", [ConnectionType.local, ConnectionType.web])
224223
@pytest.mark.parametrize("output_file", [None, "e3dc_cli_test.json"])
225224
def test_ct_query_multi(
226-
connection_type: ConnectionType, output_file: Optional[str], tmp_path: str, capsys: pytest.CaptureFixture[str]
225+
connection_type: ConnectionType, output_file: str | None, tmp_path: str, capsys: pytest.CaptureFixture[str]
227226
) -> None:
228227
"""Test the --query option for multiple queries.
229228

tests/test_setter.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Test of setter commands."""
22

3-
from typing import Optional
4-
53
import pytest
64

75
from e3dc_cli import setter
@@ -125,7 +123,7 @@ def test_ct_setter_boolean(
125123
],
126124
)
127125
def test_ct_setter_power_limits(
128-
enable: Optional[bool],
126+
enable: bool | None,
129127
expected_enable: bool,
130128
max_charge: int,
131129
max_discharge: int,

tests/util_runner.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import shlex
66
from ast import Dict
77
from dataclasses import dataclass
8-
from typing import List, Optional
8+
from typing import List
99

1010
import pytest
1111

@@ -22,21 +22,21 @@ class CliResult:
2222
stdout: str
2323
stderr: str
2424
stdout_lines: List[str]
25-
stdout_as_json: Optional[dict]
25+
stdout_as_json: dict | None
2626
fileout: str
2727
fileout_lines: List[str]
28-
fileout_as_json: Optional[dict]
28+
fileout_as_json: dict | None
2929

3030
def __init__(
3131
self,
3232
exit_code: int,
3333
stdout: str,
3434
stderr: str,
3535
stdout_lines: List[str],
36-
stdout_as_json: Optional[dict] = None,
36+
stdout_as_json: dict | None = None,
3737
fileout: str = None,
3838
fileout_lines: List[str] = None,
39-
fileout_as_json: Optional[dict] = None,
39+
fileout_as_json: dict | None = None,
4040
) -> None:
4141
"""Construct.
4242
@@ -60,7 +60,7 @@ def __init__(
6060
self.fileout_as_json = fileout_as_json
6161

6262

63-
def run_cli(cli_args: str, capsys: pytest.CaptureFixture, output_path: Optional[str] = None) -> CliResult:
63+
def run_cli(cli_args: str, capsys: pytest.CaptureFixture, output_path: str | None = None) -> CliResult:
6464
"""Run the command line util with the passed arguments.
6565
6666
Arguments:
@@ -87,7 +87,7 @@ def run_cli(cli_args: str, capsys: pytest.CaptureFixture, output_path: Optional[
8787
)
8888

8989

90-
def run_cli_json(cli_args: str, capsys: pytest.CaptureFixture, output_path: Optional[str] = None) -> Dict:
90+
def run_cli_json(cli_args: str, capsys: pytest.CaptureFixture, output_path: str | None = None) -> Dict:
9191
"""Run the command line util with the passed arguments and capture the outputs from a JSON file.
9292
9393
Arguments:

0 commit comments

Comments
 (0)