Skip to content

Commit 4beff22

Browse files
sdb9696rytilahti
andauthored
Enable shell extra for installing ptpython and rich (python-kasa#782)
Co-authored-by: Teemu R. <[email protected]>
1 parent 5ba3676 commit 4beff22

File tree

5 files changed

+130
-10
lines changed

5 files changed

+130
-10
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,16 @@ jobs:
8888
- uses: "actions/setup-python@v4"
8989
with:
9090
python-version: "${{ matrix.python-version }}"
91-
- name: "Install dependencies (no speedups)"
91+
- name: "Install dependencies (no extras)"
9292
if: matrix.extras == false
9393
run: |
9494
python -m pip install --upgrade pip poetry
9595
poetry install
96-
- name: "Install dependencies (with speedups)"
96+
- name: "Install dependencies (with extras)"
9797
if: matrix.extras == true
9898
run: |
9999
python -m pip install --upgrade pip poetry
100-
poetry install --extras speedups
100+
poetry install --all-extras
101101
- name: "Run tests"
102102
run: |
103103
poetry run pytest --cov kasa --cov-report xml

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,19 @@ You can install the most recent release using pip:
2020
pip install python-kasa
2121
```
2222

23+
For enhanced cli tool support (coloring, embedded shell) install with `[shell]`:
24+
```
25+
pip install python-kasa[shell]
26+
```
27+
2328
If you are using cpython, it is recommended to install with `[speedups]` to enable orjson (faster json support):
2429
```
2530
pip install python-kasa[speedups]
2631
```
27-
32+
or for both:
33+
```
34+
pip install python-kasa[speedups, shell]
35+
```
2836
With `[speedups]`, the protocol overhead is roughly an order of magnitude lower (benchmarks available in devtools).
2937

3038
Alternatively, you can clone this repository and use poetry to install the development version:

kasa/tests/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ async def test_errors(mocker):
647647
assert res.exit_code == 1
648648
assert (
649649
"Raised error: Managed to invoke callback without a context object of type 'Device' existing."
650-
in res.output
650+
in res.output.replace("\n", "") # Remove newlines from rich formatting
651651
)
652652
assert isinstance(res.exception, SystemExit)
653653

poetry.lock

Lines changed: 113 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ sphinxcontrib-programoutput = { version = "^0", optional = true }
4040
myst-parser = { version = "*", optional = true }
4141
docutils = { version = ">=0.17", optional = true }
4242

43-
# shell support
44-
# ptpython = { version = "*", optional = true }
43+
# enhanced cli support
44+
ptpython = { version = "*", optional = true }
45+
rich = { version = "*", optional = true }
4546

4647
[tool.poetry.group.dev.dependencies]
4748
pytest = "*"
@@ -60,7 +61,7 @@ coverage = {version = "*", extras = ["toml"]}
6061
[tool.poetry.extras]
6162
docs = ["sphinx", "sphinx_rtd_theme", "sphinxcontrib-programoutput", "myst-parser", "docutils"]
6263
speedups = ["orjson", "kasa-crypt"]
63-
# shell = ["ptpython"]
64+
shell = ["ptpython", "rich"]
6465

6566
[tool.coverage.run]
6667
source = ["kasa"]

0 commit comments

Comments
 (0)