metta-websocket 0.9.2__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.
- metta_websocket-0.9.2/PKG-INFO +32 -0
- metta_websocket-0.9.2/README.md +19 -0
- metta_websocket-0.9.2/metta_websocket.egg-info/PKG-INFO +32 -0
- metta_websocket-0.9.2/metta_websocket.egg-info/SOURCES.txt +10 -0
- metta_websocket-0.9.2/metta_websocket.egg-info/dependency_links.txt +1 -0
- metta_websocket-0.9.2/metta_websocket.egg-info/entry_points.txt +2 -0
- metta_websocket-0.9.2/metta_websocket.egg-info/requires.txt +2 -0
- metta_websocket-0.9.2/metta_websocket.egg-info/top_level.txt +1 -0
- metta_websocket-0.9.2/metta_websocket.py +42 -0
- metta_websocket-0.9.2/pyproject.toml +40 -0
- metta_websocket-0.9.2/setup.cfg +4 -0
- metta_websocket-0.9.2/tests/test_websocket.py +42 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: metta-websocket
|
|
3
|
+
Version: 0.9.2
|
|
4
|
+
Summary: websocket-client's own timeouts, so an absent MeTTa backend reads as absent
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Classifier: Development Status :: 3 - Alpha
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Intended Audience :: Science/Research
|
|
9
|
+
Requires-Python: >=3.12
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: pymetta==0.9.2
|
|
12
|
+
Requires-Dist: websocket-client
|
|
13
|
+
|
|
14
|
+
# metta-websocket
|
|
15
|
+
|
|
16
|
+
websocket-client's own timeouts, so an absent MeTTa backend reads as absent.
|
|
17
|
+
|
|
18
|
+
`pymetta` names no third-party library. This package is one row against the `transport-error` point, and the seat
|
|
19
|
+
finds it exactly as it finds a package written by somebody else: through the
|
|
20
|
+
`metta.extensions` entry point, loaded at the first dispatch that has no answer
|
|
21
|
+
without it, or through `import metta_websocket`, whose module body registers the same
|
|
22
|
+
rows.
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
pip install metta-websocket # or: pip install 'pymetta[das]'
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Its tests are in `tests/`, and they run in the workspace suite:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
sh extensions/python/test.sh ext/metta-websocket
|
|
32
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# metta-websocket
|
|
2
|
+
|
|
3
|
+
websocket-client's own timeouts, so an absent MeTTa backend reads as absent.
|
|
4
|
+
|
|
5
|
+
`pymetta` names no third-party library. This package is one row against the `transport-error` point, and the seat
|
|
6
|
+
finds it exactly as it finds a package written by somebody else: through the
|
|
7
|
+
`metta.extensions` entry point, loaded at the first dispatch that has no answer
|
|
8
|
+
without it, or through `import metta_websocket`, whose module body registers the same
|
|
9
|
+
rows.
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pip install metta-websocket # or: pip install 'pymetta[das]'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Its tests are in `tests/`, and they run in the workspace suite:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
sh extensions/python/test.sh ext/metta-websocket
|
|
19
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: metta-websocket
|
|
3
|
+
Version: 0.9.2
|
|
4
|
+
Summary: websocket-client's own timeouts, so an absent MeTTa backend reads as absent
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Classifier: Development Status :: 3 - Alpha
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Intended Audience :: Science/Research
|
|
9
|
+
Requires-Python: >=3.12
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: pymetta==0.9.2
|
|
12
|
+
Requires-Dist: websocket-client
|
|
13
|
+
|
|
14
|
+
# metta-websocket
|
|
15
|
+
|
|
16
|
+
websocket-client's own timeouts, so an absent MeTTa backend reads as absent.
|
|
17
|
+
|
|
18
|
+
`pymetta` names no third-party library. This package is one row against the `transport-error` point, and the seat
|
|
19
|
+
finds it exactly as it finds a package written by somebody else: through the
|
|
20
|
+
`metta.extensions` entry point, loaded at the first dispatch that has no answer
|
|
21
|
+
without it, or through `import metta_websocket`, whose module body registers the same
|
|
22
|
+
rows.
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
pip install metta-websocket # or: pip install 'pymetta[das]'
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Its tests are in `tests/`, and they run in the workspace suite:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
sh extensions/python/test.sh ext/metta-websocket
|
|
32
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
metta_websocket.py
|
|
3
|
+
pyproject.toml
|
|
4
|
+
metta_websocket.egg-info/PKG-INFO
|
|
5
|
+
metta_websocket.egg-info/SOURCES.txt
|
|
6
|
+
metta_websocket.egg-info/dependency_links.txt
|
|
7
|
+
metta_websocket.egg-info/entry_points.txt
|
|
8
|
+
metta_websocket.egg-info/requires.txt
|
|
9
|
+
metta_websocket.egg-info/top_level.txt
|
|
10
|
+
tests/test_websocket.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
metta_websocket
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Purpose: websocket-client's own timeouts, so an absent backend reads as absent.
|
|
2
|
+
|
|
3
|
+
`metta._errors.errors.is_transport_failure` asks whether a failure means the backend is
|
|
4
|
+
ABSENT rather than wrong, which decides whether a client retries or reports.
|
|
5
|
+
The obvious test does not separate them: a socket timeout raises OSError, but
|
|
6
|
+
websocket-client's own timeout does NOT subclass it, so "is the cause an
|
|
7
|
+
OSError" misses exactly the shape a broken event stream takes under load. One
|
|
8
|
+
row against the seat's `transport-error` point says which classes those are.
|
|
9
|
+
|
|
10
|
+
Installed beside pymetta, or through `pip install 'pymetta[das]'`. The row
|
|
11
|
+
holds the module NAME and imports nothing; the classes are read only when a
|
|
12
|
+
failure is actually classified, and only if websocket-client is imported.
|
|
13
|
+
|
|
14
|
+
Assumes:
|
|
15
|
+
- the two exception classes keep their names, which is the only thing this
|
|
16
|
+
row knows about the library
|
|
17
|
+
Guarantees:
|
|
18
|
+
- a websocket timeout and a closed stream both read as transport failures,
|
|
19
|
+
and an ordinary application error does not [tested: tests/test_websocket.py;
|
|
20
|
+
commit=94057a0f073c0fab0a35c42beff2c324d8a0addd]
|
|
21
|
+
Open Obligations:
|
|
22
|
+
To Do: None
|
|
23
|
+
Hacks: None
|
|
24
|
+
Future Enhancements: None
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
from __future__ import annotations
|
|
28
|
+
|
|
29
|
+
from metta import seam
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _classes(module) -> tuple[type[BaseException], ...]:
|
|
33
|
+
"""websocket-client's own timeout and closed-stream exceptions."""
|
|
34
|
+
return (module.WebSocketTimeoutException, module.WebSocketConnectionClosedException)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def register() -> None:
|
|
38
|
+
"""This package's one row, against the seat's `transport-error` point."""
|
|
39
|
+
seam.transport_error.register("websocket", module="websocket", classes=_classes)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
register()
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Purpose: package metta-websocket, one distribution for one library.
|
|
2
|
+
# Assumes: pymetta of the same version is installed; this is a workspace member
|
|
3
|
+
# released with it and pinned to it exactly.
|
|
4
|
+
# Guarantees: importing metta_websocket registers this package's rows, and so does the
|
|
5
|
+
# `metta.extensions` entry point below when a dispatch discovers it.
|
|
6
|
+
# Decides: the dependency set is this library and nothing else, which is what
|
|
7
|
+
# makes "the core names no library" hold without an allowlist.
|
|
8
|
+
[build-system]
|
|
9
|
+
requires = ["setuptools>=83"]
|
|
10
|
+
build-backend = "setuptools.build_meta"
|
|
11
|
+
|
|
12
|
+
[project]
|
|
13
|
+
name = "metta-websocket"
|
|
14
|
+
version = "0.9.2"
|
|
15
|
+
description = "websocket-client's own timeouts, so an absent MeTTa backend reads as absent"
|
|
16
|
+
readme = "README.md"
|
|
17
|
+
requires-python = ">=3.12"
|
|
18
|
+
license = "MIT"
|
|
19
|
+
dependencies = [
|
|
20
|
+
#: pymetta of exactly this version. A member is released with the core and
|
|
21
|
+
#: reads its seam, so a floating pin would let a row meet a seam that no
|
|
22
|
+
#: longer declares its point.
|
|
23
|
+
"pymetta==0.9.2",
|
|
24
|
+
"websocket-client",
|
|
25
|
+
]
|
|
26
|
+
classifiers = [
|
|
27
|
+
"Development Status :: 3 - Alpha",
|
|
28
|
+
"Programming Language :: Python :: 3",
|
|
29
|
+
"Intended Audience :: Science/Research",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
#: How a seat that never heard of this package finds it: one entry in the
|
|
33
|
+
#: group `metta.seam` reads, loaded at the first dispatch that has no answer
|
|
34
|
+
#: without it. The target is the MODULE, whose body registers on import, which
|
|
35
|
+
#: is the same door `import metta_websocket` opens.
|
|
36
|
+
[project.entry-points."metta.extensions"]
|
|
37
|
+
metta-websocket = "metta_websocket"
|
|
38
|
+
|
|
39
|
+
[tool.setuptools]
|
|
40
|
+
py-modules = ["metta_websocket"]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Purpose: prove the websocket row classes an absent backend as absent.
|
|
2
|
+
|
|
3
|
+
`is_transport_failure` decides whether a client retries or reports. The library
|
|
4
|
+
this package names raises a timeout that does NOT subclass OSError, which is
|
|
5
|
+
the shape the obvious test misses and the whole reason for the row.
|
|
6
|
+
Open Obligations:
|
|
7
|
+
To Do: None
|
|
8
|
+
Hacks: None
|
|
9
|
+
Future Enhancements: None
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import metta_websocket # noqa: F401 -- imported for the transport-error row
|
|
15
|
+
import pytest
|
|
16
|
+
|
|
17
|
+
from metta import is_transport_failure, seam
|
|
18
|
+
|
|
19
|
+
websocket = pytest.importorskip("websocket")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_the_row_is_registered_against_the_transport_error_point():
|
|
23
|
+
"""One row, holding the module NAME rather than the module."""
|
|
24
|
+
row = seam.transport_error.find("websocket")
|
|
25
|
+
assert row is not None
|
|
26
|
+
assert row.module == "websocket"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def test_a_websocket_timeout_reads_as_an_absent_backend():
|
|
30
|
+
"""The class this library raises under load, which is not an OSError."""
|
|
31
|
+
assert not isinstance(websocket.WebSocketTimeoutException(), OSError)
|
|
32
|
+
assert is_transport_failure(websocket.WebSocketTimeoutException("gone"))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def test_a_closed_stream_reads_as_an_absent_backend():
|
|
36
|
+
"""The other half: a stream the peer closed is absence, not an error."""
|
|
37
|
+
assert is_transport_failure(websocket.WebSocketConnectionClosedException("closed"))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_an_application_error_does_not():
|
|
41
|
+
"""Wrong is not absent, which is the distinction the door exists for."""
|
|
42
|
+
assert not is_transport_failure(ValueError("wrong, not absent"))
|