opencaselaw-cli 0.2.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.
- opencaselaw_cli-0.2.0/LICENSE +21 -0
- opencaselaw_cli-0.2.0/PKG-INFO +46 -0
- opencaselaw_cli-0.2.0/README.md +36 -0
- opencaselaw_cli-0.2.0/pyproject.toml +26 -0
- opencaselaw_cli-0.2.0/setup.cfg +4 -0
- opencaselaw_cli-0.2.0/src/opencaselaw_cli/__init__.py +6 -0
- opencaselaw_cli-0.2.0/src/opencaselaw_cli/__main__.py +3 -0
- opencaselaw_cli-0.2.0/src/opencaselaw_cli/_version.py +3 -0
- opencaselaw_cli-0.2.0/src/opencaselaw_cli/cli.py +679 -0
- opencaselaw_cli-0.2.0/src/opencaselaw_cli/client.py +125 -0
- opencaselaw_cli-0.2.0/src/opencaselaw_cli/render.py +514 -0
- opencaselaw_cli-0.2.0/src/opencaselaw_cli/workflows.py +704 -0
- opencaselaw_cli-0.2.0/src/opencaselaw_cli.egg-info/PKG-INFO +46 -0
- opencaselaw_cli-0.2.0/src/opencaselaw_cli.egg-info/SOURCES.txt +19 -0
- opencaselaw_cli-0.2.0/src/opencaselaw_cli.egg-info/dependency_links.txt +1 -0
- opencaselaw_cli-0.2.0/src/opencaselaw_cli.egg-info/entry_points.txt +2 -0
- opencaselaw_cli-0.2.0/src/opencaselaw_cli.egg-info/top_level.txt +1 -0
- opencaselaw_cli-0.2.0/tests/test_cli.py +385 -0
- opencaselaw_cli-0.2.0/tests/test_client.py +106 -0
- opencaselaw_cli-0.2.0/tests/test_render.py +138 -0
- opencaselaw_cli-0.2.0/tests/test_workflows.py +425 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 jonashertner
|
|
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,46 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: opencaselaw-cli
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Composable, read-only research client for OpenCaseLaw
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Dynamic: license-file
|
|
10
|
+
|
|
11
|
+
# OpenCaseLaw research CLI
|
|
12
|
+
|
|
13
|
+
Dependency-free Python 3.10+ client for the public, read-only research API.
|
|
14
|
+
Install from the repository with `pipx install ./clients/python` (or
|
|
15
|
+
`uv tool install ./clients/python`); both create the isolated environment
|
|
16
|
+
that current Python installations require. Without them, use a virtual
|
|
17
|
+
environment: `python3 -m venv .venv && .venv/bin/pip install ./clients/python`.
|
|
18
|
+
This package does not install scraper/server dependencies or a local corpus.
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
ocl --help
|
|
22
|
+
ocl citations resolve 'BGE 136 III 513' '4A_747/2012' # do these exist, and which decisions are they?
|
|
23
|
+
ocl bundle create 'Rachekündigung Art. 336 OR' --max-results 10 --passage 2 --law OR:336 --out evidence
|
|
24
|
+
ocl decisions search 'Rachekündigung' --max-results 5 --format jsonl | ocl decisions get --stdin --format jsonl > decisions.jsonl
|
|
25
|
+
ocl decisions passage bge_BGE_136_III_513 2.3
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
A bundle folder holds the selected decisions (JSON and plain text), the named
|
|
29
|
+
Erwägungen and statute articles, a plain-language `INDEX.md`, and a
|
|
30
|
+
`manifest.json` with every request, timestamp, source link and file hash.
|
|
31
|
+
|
|
32
|
+
See the repository's [research CLI guide](https://github.com/jonashertner/opencaselaw/blob/main/docs/research-cli.md)
|
|
33
|
+
for provenance, batch inputs, pagination, partial failures and repeatable workflows.
|
|
34
|
+
Commands contact `https://mcp.opencaselaw.ch` by default; `--base-url` accepts an
|
|
35
|
+
alternative HTTP(S) origin. Results come from a changing hosted corpus, not an
|
|
36
|
+
offline snapshot. Preserve returned source evidence and pagination metadata.
|
|
37
|
+
|
|
38
|
+
Exit codes: 0 success (including a bounded selection); 2 invalid input; 3 API
|
|
39
|
+
or transport failure; 4 partial or unresolved result; 130 interruption.
|
|
40
|
+
At a terminal the output is readable text (`--color never` or `NO_COLOR` for
|
|
41
|
+
plain text); piped, or with `--format json|jsonl`, it is JSON on stdout;
|
|
42
|
+
`table`, `csv` and `md` are for documents. Defaults can live in
|
|
43
|
+
`~/.config/ocl/config` or `OCL_*` variables; `ocl completion zsh|bash|fish`
|
|
44
|
+
prints a completion script. Diagnostics go to stderr. The client retries at most
|
|
45
|
+
twice by default, spaces requests by at least 200 ms, and respects Retry-After
|
|
46
|
+
up to 30 seconds; longer server delays fail without an early retry.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# OpenCaseLaw research CLI
|
|
2
|
+
|
|
3
|
+
Dependency-free Python 3.10+ client for the public, read-only research API.
|
|
4
|
+
Install from the repository with `pipx install ./clients/python` (or
|
|
5
|
+
`uv tool install ./clients/python`); both create the isolated environment
|
|
6
|
+
that current Python installations require. Without them, use a virtual
|
|
7
|
+
environment: `python3 -m venv .venv && .venv/bin/pip install ./clients/python`.
|
|
8
|
+
This package does not install scraper/server dependencies or a local corpus.
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
ocl --help
|
|
12
|
+
ocl citations resolve 'BGE 136 III 513' '4A_747/2012' # do these exist, and which decisions are they?
|
|
13
|
+
ocl bundle create 'Rachekündigung Art. 336 OR' --max-results 10 --passage 2 --law OR:336 --out evidence
|
|
14
|
+
ocl decisions search 'Rachekündigung' --max-results 5 --format jsonl | ocl decisions get --stdin --format jsonl > decisions.jsonl
|
|
15
|
+
ocl decisions passage bge_BGE_136_III_513 2.3
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
A bundle folder holds the selected decisions (JSON and plain text), the named
|
|
19
|
+
Erwägungen and statute articles, a plain-language `INDEX.md`, and a
|
|
20
|
+
`manifest.json` with every request, timestamp, source link and file hash.
|
|
21
|
+
|
|
22
|
+
See the repository's [research CLI guide](https://github.com/jonashertner/opencaselaw/blob/main/docs/research-cli.md)
|
|
23
|
+
for provenance, batch inputs, pagination, partial failures and repeatable workflows.
|
|
24
|
+
Commands contact `https://mcp.opencaselaw.ch` by default; `--base-url` accepts an
|
|
25
|
+
alternative HTTP(S) origin. Results come from a changing hosted corpus, not an
|
|
26
|
+
offline snapshot. Preserve returned source evidence and pagination metadata.
|
|
27
|
+
|
|
28
|
+
Exit codes: 0 success (including a bounded selection); 2 invalid input; 3 API
|
|
29
|
+
or transport failure; 4 partial or unresolved result; 130 interruption.
|
|
30
|
+
At a terminal the output is readable text (`--color never` or `NO_COLOR` for
|
|
31
|
+
plain text); piped, or with `--format json|jsonl`, it is JSON on stdout;
|
|
32
|
+
`table`, `csv` and `md` are for documents. Defaults can live in
|
|
33
|
+
`~/.config/ocl/config` or `OCL_*` variables; `ocl completion zsh|bash|fish`
|
|
34
|
+
prints a completion script. Diagnostics go to stderr. The client retries at most
|
|
35
|
+
twice by default, spaces requests by at least 200 ms, and respects Retry-After
|
|
36
|
+
up to 30 seconds; longer server delays fail without an early retry.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "opencaselaw-cli"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Composable, read-only research client for OpenCaseLaw"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
dependencies = []
|
|
14
|
+
|
|
15
|
+
[project.scripts]
|
|
16
|
+
ocl = "opencaselaw_cli.cli:main"
|
|
17
|
+
|
|
18
|
+
[tool.setuptools.packages.find]
|
|
19
|
+
where = ["src"]
|
|
20
|
+
|
|
21
|
+
[tool.setuptools.dynamic]
|
|
22
|
+
version = {attr = "opencaselaw_cli._version.__version__"}
|
|
23
|
+
|
|
24
|
+
[tool.pytest.ini_options]
|
|
25
|
+
testpaths = ["tests"]
|
|
26
|
+
pythonpath = ["src"]
|