hegel-core 0.1.0__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.
- hegel_core-0.1.0/LICENSE +21 -0
- hegel_core-0.1.0/PKG-INFO +56 -0
- hegel_core-0.1.0/README.md +23 -0
- hegel_core-0.1.0/pyproject.toml +182 -0
- hegel_core-0.1.0/setup.cfg +4 -0
- hegel_core-0.1.0/src/hegel/__init__.py +0 -0
- hegel_core-0.1.0/src/hegel/__main__.py +75 -0
- hegel_core-0.1.0/src/hegel/conformance.py +600 -0
- hegel_core-0.1.0/src/hegel/protocol/__init__.py +30 -0
- hegel_core-0.1.0/src/hegel/protocol/channel.py +185 -0
- hegel_core-0.1.0/src/hegel/protocol/connection.py +176 -0
- hegel_core-0.1.0/src/hegel/protocol/packet.py +108 -0
- hegel_core-0.1.0/src/hegel/protocol/utils.py +34 -0
- hegel_core-0.1.0/src/hegel/py.typed +0 -0
- hegel_core-0.1.0/src/hegel/schema.py +108 -0
- hegel_core-0.1.0/src/hegel/server.py +324 -0
- hegel_core-0.1.0/src/hegel/test_server.py +284 -0
- hegel_core-0.1.0/src/hegel/utils.py +11 -0
- hegel_core-0.1.0/src/hegel_core.egg-info/PKG-INFO +56 -0
- hegel_core-0.1.0/src/hegel_core.egg-info/SOURCES.txt +30 -0
- hegel_core-0.1.0/src/hegel_core.egg-info/dependency_links.txt +1 -0
- hegel_core-0.1.0/src/hegel_core.egg-info/entry_points.txt +2 -0
- hegel_core-0.1.0/src/hegel_core.egg-info/requires.txt +3 -0
- hegel_core-0.1.0/src/hegel_core.egg-info/top_level.txt +1 -0
- hegel_core-0.1.0/tests/test_conformance.py +76 -0
- hegel_core-0.1.0/tests/test_connection.py +605 -0
- hegel_core-0.1.0/tests/test_main.py +102 -0
- hegel_core-0.1.0/tests/test_packet.py +96 -0
- hegel_core-0.1.0/tests/test_schema.py +555 -0
- hegel_core-0.1.0/tests/test_server.py +356 -0
- hegel_core-0.1.0/tests/test_test_server.py +429 -0
- hegel_core-0.1.0/tests/test_utils.py +5 -0
hegel_core-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Antithesis, LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hegel-core
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Universal property-based testing protocol, built on Hypothesis
|
|
5
|
+
Author-email: "David R. MacIver" <david@drmaciver.com>, Liam DeVoe <orionldevoe@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: homepage, https://hegel.dev
|
|
8
|
+
Project-URL: source, https://github.com/hegeldev/hegel-core
|
|
9
|
+
Project-URL: changelog, https://github.com/hegeldev/hegel-core/blob/main/CHANGELOG.md
|
|
10
|
+
Project-URL: issues, https://github.com/hegeldev/hegel-core/issues
|
|
11
|
+
Keywords: testing,fuzzing,property-based-testing
|
|
12
|
+
Classifier: Framework :: Hypothesis
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: Unix
|
|
15
|
+
Classifier: Operating System :: POSIX
|
|
16
|
+
Classifier: Programming Language :: Python
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: Education :: Testing
|
|
24
|
+
Classifier: Topic :: Software Development :: Testing
|
|
25
|
+
Classifier: Typing :: Typed
|
|
26
|
+
Requires-Python: >=3.10
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Requires-Dist: cbor2>=5.8.0
|
|
30
|
+
Requires-Dist: click>=8.3.1
|
|
31
|
+
Requires-Dist: hypothesis>=6.148.5
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# Hegel
|
|
35
|
+
|
|
36
|
+
> [!IMPORTANT]
|
|
37
|
+
> If you've found this repository, congratulations! You're getting a sneak peak at an upcoming property-based testing library from [Antithesis](https://antithesis.com/), built on [Hypothesis](https://hypothesis.works/).
|
|
38
|
+
>
|
|
39
|
+
> We are still making rapid changes and progress. Feel free to experiment, but don't expect stability from Hegel just yet!
|
|
40
|
+
|
|
41
|
+
The Hegel server. Provides communication to the backing Hypothesis library over a socket.
|
|
42
|
+
|
|
43
|
+
## Hegel libraries
|
|
44
|
+
|
|
45
|
+
- [Python](https://github.com/hegeldev/hegel-python)
|
|
46
|
+
- [Go](https://github.com/hegeldev/hegel-go)
|
|
47
|
+
- [Rust](https://github.com/hegeldev/hegel-rust)
|
|
48
|
+
|
|
49
|
+
## Development
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
just setup # install dependencies
|
|
53
|
+
just test # run tests
|
|
54
|
+
just format # run formatter
|
|
55
|
+
just check # run PR checks: lint + tests + docs
|
|
56
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Hegel
|
|
2
|
+
|
|
3
|
+
> [!IMPORTANT]
|
|
4
|
+
> If you've found this repository, congratulations! You're getting a sneak peak at an upcoming property-based testing library from [Antithesis](https://antithesis.com/), built on [Hypothesis](https://hypothesis.works/).
|
|
5
|
+
>
|
|
6
|
+
> We are still making rapid changes and progress. Feel free to experiment, but don't expect stability from Hegel just yet!
|
|
7
|
+
|
|
8
|
+
The Hegel server. Provides communication to the backing Hypothesis library over a socket.
|
|
9
|
+
|
|
10
|
+
## Hegel libraries
|
|
11
|
+
|
|
12
|
+
- [Python](https://github.com/hegeldev/hegel-python)
|
|
13
|
+
- [Go](https://github.com/hegeldev/hegel-go)
|
|
14
|
+
- [Rust](https://github.com/hegeldev/hegel-rust)
|
|
15
|
+
|
|
16
|
+
## Development
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
just setup # install dependencies
|
|
20
|
+
just test # run tests
|
|
21
|
+
just format # run formatter
|
|
22
|
+
just check # run PR checks: lint + tests + docs
|
|
23
|
+
```
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
# require a recent setuptools for `license = ` support
|
|
3
|
+
requires = ["setuptools >= 78.1.0", "wheel"]
|
|
4
|
+
build-backend = "setuptools.build_meta"
|
|
5
|
+
|
|
6
|
+
[project]
|
|
7
|
+
name = "hegel-core"
|
|
8
|
+
version = "0.1.0"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "David R. MacIver", email = "david@drmaciver.com" },
|
|
11
|
+
{ name = "Liam DeVoe", email = "orionldevoe@gmail.com"}
|
|
12
|
+
]
|
|
13
|
+
description = "Universal property-based testing protocol, built on Hypothesis"
|
|
14
|
+
|
|
15
|
+
readme = "README.md"
|
|
16
|
+
license = "MIT"
|
|
17
|
+
requires-python = ">=3.10"
|
|
18
|
+
keywords = ["testing", "fuzzing", "property-based-testing"]
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Framework :: Hypothesis",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"Operating System :: Unix",
|
|
23
|
+
"Operating System :: POSIX",
|
|
24
|
+
"Programming Language :: Python",
|
|
25
|
+
"Programming Language :: Python :: 3",
|
|
26
|
+
"Programming Language :: Python :: 3.10",
|
|
27
|
+
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"Programming Language :: Python :: 3.12",
|
|
29
|
+
"Programming Language :: Python :: 3.13",
|
|
30
|
+
"Programming Language :: Python :: 3.14",
|
|
31
|
+
"Topic :: Education :: Testing",
|
|
32
|
+
"Topic :: Software Development :: Testing",
|
|
33
|
+
"Typing :: Typed",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
dependencies = [
|
|
37
|
+
"cbor2>=5.8.0",
|
|
38
|
+
"click>=8.3.1",
|
|
39
|
+
"hypothesis>=6.148.5",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[dependency-groups]
|
|
43
|
+
dev = [
|
|
44
|
+
"pytest==9.0.2",
|
|
45
|
+
"pytest-asyncio==1.3.0",
|
|
46
|
+
"mypy==1.19.1",
|
|
47
|
+
"coverage==7.13.4",
|
|
48
|
+
"ruff==0.15.6",
|
|
49
|
+
"shed==2025.6.1",
|
|
50
|
+
"exceptiongroup>=1.0.0; python_version < '3.11'",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[project.urls]
|
|
54
|
+
homepage = "https://hegel.dev"
|
|
55
|
+
source = "https://github.com/hegeldev/hegel-core"
|
|
56
|
+
# TODO update to hegel.dev location when we host it there?
|
|
57
|
+
changelog = "https://github.com/hegeldev/hegel-core/blob/main/CHANGELOG.md"
|
|
58
|
+
# TODO set to hegel.dev location when we host it there?
|
|
59
|
+
# documentation = "https://hegel.dev/TODO-docs-url-goes-here"
|
|
60
|
+
issues = "https://github.com/hegeldev/hegel-core/issues"
|
|
61
|
+
|
|
62
|
+
[project.scripts]
|
|
63
|
+
hegel = "hegel.__main__:main"
|
|
64
|
+
|
|
65
|
+
[tool.ruff]
|
|
66
|
+
line-length = 88
|
|
67
|
+
target-version = "py310"
|
|
68
|
+
|
|
69
|
+
[tool.ruff.lint]
|
|
70
|
+
select = [
|
|
71
|
+
"ASYNC", # flake8-async
|
|
72
|
+
"B", # flake8-bugbear
|
|
73
|
+
"C4", # flake8-comprehensions
|
|
74
|
+
"COM", # flake8-commas
|
|
75
|
+
"DJ", # flake8-django
|
|
76
|
+
"E", # pycodestyle
|
|
77
|
+
"F", # Pyflakes
|
|
78
|
+
"FBT", # flake8-boolean-trap
|
|
79
|
+
"FLY", # flynt
|
|
80
|
+
"G", # flake8-logging-format
|
|
81
|
+
"INT", # flake8-gettext
|
|
82
|
+
"ISC", # flake8-implicit-str-concat
|
|
83
|
+
"NPY", # NumPy-specific rules
|
|
84
|
+
"PD", # pandas-vet
|
|
85
|
+
"PIE", # flake8-pie
|
|
86
|
+
"PLE", # Pylint errors
|
|
87
|
+
"PT", # flake8-pytest-style
|
|
88
|
+
"RET504", # flake8-return
|
|
89
|
+
"RSE", # flake8-raise
|
|
90
|
+
"SIM", # flake8-simplify
|
|
91
|
+
"T10", # flake8-debugger
|
|
92
|
+
"TID", # flake8-tidy-imports
|
|
93
|
+
"UP", # pyupgrade
|
|
94
|
+
"W", # pycodestyle
|
|
95
|
+
"YTT", # flake8-2020
|
|
96
|
+
"RUF", # Ruff-specific rules
|
|
97
|
+
]
|
|
98
|
+
ignore = [
|
|
99
|
+
"B008",
|
|
100
|
+
"B018",
|
|
101
|
+
"B023",
|
|
102
|
+
"C408",
|
|
103
|
+
"C420",
|
|
104
|
+
"COM812",
|
|
105
|
+
"DJ007",
|
|
106
|
+
"DJ008",
|
|
107
|
+
# "line too long". ruff uses tool.ruff.line-length both for this rule, and for `ruff format`.
|
|
108
|
+
# We want ruff format to match black's 88 line length, so we set tool.ruff.line-length = 88. But
|
|
109
|
+
# this is a formatter suggestion, not a rule, so we also disable the E501 lint.
|
|
110
|
+
"E501",
|
|
111
|
+
"E721",
|
|
112
|
+
"E731",
|
|
113
|
+
"E741",
|
|
114
|
+
"FBT001",
|
|
115
|
+
"FBT003",
|
|
116
|
+
"PD011",
|
|
117
|
+
"PIE790", # See https://github.com/astral-sh/ruff/issues/10538
|
|
118
|
+
"PT001",
|
|
119
|
+
"PT003",
|
|
120
|
+
"PT006",
|
|
121
|
+
"PT007",
|
|
122
|
+
"PT009",
|
|
123
|
+
"PT011",
|
|
124
|
+
"PT012",
|
|
125
|
+
"PT013",
|
|
126
|
+
"PT015",
|
|
127
|
+
"PT017",
|
|
128
|
+
"PT019",
|
|
129
|
+
"PT023",
|
|
130
|
+
"PT027",
|
|
131
|
+
"PT031",
|
|
132
|
+
"RUF005",
|
|
133
|
+
"RUF017",
|
|
134
|
+
"SIM102",
|
|
135
|
+
"SIM105",
|
|
136
|
+
"SIM108",
|
|
137
|
+
"SIM114",
|
|
138
|
+
"SIM115",
|
|
139
|
+
"SIM300",
|
|
140
|
+
"SIM905",
|
|
141
|
+
"UP031",
|
|
142
|
+
"UP037",
|
|
143
|
+
]
|
|
144
|
+
|
|
145
|
+
[tool.mypy]
|
|
146
|
+
python_version = "3.14"
|
|
147
|
+
platform = "linux"
|
|
148
|
+
|
|
149
|
+
allow_redefinition = true
|
|
150
|
+
disallow_untyped_decorators = true
|
|
151
|
+
disallow_incomplete_defs = true
|
|
152
|
+
no_implicit_optional = true
|
|
153
|
+
no_implicit_reexport = true
|
|
154
|
+
|
|
155
|
+
follow_imports = "silent"
|
|
156
|
+
ignore_missing_imports = true
|
|
157
|
+
|
|
158
|
+
strict_equality = true
|
|
159
|
+
warn_no_return = true
|
|
160
|
+
warn_unused_ignores = true
|
|
161
|
+
warn_unused_configs = true
|
|
162
|
+
warn_redundant_casts = true
|
|
163
|
+
|
|
164
|
+
disable_error_code = "annotation-unchecked"
|
|
165
|
+
|
|
166
|
+
[tool.coverage.run]
|
|
167
|
+
branch = true
|
|
168
|
+
parallel = true
|
|
169
|
+
concurrency = ["thread"]
|
|
170
|
+
source = ["hegel"]
|
|
171
|
+
# conformance tests are intended primarily for consumers. We don't fully
|
|
172
|
+
# cover this in our tests.
|
|
173
|
+
omit = ["src/hegel/conformance.py"]
|
|
174
|
+
|
|
175
|
+
[tool.coverage.report]
|
|
176
|
+
fail_under = 100
|
|
177
|
+
show_missing = true
|
|
178
|
+
skip_covered = true
|
|
179
|
+
exclude_also = [
|
|
180
|
+
"raise AssertionError",
|
|
181
|
+
"raise NotImplementedError",
|
|
182
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import contextlib
|
|
2
|
+
import importlib.metadata
|
|
3
|
+
import os
|
|
4
|
+
import socket
|
|
5
|
+
import sys
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
import click
|
|
9
|
+
from hypothesis import Verbosity
|
|
10
|
+
from hypothesis.configuration import set_hypothesis_home_dir
|
|
11
|
+
|
|
12
|
+
from hegel.protocol.connection import Connection
|
|
13
|
+
from hegel.server import run_server_on_connection
|
|
14
|
+
from hegel.test_server import run_test_server
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@click.command()
|
|
18
|
+
@click.version_option(
|
|
19
|
+
version=importlib.metadata.version("hegel-core"),
|
|
20
|
+
message="hegel (version %(version)s)",
|
|
21
|
+
)
|
|
22
|
+
@click.argument("socket_path")
|
|
23
|
+
@click.option(
|
|
24
|
+
"--verbosity",
|
|
25
|
+
type=click.Choice(["quiet", "normal", "verbose", "debug"]),
|
|
26
|
+
default="normal",
|
|
27
|
+
help="Verbosity level. Corresponds to hypothesis.Verbosity.",
|
|
28
|
+
)
|
|
29
|
+
def main(socket_path, verbosity):
|
|
30
|
+
"""Run the Hegel test server, binding to socket_path."""
|
|
31
|
+
verbosity = Verbosity(verbosity)
|
|
32
|
+
socket_path = Path(socket_path)
|
|
33
|
+
|
|
34
|
+
# Clean up any existing socket before starting
|
|
35
|
+
with contextlib.suppress(FileNotFoundError):
|
|
36
|
+
socket_path.unlink()
|
|
37
|
+
|
|
38
|
+
run_server(socket_path, verbosity=verbosity)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def run_server(socket_path: Path, *, verbosity: Verbosity = Verbosity.normal) -> None:
|
|
42
|
+
if verbosity >= Verbosity.debug:
|
|
43
|
+
os.environ["HEGEL_PROTOCOL_DEBUG"] = "1"
|
|
44
|
+
|
|
45
|
+
set_hypothesis_home_dir(".hegel")
|
|
46
|
+
|
|
47
|
+
server_sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
|
48
|
+
server_sock.bind(str(socket_path))
|
|
49
|
+
server_sock.listen(1)
|
|
50
|
+
|
|
51
|
+
if verbosity >= Verbosity.verbose:
|
|
52
|
+
print(f"Listening on {socket_path}", file=sys.stderr)
|
|
53
|
+
|
|
54
|
+
try:
|
|
55
|
+
client_sock, _ = server_sock.accept()
|
|
56
|
+
|
|
57
|
+
if verbosity >= Verbosity.verbose:
|
|
58
|
+
print("Client connected", file=sys.stderr)
|
|
59
|
+
|
|
60
|
+
connection = Connection(client_sock, name="Server")
|
|
61
|
+
test_mode = os.environ.get("HEGEL_PROTOCOL_TEST_MODE")
|
|
62
|
+
if test_mode:
|
|
63
|
+
run_test_server(connection, test_mode)
|
|
64
|
+
else:
|
|
65
|
+
run_server_on_connection(connection)
|
|
66
|
+
|
|
67
|
+
if verbosity >= Verbosity.verbose:
|
|
68
|
+
print("Client disconnected", file=sys.stderr)
|
|
69
|
+
|
|
70
|
+
finally:
|
|
71
|
+
server_sock.close()
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
if __name__ == "__main__": # pragma: no cover
|
|
75
|
+
main()
|