moleg-api 0.1.1__tar.gz → 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.
Files changed (38) hide show
  1. moleg_api-0.2.0/PKG-INFO +97 -0
  2. moleg_api-0.2.0/README.md +68 -0
  3. moleg_api-0.2.0/moleg_api/__main__.py +8 -0
  4. moleg_api-0.2.0/moleg_api/cli.py +1030 -0
  5. {moleg_api-0.1.1 → moleg_api-0.2.0}/moleg_api/laws.py +123 -2
  6. {moleg_api-0.1.1 → moleg_api-0.2.0}/moleg_api/normalization.py +9 -5
  7. moleg_api-0.2.0/moleg_api.egg-info/PKG-INFO +97 -0
  8. {moleg_api-0.1.1 → moleg_api-0.2.0}/moleg_api.egg-info/SOURCES.txt +6 -10
  9. moleg_api-0.2.0/moleg_api.egg-info/entry_points.txt +2 -0
  10. {moleg_api-0.1.1 → moleg_api-0.2.0}/pyproject.toml +5 -2
  11. moleg_api-0.2.0/tests/test_cli.py +392 -0
  12. moleg_api-0.2.0/tests/test_versions.py +220 -0
  13. moleg_api-0.1.1/PKG-INFO +0 -146
  14. moleg_api-0.1.1/README.md +0 -117
  15. moleg_api-0.1.1/moleg_api.egg-info/PKG-INFO +0 -146
  16. moleg_api-0.1.1/tests/test_congress_db_introspection.py +0 -59
  17. moleg_api-0.1.1/tests/test_fake_skill_tracer_bullet.py +0 -63
  18. moleg_api-0.1.1/tests/test_laws_docstrings.py +0 -379
  19. moleg_api-0.1.1/tests/test_legislative_expert_answer_discipline.py +0 -999
  20. moleg_api-0.1.1/tests/test_legislative_expert_artifact_safety.py +0 -1401
  21. moleg_api-0.1.1/tests/test_legislative_expert_e2e_audit.py +0 -1990
  22. moleg_api-0.1.1/tests/test_legislative_expert_gate_crosswalk.py +0 -940
  23. moleg_api-0.1.1/tests/test_legislative_expert_prompt_dry_run.py +0 -939
  24. moleg_api-0.1.1/tests/test_live_e2e_scenarios.py +0 -462
  25. {moleg_api-0.1.1 → moleg_api-0.2.0}/LICENSE +0 -0
  26. {moleg_api-0.1.1 → moleg_api-0.2.0}/moleg_api/__init__.py +0 -0
  27. {moleg_api-0.1.1 → moleg_api-0.2.0}/moleg_api/errors.py +0 -0
  28. {moleg_api-0.1.1 → moleg_api-0.2.0}/moleg_api/models.py +0 -0
  29. {moleg_api-0.1.1 → moleg_api-0.2.0}/moleg_api/py.typed +0 -0
  30. {moleg_api-0.1.1 → moleg_api-0.2.0}/moleg_api/source.py +0 -0
  31. {moleg_api-0.1.1 → moleg_api-0.2.0}/moleg_api.egg-info/dependency_links.txt +0 -0
  32. {moleg_api-0.1.1 → moleg_api-0.2.0}/moleg_api.egg-info/requires.txt +0 -0
  33. {moleg_api-0.1.1 → moleg_api-0.2.0}/moleg_api.egg-info/top_level.txt +0 -0
  34. {moleg_api-0.1.1 → moleg_api-0.2.0}/setup.cfg +0 -0
  35. {moleg_api-0.1.1 → moleg_api-0.2.0}/tests/test_laws.py +0 -0
  36. {moleg_api-0.1.1 → moleg_api-0.2.0}/tests/test_live_smoke.py +0 -0
  37. {moleg_api-0.1.1 → moleg_api-0.2.0}/tests/test_models.py +0 -0
  38. {moleg_api-0.1.1 → moleg_api-0.2.0}/tests/test_source.py +0 -0
@@ -0,0 +1,97 @@
1
+ Metadata-Version: 2.4
2
+ Name: moleg-api
3
+ Version: 0.2.0
4
+ Summary: Task-level Python interface for loading Korean legal sources from law.go.kr
5
+ Author: MOLEG-API maintainers
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/tjdwls101010/MOLEG-API
8
+ Project-URL: Documentation, https://github.com/tjdwls101010/MOLEG-API/tree/main/wiki
9
+ Project-URL: Repository, https://github.com/tjdwls101010/MOLEG-API
10
+ Project-URL: Issues, https://github.com/tjdwls101010/MOLEG-API/issues
11
+ Keywords: korea,law,legislation,moleg,law.go.kr
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Provides-Extra: dev
24
+ Requires-Dist: psycopg[binary]<4,>=3.2; extra == "dev"
25
+ Requires-Dist: pytest<9,>=8; extra == "dev"
26
+ Provides-Extra: test
27
+ Requires-Dist: pytest<9,>=8; extra == "test"
28
+ Dynamic: license-file
29
+
30
+ # moleg-api
31
+
32
+ `moleg-api` is a task-level Python interface for loading Korean legal sources from [law.go.kr](https://www.law.go.kr/). It normalizes the Ministry of Government Legislation (법제처) OpenAPI so applications and agents can retrieve legal context without memorizing individual `target` values, identifier rules (`ID`, `MST`, `LID`, `JO`), or per-endpoint response quirks.
33
+
34
+ You pick an interface by the legal task you need — search a statute, load an article, trace an amendment, find a delegated rule, read a Constitutional Court decision — not by a raw endpoint name. It is not a complete wrapper around every law.go.kr endpoint; the public interface is intentionally small and deep. The recurring pattern is **search or plan first, then load** the selected source: search hits are candidates, not citable text.
35
+
36
+ The PyPI package is `moleg-api`; import it as `moleg_api`.
37
+
38
+ ## Install
39
+
40
+ ```bash
41
+ pip install moleg-api
42
+ ```
43
+
44
+ Live calls use a law.go.kr OpenAPI credential (the "OC" — a free, non-secret account id). The package ships a shared default, so calls work out of the box with **no registration required**. To use your own OC (recommended for heavy use), register at law.go.kr and set `MOLEG_OC`, or pass `oc=` to `LawGoKrClient`. See [Installation](wiki/Installation.md).
45
+
46
+ ## Quickstart
47
+
48
+ Python — search, then load the chosen candidate:
49
+
50
+ ```python
51
+ from moleg_api import MolegApi
52
+
53
+ api = MolegApi()
54
+ hits = api.search_laws("주택임대차보호법") # candidate identities
55
+ article = api.get_article(hits[0].identity, "제3조") # loaded source text
56
+ print(article.text)
57
+ ```
58
+
59
+ Shell — every method is also a `moleg` subcommand printing one JSON envelope:
60
+
61
+ ```bash
62
+ python -m moleg_api catalog # self-documenting command list
63
+ python -m moleg_api search-laws "주택임대차보호법" # → candidates with law_id
64
+ python -m moleg_api get-article --law 001248 제3조 # load the current article
65
+ python -m moleg_api get-article --law 001248 --as-of 2021-01-01 제3조 # the version in force then
66
+ ```
67
+
68
+ Public dataclasses serialize recursively with `to_dict()` / `to_json_string()` (raw payloads omitted unless `include_raw=True`).
69
+
70
+ ## What it covers
71
+
72
+ - Current (`effective`) and promulgated (`promulgated`) statutes and articles, including moved/deleted status
73
+ - Supplementary provisions (부칙), law history, and before/after text comparison
74
+ - Historical versions — load the text in force on a past date with `as_of`
75
+ - Delegated rules, legal hierarchy, and administrative rules (고시·훈령·예규)
76
+ - Law and administrative-rule annex/form bodies (별표·서식)
77
+ - MOLEG and ministry legal interpretations, Supreme Court cases, and Constitutional Court (헌재) decisions
78
+ - Query expansion, comparable-mechanism discovery, and staged context bundles with executable follow-up lookups
79
+
80
+ Out of scope: legal advice, National Assembly bill data (status, votes, minutes), and latest statistics/news.
81
+
82
+ ## Documentation
83
+
84
+ Full documentation is in the [`wiki/`](wiki/Home.md) folder:
85
+
86
+ - [Installation](wiki/Installation.md) · [Quickstart](wiki/Quickstart.md) · [Core Concepts](wiki/Core-Concepts.md)
87
+ - [CLI Reference](wiki/CLI-Reference.md) · [API Reference](wiki/API-Reference.md)
88
+ - [Historical Versions](wiki/Historical-Versions.md) · [Sources & Coverage](wiki/Sources-and-Coverage.md)
89
+ - [Gotchas](wiki/Gotchas.md) · [Error Handling](wiki/Error-Handling.md)
90
+
91
+ ## Status
92
+
93
+ Alpha (`0.2.x`). The interface is ready for use, but law.go.kr live behavior can vary by source, credential, and endpoint availability. Treat search results as candidates until a detail loader has retrieved source text. This package is a legal-source loader, not legal advice.
94
+
95
+ ## License
96
+
97
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,68 @@
1
+ # moleg-api
2
+
3
+ `moleg-api` is a task-level Python interface for loading Korean legal sources from [law.go.kr](https://www.law.go.kr/). It normalizes the Ministry of Government Legislation (법제처) OpenAPI so applications and agents can retrieve legal context without memorizing individual `target` values, identifier rules (`ID`, `MST`, `LID`, `JO`), or per-endpoint response quirks.
4
+
5
+ You pick an interface by the legal task you need — search a statute, load an article, trace an amendment, find a delegated rule, read a Constitutional Court decision — not by a raw endpoint name. It is not a complete wrapper around every law.go.kr endpoint; the public interface is intentionally small and deep. The recurring pattern is **search or plan first, then load** the selected source: search hits are candidates, not citable text.
6
+
7
+ The PyPI package is `moleg-api`; import it as `moleg_api`.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pip install moleg-api
13
+ ```
14
+
15
+ Live calls use a law.go.kr OpenAPI credential (the "OC" — a free, non-secret account id). The package ships a shared default, so calls work out of the box with **no registration required**. To use your own OC (recommended for heavy use), register at law.go.kr and set `MOLEG_OC`, or pass `oc=` to `LawGoKrClient`. See [Installation](wiki/Installation.md).
16
+
17
+ ## Quickstart
18
+
19
+ Python — search, then load the chosen candidate:
20
+
21
+ ```python
22
+ from moleg_api import MolegApi
23
+
24
+ api = MolegApi()
25
+ hits = api.search_laws("주택임대차보호법") # candidate identities
26
+ article = api.get_article(hits[0].identity, "제3조") # loaded source text
27
+ print(article.text)
28
+ ```
29
+
30
+ Shell — every method is also a `moleg` subcommand printing one JSON envelope:
31
+
32
+ ```bash
33
+ python -m moleg_api catalog # self-documenting command list
34
+ python -m moleg_api search-laws "주택임대차보호법" # → candidates with law_id
35
+ python -m moleg_api get-article --law 001248 제3조 # load the current article
36
+ python -m moleg_api get-article --law 001248 --as-of 2021-01-01 제3조 # the version in force then
37
+ ```
38
+
39
+ Public dataclasses serialize recursively with `to_dict()` / `to_json_string()` (raw payloads omitted unless `include_raw=True`).
40
+
41
+ ## What it covers
42
+
43
+ - Current (`effective`) and promulgated (`promulgated`) statutes and articles, including moved/deleted status
44
+ - Supplementary provisions (부칙), law history, and before/after text comparison
45
+ - Historical versions — load the text in force on a past date with `as_of`
46
+ - Delegated rules, legal hierarchy, and administrative rules (고시·훈령·예규)
47
+ - Law and administrative-rule annex/form bodies (별표·서식)
48
+ - MOLEG and ministry legal interpretations, Supreme Court cases, and Constitutional Court (헌재) decisions
49
+ - Query expansion, comparable-mechanism discovery, and staged context bundles with executable follow-up lookups
50
+
51
+ Out of scope: legal advice, National Assembly bill data (status, votes, minutes), and latest statistics/news.
52
+
53
+ ## Documentation
54
+
55
+ Full documentation is in the [`wiki/`](wiki/Home.md) folder:
56
+
57
+ - [Installation](wiki/Installation.md) · [Quickstart](wiki/Quickstart.md) · [Core Concepts](wiki/Core-Concepts.md)
58
+ - [CLI Reference](wiki/CLI-Reference.md) · [API Reference](wiki/API-Reference.md)
59
+ - [Historical Versions](wiki/Historical-Versions.md) · [Sources & Coverage](wiki/Sources-and-Coverage.md)
60
+ - [Gotchas](wiki/Gotchas.md) · [Error Handling](wiki/Error-Handling.md)
61
+
62
+ ## Status
63
+
64
+ Alpha (`0.2.x`). The interface is ready for use, but law.go.kr live behavior can vary by source, credential, and endpoint availability. Treat search results as candidates until a detail loader has retrieved source text. This package is a legal-source loader, not legal advice.
65
+
66
+ ## License
67
+
68
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,8 @@
1
+ """Enable ``python -m moleg_api`` as the CLI entry point."""
2
+
3
+ import sys
4
+
5
+ from .cli import main
6
+
7
+ if __name__ == "__main__":
8
+ sys.exit(main())