signalk-cli 2.2.0__tar.gz → 2.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- signalk_cli-2.2.0/README.md → signalk_cli-2.2.1/PKG-INFO +68 -9
- signalk_cli-2.2.0/PKG-INFO → signalk_cli-2.2.1/README.md +40 -37
- {signalk_cli-2.2.0 → signalk_cli-2.2.1}/pyproject.toml +28 -5
- {signalk_cli-2.2.0 → signalk_cli-2.2.1}/pyproject.toml.orig +27 -5
- {signalk_cli-2.2.0 → signalk_cli-2.2.1}/src/signalk_cli/history/cli.py +3 -1
- {signalk_cli-2.2.0 → signalk_cli-2.2.1}/src/signalk_cli/net.py +12 -1
- {signalk_cli-2.2.0 → signalk_cli-2.2.1}/src/signalk_cli/__init__.py +0 -0
- {signalk_cli-2.2.0 → signalk_cli-2.2.1}/src/signalk_cli/__main__.py +0 -0
- {signalk_cli-2.2.0 → signalk_cli-2.2.1}/src/signalk_cli/history/__init__.py +0 -0
- {signalk_cli-2.2.0 → signalk_cli-2.2.1}/src/signalk_cli/history/__main__.py +0 -0
- {signalk_cli-2.2.0 → signalk_cli-2.2.1}/src/signalk_cli/history/history_api.py +0 -0
- {signalk_cli-2.2.0 → signalk_cli-2.2.1}/src/signalk_cli/history/output.py +0 -0
- {signalk_cli-2.2.0 → signalk_cli-2.2.1}/src/signalk_cli/stream/__init__.py +0 -0
- {signalk_cli-2.2.0 → signalk_cli-2.2.1}/src/signalk_cli/stream/__main__.py +0 -0
- {signalk_cli-2.2.0 → signalk_cli-2.2.1}/src/signalk_cli/stream/cli.py +0 -0
- {signalk_cli-2.2.0 → signalk_cli-2.2.1}/src/signalk_cli/stream/output.py +0 -0
- {signalk_cli-2.2.0 → signalk_cli-2.2.1}/src/signalk_cli/stream/stream_api.py +0 -0
|
@@ -1,21 +1,67 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: signalk-cli
|
|
3
|
+
Version: 2.2.1
|
|
4
|
+
Summary: Query SignalK v2 APIs and export data as CSV, JSON or Apache Arrow Feather
|
|
5
|
+
Keywords: signalk,sailing,marine,nmea,boating
|
|
6
|
+
Author: jey burrows
|
|
7
|
+
Author-email: jey burrows <jrb@rhizomatics.org.uk>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Natural Language :: English
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering
|
|
14
|
+
Classifier: Programming Language :: Python
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Requires-Dist: click>=8.3.3
|
|
18
|
+
Requires-Dist: niquests[ws]>=2.28
|
|
19
|
+
Requires-Dist: zeroconf>=0.149.16,<0.152.0
|
|
20
|
+
Requires-Dist: pyarrow>=17.0 ; extra == 'feather'
|
|
21
|
+
Requires-Python: >=3.13
|
|
22
|
+
Project-URL: Homepage, https://signalk-cli.rhizomatics.org.uk
|
|
23
|
+
Project-URL: Repository, https://github.com/rhizomatics/signalk-cli
|
|
24
|
+
Project-URL: Issues, https://github.com/rhizomatics/signalk-cli/issues
|
|
25
|
+
Project-URL: Changelog, https://github.com/rhizomatics/signalk-cli/blob/main/CHANGELOG.md
|
|
26
|
+
Provides-Extra: feather
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
1
29
|
# SignalK CLI
|
|
2
30
|
|
|
31
|
+
[](https://github.com/rhizomatics)
|
|
32
|
+
|
|
33
|
+
[](https://pypi.org/project/signalk-cli/)
|
|
34
|
+
[](https://github.com/rhizomatics/signalk-cli)
|
|
35
|
+
[](https://signalk-cli.rhizomatics.org.uk/developer/coverage/)
|
|
36
|
+

|
|
37
|
+
[](https://results.pre-commit.ci/latest/github/rhizomatics/signalk-cli/main)
|
|
38
|
+
[](https://github.com/rhizomatics/signalk-cli/actions/workflows/pypi-publish.yml)
|
|
39
|
+
[](https://github.com/rhizomatics/signalk-cli/actions/workflows/python-package.yml)
|
|
40
|
+
[](https://github.com/rhizomatics/signalk-cli/actions/workflows/github-code-scanning/codeql)
|
|
41
|
+
[](https://github.com/rhizomatics/signalk-cli/actions/workflows/dependabot/dependabot-updates)
|
|
42
|
+
[](https://boat-tech-directory.rhizomatics.org.uk)
|
|
43
|
+
|
|
3
44
|
Query and explore NMEA and other boat data from SignalK APIs using the command line, and export data as CSV, Apache Arrow Feather, or JSON.
|
|
4
45
|
|
|
5
46
|
APIs supported:
|
|
6
47
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
48
|
+
### [SignalK v2 History API](https://demo.signalk.org/documentation/Developing/REST_APIs/History_API.html).
|
|
49
|
+
|
|
50
|
+
- Commands available:
|
|
51
|
+
- `list-paths`
|
|
52
|
+
- `list-providers`
|
|
53
|
+
- `list-contexts`
|
|
54
|
+
- `query`
|
|
55
|
+
- `cardinality`
|
|
56
|
+
|
|
57
|
+
### [SignalK v1 Streaming API](https://signalk.org/specification/1.8.2/doc/streaming_api.html).
|
|
58
|
+
|
|
59
|
+
- Commands available:
|
|
60
|
+
- `deltas`
|
|
15
61
|
|
|
16
62
|
## Installation
|
|
17
63
|
|
|
18
|
-
`signalk-cli` is published to PyPi
|
|
64
|
+
`signalk-cli` is published to [PyPi](https://pypi.org/project/signalk-cli/)
|
|
19
65
|
|
|
20
66
|
Python is required to run this, version 3.13 or above. [uv](https://docs.astral.sh/uv/) is the recommended way to install the package ( and can install Python ) but is not required.
|
|
21
67
|
|
|
@@ -25,6 +71,18 @@ Python is required to run this, version 3.13 or above. [uv](https://docs.astral.
|
|
|
25
71
|
|
|
26
72
|
For Apache Arrow Feather export, use the optional dependency: ```pip install 'signalk-cli[feather]'```
|
|
27
73
|
|
|
74
|
+
### Pyodide / slim install
|
|
75
|
+
|
|
76
|
+
`zeroconf` (used only for mDNS host discovery) can't run in Pyodide, and is optional at runtime. Install without dependencies and add the rest explicitly:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
import micropip
|
|
80
|
+
await micropip.install(["click", "niquests[ws]>=3.21.0"])
|
|
81
|
+
await micropip.install("signalk-cli", deps=False)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Without `zeroconf`, the host must be given with `--host` or `SIGNALK_HOST` (or come from the cache).
|
|
85
|
+
|
|
28
86
|
### Local Copy
|
|
29
87
|
|
|
30
88
|
Requires Python 3.13+ and [uv](https://docs.astral.sh/uv/).
|
|
@@ -90,6 +148,7 @@ python -m signalk_cli.history query [OPTIONS] PATH...
|
|
|
90
148
|
```
|
|
91
149
|
|
|
92
150
|
**PATH** arguments may be:
|
|
151
|
+
|
|
93
152
|
- **Literal paths** — e.g. `navigation.speedOverGround`
|
|
94
153
|
- **Regex / glob patterns** — any argument containing metacharacters (`*`, `.`, `[`, `(`, etc.) is matched against the server's `/paths` endpoint. Bare `*` is treated as a glob wildcard.
|
|
95
154
|
- **Inline path specs** — `path:method` or `path:method:param`, e.g. `navigation.speedOverGround:sma:5`. These pass through to the server unchanged.
|
|
@@ -1,49 +1,39 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: signalk-cli
|
|
3
|
-
Version: 2.2.0
|
|
4
|
-
Summary: Query SignalK v2 APIs and export data as CSV, JSON or Apache Arrow Feather
|
|
5
|
-
Keywords: signalk,sailing,marine,nmea,boating
|
|
6
|
-
Author: jey burrows
|
|
7
|
-
Author-email: jey burrows <jrb@rhizomatics.org.uk>
|
|
8
|
-
License-Expression: Apache-2.0
|
|
9
|
-
Classifier: Development Status :: 4 - Beta
|
|
10
|
-
Classifier: Environment :: Console
|
|
11
|
-
Classifier: Natural Language :: English
|
|
12
|
-
Classifier: Intended Audience :: Developers
|
|
13
|
-
Classifier: Topic :: Scientific/Engineering
|
|
14
|
-
Classifier: Programming Language :: Python
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
-
Requires-Dist: click>=8.3.3
|
|
18
|
-
Requires-Dist: niquests[ws]>=2.28
|
|
19
|
-
Requires-Dist: zeroconf>=0.149.16,<0.150.0
|
|
20
|
-
Requires-Dist: pyarrow>=17.0 ; extra == 'feather'
|
|
21
|
-
Requires-Python: >=3.13
|
|
22
|
-
Project-URL: Homepage, https://github.com/rhizomatics/signalk-cli
|
|
23
|
-
Project-URL: Repository, https://github.com/rhizomatics/signalk-cli
|
|
24
|
-
Project-URL: Issues, https://github.com/rhizomatics/signalk-cli/issues
|
|
25
|
-
Project-URL: Changelog, https://github.com/rhizomatics/signalk-cli/blob/main/CHANGELOG.md
|
|
26
|
-
Provides-Extra: feather
|
|
27
|
-
Description-Content-Type: text/markdown
|
|
28
|
-
|
|
29
1
|
# SignalK CLI
|
|
30
2
|
|
|
3
|
+
[](https://github.com/rhizomatics)
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/signalk-cli/)
|
|
6
|
+
[](https://github.com/rhizomatics/signalk-cli)
|
|
7
|
+
[](https://signalk-cli.rhizomatics.org.uk/developer/coverage/)
|
|
8
|
+

|
|
9
|
+
[](https://results.pre-commit.ci/latest/github/rhizomatics/signalk-cli/main)
|
|
10
|
+
[](https://github.com/rhizomatics/signalk-cli/actions/workflows/pypi-publish.yml)
|
|
11
|
+
[](https://github.com/rhizomatics/signalk-cli/actions/workflows/python-package.yml)
|
|
12
|
+
[](https://github.com/rhizomatics/signalk-cli/actions/workflows/github-code-scanning/codeql)
|
|
13
|
+
[](https://github.com/rhizomatics/signalk-cli/actions/workflows/dependabot/dependabot-updates)
|
|
14
|
+
[](https://boat-tech-directory.rhizomatics.org.uk)
|
|
15
|
+
|
|
31
16
|
Query and explore NMEA and other boat data from SignalK APIs using the command line, and export data as CSV, Apache Arrow Feather, or JSON.
|
|
32
17
|
|
|
33
18
|
APIs supported:
|
|
34
19
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
20
|
+
### [SignalK v2 History API](https://demo.signalk.org/documentation/Developing/REST_APIs/History_API.html).
|
|
21
|
+
|
|
22
|
+
- Commands available:
|
|
23
|
+
- `list-paths`
|
|
24
|
+
- `list-providers`
|
|
25
|
+
- `list-contexts`
|
|
26
|
+
- `query`
|
|
27
|
+
- `cardinality`
|
|
28
|
+
|
|
29
|
+
### [SignalK v1 Streaming API](https://signalk.org/specification/1.8.2/doc/streaming_api.html).
|
|
30
|
+
|
|
31
|
+
- Commands available:
|
|
32
|
+
- `deltas`
|
|
43
33
|
|
|
44
34
|
## Installation
|
|
45
35
|
|
|
46
|
-
`signalk-cli` is published to PyPi
|
|
36
|
+
`signalk-cli` is published to [PyPi](https://pypi.org/project/signalk-cli/)
|
|
47
37
|
|
|
48
38
|
Python is required to run this, version 3.13 or above. [uv](https://docs.astral.sh/uv/) is the recommended way to install the package ( and can install Python ) but is not required.
|
|
49
39
|
|
|
@@ -53,6 +43,18 @@ Python is required to run this, version 3.13 or above. [uv](https://docs.astral.
|
|
|
53
43
|
|
|
54
44
|
For Apache Arrow Feather export, use the optional dependency: ```pip install 'signalk-cli[feather]'```
|
|
55
45
|
|
|
46
|
+
### Pyodide / slim install
|
|
47
|
+
|
|
48
|
+
`zeroconf` (used only for mDNS host discovery) can't run in Pyodide, and is optional at runtime. Install without dependencies and add the rest explicitly:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
import micropip
|
|
52
|
+
await micropip.install(["click", "niquests[ws]>=3.21.0"])
|
|
53
|
+
await micropip.install("signalk-cli", deps=False)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Without `zeroconf`, the host must be given with `--host` or `SIGNALK_HOST` (or come from the cache).
|
|
57
|
+
|
|
56
58
|
### Local Copy
|
|
57
59
|
|
|
58
60
|
Requires Python 3.13+ and [uv](https://docs.astral.sh/uv/).
|
|
@@ -118,6 +120,7 @@ python -m signalk_cli.history query [OPTIONS] PATH...
|
|
|
118
120
|
```
|
|
119
121
|
|
|
120
122
|
**PATH** arguments may be:
|
|
123
|
+
|
|
121
124
|
- **Literal paths** — e.g. `navigation.speedOverGround`
|
|
122
125
|
- **Regex / glob patterns** — any argument containing metacharacters (`*`, `.`, `[`, `(`, etc.) is matched against the server's `/paths` endpoint. Bare `*` is treated as a glob wildcard.
|
|
123
126
|
- **Inline path specs** — `path:method` or `path:method:param`, e.g. `navigation.speedOverGround:sma:5`. These pass through to the server unchanged.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "signalk-cli"
|
|
3
|
-
version = "2.2.
|
|
3
|
+
version = "2.2.1"
|
|
4
4
|
description = "Query SignalK v2 APIs and export data as CSV, JSON or Apache Arrow Feather"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.13"
|
|
@@ -13,7 +13,7 @@ keywords = [
|
|
|
13
13
|
"boating",
|
|
14
14
|
]
|
|
15
15
|
classifiers = [
|
|
16
|
-
"Development Status ::
|
|
16
|
+
"Development Status :: 5 - Production/Stable",
|
|
17
17
|
"Environment :: Console",
|
|
18
18
|
"Natural Language :: English",
|
|
19
19
|
"Intended Audience :: Developers",
|
|
@@ -25,7 +25,7 @@ classifiers = [
|
|
|
25
25
|
dependencies = [
|
|
26
26
|
"click>=8.3.3",
|
|
27
27
|
"niquests[ws]>=2.28",
|
|
28
|
-
"zeroconf>=0.149.16,<0.
|
|
28
|
+
"zeroconf>=0.149.16,<0.152.0",
|
|
29
29
|
]
|
|
30
30
|
|
|
31
31
|
[[project.authors]]
|
|
@@ -36,7 +36,7 @@ email = "jrb@rhizomatics.org.uk"
|
|
|
36
36
|
feather = ["pyarrow>=17.0"]
|
|
37
37
|
|
|
38
38
|
[project.urls]
|
|
39
|
-
Homepage = "https://
|
|
39
|
+
Homepage = "https://signalk-cli.rhizomatics.org.uk"
|
|
40
40
|
Repository = "https://github.com/rhizomatics/signalk-cli"
|
|
41
41
|
Issues = "https://github.com/rhizomatics/signalk-cli/issues"
|
|
42
42
|
Changelog = "https://github.com/rhizomatics/signalk-cli/blob/main/CHANGELOG.md"
|
|
@@ -55,9 +55,23 @@ dev = [
|
|
|
55
55
|
"pytest-xdist",
|
|
56
56
|
"mypy",
|
|
57
57
|
"coverage",
|
|
58
|
+
"genbadge[all]",
|
|
58
59
|
"icdiff",
|
|
59
60
|
"codespell",
|
|
60
61
|
]
|
|
62
|
+
docs = [
|
|
63
|
+
"properdocs",
|
|
64
|
+
"mkdocs-materialx[imaging]",
|
|
65
|
+
"mkdocs-minify-plugin",
|
|
66
|
+
"mkdocs-autorefs",
|
|
67
|
+
"mkdocs-pagetree-plugin",
|
|
68
|
+
"mkdocs-coverage",
|
|
69
|
+
"pymdown-extensions",
|
|
70
|
+
"mkdocs-meta-descriptions-plugin",
|
|
71
|
+
"pngquant",
|
|
72
|
+
"mkdocs-htmlproofer-plugin",
|
|
73
|
+
"mkdocs-llmstxt>=0.5.0,<0.6.0",
|
|
74
|
+
]
|
|
61
75
|
|
|
62
76
|
[tool.bandit]
|
|
63
77
|
exclude_dirs = ["tests"]
|
|
@@ -73,7 +87,6 @@ pythonpath = [
|
|
|
73
87
|
"src",
|
|
74
88
|
".",
|
|
75
89
|
]
|
|
76
|
-
asyncio_mode = "auto"
|
|
77
90
|
testpaths = ["tests"]
|
|
78
91
|
norecursedirs = [".git"]
|
|
79
92
|
|
|
@@ -99,6 +112,16 @@ ignore-words-list = "hass,referer,uint"
|
|
|
99
112
|
[tool.mypy]
|
|
100
113
|
mypy_path = ["./src"]
|
|
101
114
|
|
|
115
|
+
[[tool.mypy.overrides]]
|
|
116
|
+
module = "pyarrow.*"
|
|
117
|
+
ignore_missing_imports = true
|
|
118
|
+
|
|
119
|
+
[tool.ty.analysis]
|
|
120
|
+
allowed-unresolved-imports = [
|
|
121
|
+
"pyarrow",
|
|
122
|
+
"pyarrow.**",
|
|
123
|
+
]
|
|
124
|
+
|
|
102
125
|
[tool.uv]
|
|
103
126
|
compile-bytecode = true
|
|
104
127
|
managed = true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "signalk-cli"
|
|
3
|
-
version = "2.2.
|
|
3
|
+
version = "2.2.1"
|
|
4
4
|
description = "Query SignalK v2 APIs and export data as CSV, JSON or Apache Arrow Feather"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.13"
|
|
@@ -11,7 +11,7 @@ authors = [
|
|
|
11
11
|
|
|
12
12
|
keywords = ["signalk", "sailing", "marine", "nmea","boating"]
|
|
13
13
|
classifiers = [
|
|
14
|
-
"Development Status ::
|
|
14
|
+
"Development Status :: 5 - Production/Stable",
|
|
15
15
|
"Environment :: Console",
|
|
16
16
|
"Natural Language :: English",
|
|
17
17
|
"Intended Audience :: Developers",
|
|
@@ -24,7 +24,7 @@ classifiers = [
|
|
|
24
24
|
dependencies = [
|
|
25
25
|
"click>=8.3.3",
|
|
26
26
|
"niquests[ws]>=2.28",
|
|
27
|
-
"zeroconf>=0.149.16,<0.
|
|
27
|
+
"zeroconf>=0.149.16,<0.152.0",
|
|
28
28
|
]
|
|
29
29
|
|
|
30
30
|
[project.optional-dependencies]
|
|
@@ -39,12 +39,27 @@ dev = [
|
|
|
39
39
|
"pytest-xdist",
|
|
40
40
|
"mypy",
|
|
41
41
|
"coverage",
|
|
42
|
+
"genbadge[all]",
|
|
42
43
|
"icdiff",
|
|
43
44
|
"codespell"
|
|
44
45
|
]
|
|
45
46
|
|
|
47
|
+
docs=[
|
|
48
|
+
"properdocs",
|
|
49
|
+
"mkdocs-materialx[imaging]",
|
|
50
|
+
"mkdocs-minify-plugin",
|
|
51
|
+
"mkdocs-autorefs",
|
|
52
|
+
"mkdocs-pagetree-plugin",
|
|
53
|
+
"mkdocs-coverage",
|
|
54
|
+
"pymdown-extensions",
|
|
55
|
+
"mkdocs-meta-descriptions-plugin",
|
|
56
|
+
"pngquant",
|
|
57
|
+
"mkdocs-htmlproofer-plugin",
|
|
58
|
+
"mkdocs-llmstxt>=0.5.0,<0.6.0",
|
|
59
|
+
]
|
|
60
|
+
|
|
46
61
|
[project.urls]
|
|
47
|
-
Homepage = "https://
|
|
62
|
+
Homepage = "https://signalk-cli.rhizomatics.org.uk"
|
|
48
63
|
Repository = "https://github.com/rhizomatics/signalk-cli"
|
|
49
64
|
Issues="https://github.com/rhizomatics/signalk-cli/issues"
|
|
50
65
|
Changelog="https://github.com/rhizomatics/signalk-cli/blob/main/CHANGELOG.md"
|
|
@@ -67,7 +82,6 @@ line-ending = "auto"
|
|
|
67
82
|
|
|
68
83
|
[tool.pytest.ini_options]
|
|
69
84
|
pythonpath = ["src", "."]
|
|
70
|
-
asyncio_mode = "auto"
|
|
71
85
|
testpaths = [
|
|
72
86
|
"tests",
|
|
73
87
|
]
|
|
@@ -98,6 +112,14 @@ ignore-words-list="hass,referer,uint"
|
|
|
98
112
|
[tool.mypy]
|
|
99
113
|
mypy_path=["./src"]
|
|
100
114
|
|
|
115
|
+
[[tool.mypy.overrides]]
|
|
116
|
+
module = "pyarrow.*"
|
|
117
|
+
ignore_missing_imports = true
|
|
118
|
+
|
|
119
|
+
[tool.ty.analysis]
|
|
120
|
+
# optional `feather` extra
|
|
121
|
+
allowed-unresolved-imports = ["pyarrow", "pyarrow.**"]
|
|
122
|
+
|
|
101
123
|
[tool.uv]
|
|
102
124
|
compile-bytecode = true
|
|
103
125
|
managed = true
|
|
@@ -396,7 +396,9 @@ def query(
|
|
|
396
396
|
)
|
|
397
397
|
|
|
398
398
|
elif fmt == "raw":
|
|
399
|
-
raw_text =
|
|
399
|
+
raw_text = (
|
|
400
|
+
json.dumps(resp.json(), indent=indent) if pretty else (resp.text or "")
|
|
401
|
+
)
|
|
400
402
|
fh = _open_sink()
|
|
401
403
|
try:
|
|
402
404
|
(fh or sys.stdout).write(raw_text)
|
|
@@ -7,7 +7,11 @@ from pathlib import Path
|
|
|
7
7
|
|
|
8
8
|
import click
|
|
9
9
|
import niquests
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
from zeroconf import ServiceBrowser, ServiceStateChange, Zeroconf
|
|
13
|
+
except ImportError: # slim/Pyodide installs ship without zeroconf
|
|
14
|
+
Zeroconf = None # type: ignore[assignment,misc]
|
|
11
15
|
|
|
12
16
|
CACHE_DIR = Path.home() / ".cache" / "signalk-cli"
|
|
13
17
|
_SIGNALK_TYPE = "_signalk-ws._tcp.local."
|
|
@@ -33,6 +37,8 @@ def save_cached_host(host: str) -> None:
|
|
|
33
37
|
|
|
34
38
|
def discover_host(timeout: float = 5.0) -> str | None:
|
|
35
39
|
"""Browse mDNS for a SignalK server and return its base URL, or None."""
|
|
40
|
+
if Zeroconf is None:
|
|
41
|
+
return None
|
|
36
42
|
found: list[str] = []
|
|
37
43
|
|
|
38
44
|
def _on_change(
|
|
@@ -119,6 +125,11 @@ def resolve_host(host: str | None, no_cache: bool = False) -> str:
|
|
|
119
125
|
if cached:
|
|
120
126
|
click.echo(f"Using cached host: {cached}", err=True)
|
|
121
127
|
return cached
|
|
128
|
+
if Zeroconf is None:
|
|
129
|
+
raise click.UsageError(
|
|
130
|
+
"No host specified and mDNS discovery unavailable (zeroconf not "
|
|
131
|
+
"installed). Use --host or set SIGNALK_HOST."
|
|
132
|
+
)
|
|
122
133
|
click.echo("No host specified — searching for SignalK via mDNS...", err=True)
|
|
123
134
|
discovered = discover_host()
|
|
124
135
|
if not discovered:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|