refsource 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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 referencesource.org
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,228 @@
1
+ Metadata-Version: 2.4
2
+ Name: refsource
3
+ Version: 0.1.0
4
+ Summary: Look up reference data that carries its own source: every value comes with the URL it was read from and a verbatim quote from that page.
5
+ Author: referencesource.org
6
+ License: MIT
7
+ Project-URL: Homepage, https://referencesource.org
8
+ Project-URL: Catalogue, https://referencesource.org/catalog.json
9
+ Project-URL: Method, https://referencesource.org/method/
10
+ Keywords: reference-data,citations,provenance,verification,fact-check,regulations,compliance,lookup,datasets,source-quote
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
16
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
+ Classifier: Typing :: Typed
18
+ Requires-Python: >=3.8
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Dynamic: license-file
22
+
23
+ # refsource
24
+
25
+ **Reference data lookups where every value comes back with the URL it was read
26
+ from and a verbatim quote from that page.**
27
+
28
+ ```bash
29
+ pip install refsource
30
+ ```
31
+
32
+ ```python
33
+ import refsource
34
+
35
+ rows = refsource.lookup("conforming-loan-limits", state="AL",
36
+ county_name="AUTAUGA COUNTY")
37
+
38
+ rows[0]["limit_1_unit"]
39
+ # '$832,750'
40
+
41
+ rows[0]["limit_1_unit"].source
42
+ # 'https://www.fhfa.gov/document/d/cll/fullcountyloanlimitlist2026_hera-based_final_flat.csv'
43
+
44
+ rows[0]["limit_1_unit"].quote
45
+ # '01,001,AUTAUGA COUNTY,AL,33860,"$832,750 ","$1,066,250 ",...'
46
+ ```
47
+
48
+ A value is a plain string everywhere a string is expected, and it carries its
49
+ own citation. That is the whole idea: an answer you can check beats an answer
50
+ you have to trust.
51
+
52
+ 191 datasets, 73,380 records, from
53
+ **[referencesource.org](https://referencesource.org)** — regulatory thresholds
54
+ and deadlines, licensing rules by US state, version and end-of-support
55
+ calendars, certification registers, exposure limits, insurance minimums,
56
+ standards supersessions. Each one states its coverage, its sources and the
57
+ date it was last checked.
58
+
59
+ ## Why it exists
60
+
61
+ If you ask a language model for a county loan limit, a state's minimum liability
62
+ cover, or when an API model shuts off, you usually get a confident answer with
63
+ no way to check it. In our own measurement of 271 such questions, 19% came back
64
+ confident and **wrong**.
65
+
66
+ This package answers the same questions with the source attached, so the
67
+ checking step is available rather than skipped — in your code, in a notebook,
68
+ or in whatever an agent is doing on your behalf.
69
+
70
+ ## Usage
71
+
72
+ ### Find a dataset (no network — the catalogue ships with the package)
73
+
74
+ ```python
75
+ refsource.datasets("loan limit")
76
+ # [<Dataset conforming-loan-limits (3235 records, verified 2026-08-10)>]
77
+
78
+ refsource.fields("auto-insurance-minimums")
79
+ # ['state', 'bodily_injury_per_person', 'bodily_injury_per_accident', ...]
80
+ ```
81
+
82
+ ### Look records up
83
+
84
+ ```python
85
+ refsource.lookup("auto-insurance-minimums", state="TX")
86
+ refsource.lookup("auto-insurance-minimums", state=["TX", "NM", "AZ"])
87
+ refsource.search("ai-model-deprecation-and-retirement", "gpt-4", limit=5)
88
+ refsource.get("conforming-loan-limits", "01001")
89
+ ```
90
+
91
+ Matching is case-insensitive and forgiving about spacing and punctuation, so
92
+ `"Autauga County"` finds `"AUTAUGA COUNTY"`. A filter naming a field that does
93
+ not exist raises `NoSuchField` instead of returning an empty list — an empty
94
+ result from a typo looks exactly like an empty result from a real absence, and
95
+ one of those two is a wrong answer.
96
+
97
+ Datasets do not agree on how to spell things — one writes a state as `TX`, the
98
+ next as `Texas`, because each says what its source says. When a filter matches
99
+ nothing, ask what is actually there:
100
+
101
+ ```python
102
+ refsource.dataset("auto-insurance-minimums").values_of("state", limit=5)
103
+ # ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California']
104
+ ```
105
+
106
+ ### Read the provenance
107
+
108
+ ```python
109
+ rec = refsource.lookup("conforming-loan-limits", fips_full="01001")[0]
110
+
111
+ rec.source_url # the page or file this record was read from
112
+ rec.source_quote # the passage that states it, verbatim
113
+ rec.url # the published record's own page
114
+ rec.verified # '2026-08-10'
115
+ rec.stale_after # '2027-08-10'
116
+ print(rec.cite()) # a citation you can paste somewhere
117
+
118
+ v = rec["fha_limit_1_unit"]
119
+ v.source # apps.hud.gov — a SECOND publisher's value,
120
+ # kept with its own source rather than folded in
121
+ v.confirmed # the value was found word-for-word in the quote
122
+ v.derived # our own reading rather than the page's words
123
+ v.disagreement # other sources' versions of this same field, if any
124
+ ```
125
+
126
+ Three things are deliberately visible rather than smoothed over:
127
+
128
+ - **Fields from a second publisher keep that publisher's URL and quote.** The
129
+ FHFA conforming limit and the HUD/FHA limit sit in the same record; each cites
130
+ the file it came from. Attributing one to the other would be a false citation.
131
+ - **`derived` marks our reading**, not the page's words — a state name we
132
+ normalised, an identifier we assembled.
133
+ - **`disagreement` is not hidden.** Where two sources state a field differently,
134
+ you get both, each with its own quote, and you decide.
135
+
136
+ ### Staleness
137
+
138
+ Every dataset carries the date by which it should be re-checked. Read the
139
+ records of one that is past it and you get a `StaleDataWarning` naming the page
140
+ with the current copy. Nothing is silently served as fresh.
141
+
142
+ ### Offline, caching, mirrors
143
+
144
+ Records are fetched on first use and cached (24h by default; the catalogue
145
+ itself needs no network at all).
146
+
147
+ ```python
148
+ refsource.configure(
149
+ cache_ttl=86400, # 0 = always re-fetch, negative = never expire
150
+ offline=True, # cache only, never open a connection
151
+ strict=True, # refuse a bundle that no longer matches its pinned hash
152
+ base_url="file:///path/to/site", # a local copy or a mirror
153
+ )
154
+ ```
155
+
156
+ Every one of those has an environment variable too: `REFSOURCE_CACHE`,
157
+ `REFSOURCE_CACHE_TTL`, `REFSOURCE_OFFLINE`, `REFSOURCE_STRICT`,
158
+ `REFSOURCE_BASE_URL`, `REFSOURCE_TIMEOUT`.
159
+
160
+ **Hash pinning.** The package holds the SHA-256 of every bundle as of the
161
+ release. If a fetched bundle differs, the dataset was re-verified upstream since
162
+ this version was cut — you get the live copy plus a `ChangedUpstreamWarning`, or
163
+ an `IntegrityError` under `strict=True`. The point is that a change is visible
164
+ rather than silent.
165
+
166
+ ## Command line
167
+
168
+ ```console
169
+ $ refsource datasets loan limit
170
+ $ refsource fields conforming-loan-limits
171
+ $ refsource lookup conforming-loan-limits fips_full=01001
172
+ $ refsource search ai-model-deprecation-and-retirement gpt-4 --limit 5
173
+ $ refsource show conforming-loan-limits 01001 --json
174
+ ```
175
+
176
+ ```
177
+ 01001
178
+ county_name: AUTAUGA COUNTY
179
+ state: AL
180
+ limit_1_unit: $832,750
181
+ fha_limit_1_unit: 541,287
182
+ from https://apps.hud.gov/pub/chums/cy2026-forward-limits.txt
183
+ quoted: "3386000000MONTGOMERY, AL 203B S02200000541287069305008377001041125AL001…"
184
+ source: https://www.fhfa.gov/document/d/cll/fullcountyloanlimitlist2026_hera-based_final_flat.csv
185
+ quoted: "01,001,AUTAUGA COUNTY,AL,33860,"$832,750 ","$1,066,250 ","$1,288,800 ","$1,601,750 ""
186
+ page: https://referencesource.org/conforming-loan-limits/01001/
187
+ verified 2026-08-10
188
+ ```
189
+
190
+ ## What is in the catalogue
191
+
192
+ A sample of the 191 datasets:
193
+
194
+ | dataset | what it answers |
195
+ |---|---|
196
+ | `conforming-loan-limits` | the FHFA and FHA loan limits for every US county |
197
+ | `auto-insurance-minimums` | minimum liability cover by US state |
198
+ | `ai-model-deprecation-and-retirement` | when an API model was deprecated and what replaces it |
199
+ | `software-end-of-support` | end-of-support dates from each vendor's own page |
200
+ | `iso-standard-supersessions` | what withdrew or replaced an ISO standard |
201
+ | `workplace-exposure-limits` | OSHA and Cal/OSHA permissible exposure limits |
202
+ | `fips-140-module-validation-status` | whether a cryptographic module's validation is still active |
203
+ | `drinking-water-contaminant-limits` | EPA maximum contaminant levels |
204
+
205
+ `refsource.datasets()` lists them all, offline.
206
+
207
+ ## Data, licensing and accuracy
208
+
209
+ The records are facts with attribution, not reproductions. Each dataset states
210
+ its own licence position and links the source it was read from; the package code
211
+ is MIT. Where a source's terms forbid reuse, the dataset is not published at
212
+ all.
213
+
214
+ No value is ever supplied by this package or by a model — if a source does not
215
+ state something, the row is omitted rather than guessed. Where you need to be
216
+ sure, the quote and the URL are right there: check it.
217
+
218
+ Found something wrong? That is the one thing worth reporting —
219
+ https://referencesource.org/ has the contact and the method behind every
220
+ dataset.
221
+
222
+ ## Related
223
+
224
+ - **MCP server** — the same catalogue as tools for AI assistants:
225
+ `npx referencesource-mcp`, or add
226
+ `https://referencesource.org/mcp` to any MCP client.
227
+ - **Bulk data** — every dataset publishes `data.json` at its own URL, and the
228
+ catalogue is at https://referencesource.org/catalog.json.
@@ -0,0 +1,206 @@
1
+ # refsource
2
+
3
+ **Reference data lookups where every value comes back with the URL it was read
4
+ from and a verbatim quote from that page.**
5
+
6
+ ```bash
7
+ pip install refsource
8
+ ```
9
+
10
+ ```python
11
+ import refsource
12
+
13
+ rows = refsource.lookup("conforming-loan-limits", state="AL",
14
+ county_name="AUTAUGA COUNTY")
15
+
16
+ rows[0]["limit_1_unit"]
17
+ # '$832,750'
18
+
19
+ rows[0]["limit_1_unit"].source
20
+ # 'https://www.fhfa.gov/document/d/cll/fullcountyloanlimitlist2026_hera-based_final_flat.csv'
21
+
22
+ rows[0]["limit_1_unit"].quote
23
+ # '01,001,AUTAUGA COUNTY,AL,33860,"$832,750 ","$1,066,250 ",...'
24
+ ```
25
+
26
+ A value is a plain string everywhere a string is expected, and it carries its
27
+ own citation. That is the whole idea: an answer you can check beats an answer
28
+ you have to trust.
29
+
30
+ 191 datasets, 73,380 records, from
31
+ **[referencesource.org](https://referencesource.org)** — regulatory thresholds
32
+ and deadlines, licensing rules by US state, version and end-of-support
33
+ calendars, certification registers, exposure limits, insurance minimums,
34
+ standards supersessions. Each one states its coverage, its sources and the
35
+ date it was last checked.
36
+
37
+ ## Why it exists
38
+
39
+ If you ask a language model for a county loan limit, a state's minimum liability
40
+ cover, or when an API model shuts off, you usually get a confident answer with
41
+ no way to check it. In our own measurement of 271 such questions, 19% came back
42
+ confident and **wrong**.
43
+
44
+ This package answers the same questions with the source attached, so the
45
+ checking step is available rather than skipped — in your code, in a notebook,
46
+ or in whatever an agent is doing on your behalf.
47
+
48
+ ## Usage
49
+
50
+ ### Find a dataset (no network — the catalogue ships with the package)
51
+
52
+ ```python
53
+ refsource.datasets("loan limit")
54
+ # [<Dataset conforming-loan-limits (3235 records, verified 2026-08-10)>]
55
+
56
+ refsource.fields("auto-insurance-minimums")
57
+ # ['state', 'bodily_injury_per_person', 'bodily_injury_per_accident', ...]
58
+ ```
59
+
60
+ ### Look records up
61
+
62
+ ```python
63
+ refsource.lookup("auto-insurance-minimums", state="TX")
64
+ refsource.lookup("auto-insurance-minimums", state=["TX", "NM", "AZ"])
65
+ refsource.search("ai-model-deprecation-and-retirement", "gpt-4", limit=5)
66
+ refsource.get("conforming-loan-limits", "01001")
67
+ ```
68
+
69
+ Matching is case-insensitive and forgiving about spacing and punctuation, so
70
+ `"Autauga County"` finds `"AUTAUGA COUNTY"`. A filter naming a field that does
71
+ not exist raises `NoSuchField` instead of returning an empty list — an empty
72
+ result from a typo looks exactly like an empty result from a real absence, and
73
+ one of those two is a wrong answer.
74
+
75
+ Datasets do not agree on how to spell things — one writes a state as `TX`, the
76
+ next as `Texas`, because each says what its source says. When a filter matches
77
+ nothing, ask what is actually there:
78
+
79
+ ```python
80
+ refsource.dataset("auto-insurance-minimums").values_of("state", limit=5)
81
+ # ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California']
82
+ ```
83
+
84
+ ### Read the provenance
85
+
86
+ ```python
87
+ rec = refsource.lookup("conforming-loan-limits", fips_full="01001")[0]
88
+
89
+ rec.source_url # the page or file this record was read from
90
+ rec.source_quote # the passage that states it, verbatim
91
+ rec.url # the published record's own page
92
+ rec.verified # '2026-08-10'
93
+ rec.stale_after # '2027-08-10'
94
+ print(rec.cite()) # a citation you can paste somewhere
95
+
96
+ v = rec["fha_limit_1_unit"]
97
+ v.source # apps.hud.gov — a SECOND publisher's value,
98
+ # kept with its own source rather than folded in
99
+ v.confirmed # the value was found word-for-word in the quote
100
+ v.derived # our own reading rather than the page's words
101
+ v.disagreement # other sources' versions of this same field, if any
102
+ ```
103
+
104
+ Three things are deliberately visible rather than smoothed over:
105
+
106
+ - **Fields from a second publisher keep that publisher's URL and quote.** The
107
+ FHFA conforming limit and the HUD/FHA limit sit in the same record; each cites
108
+ the file it came from. Attributing one to the other would be a false citation.
109
+ - **`derived` marks our reading**, not the page's words — a state name we
110
+ normalised, an identifier we assembled.
111
+ - **`disagreement` is not hidden.** Where two sources state a field differently,
112
+ you get both, each with its own quote, and you decide.
113
+
114
+ ### Staleness
115
+
116
+ Every dataset carries the date by which it should be re-checked. Read the
117
+ records of one that is past it and you get a `StaleDataWarning` naming the page
118
+ with the current copy. Nothing is silently served as fresh.
119
+
120
+ ### Offline, caching, mirrors
121
+
122
+ Records are fetched on first use and cached (24h by default; the catalogue
123
+ itself needs no network at all).
124
+
125
+ ```python
126
+ refsource.configure(
127
+ cache_ttl=86400, # 0 = always re-fetch, negative = never expire
128
+ offline=True, # cache only, never open a connection
129
+ strict=True, # refuse a bundle that no longer matches its pinned hash
130
+ base_url="file:///path/to/site", # a local copy or a mirror
131
+ )
132
+ ```
133
+
134
+ Every one of those has an environment variable too: `REFSOURCE_CACHE`,
135
+ `REFSOURCE_CACHE_TTL`, `REFSOURCE_OFFLINE`, `REFSOURCE_STRICT`,
136
+ `REFSOURCE_BASE_URL`, `REFSOURCE_TIMEOUT`.
137
+
138
+ **Hash pinning.** The package holds the SHA-256 of every bundle as of the
139
+ release. If a fetched bundle differs, the dataset was re-verified upstream since
140
+ this version was cut — you get the live copy plus a `ChangedUpstreamWarning`, or
141
+ an `IntegrityError` under `strict=True`. The point is that a change is visible
142
+ rather than silent.
143
+
144
+ ## Command line
145
+
146
+ ```console
147
+ $ refsource datasets loan limit
148
+ $ refsource fields conforming-loan-limits
149
+ $ refsource lookup conforming-loan-limits fips_full=01001
150
+ $ refsource search ai-model-deprecation-and-retirement gpt-4 --limit 5
151
+ $ refsource show conforming-loan-limits 01001 --json
152
+ ```
153
+
154
+ ```
155
+ 01001
156
+ county_name: AUTAUGA COUNTY
157
+ state: AL
158
+ limit_1_unit: $832,750
159
+ fha_limit_1_unit: 541,287
160
+ from https://apps.hud.gov/pub/chums/cy2026-forward-limits.txt
161
+ quoted: "3386000000MONTGOMERY, AL 203B S02200000541287069305008377001041125AL001…"
162
+ source: https://www.fhfa.gov/document/d/cll/fullcountyloanlimitlist2026_hera-based_final_flat.csv
163
+ quoted: "01,001,AUTAUGA COUNTY,AL,33860,"$832,750 ","$1,066,250 ","$1,288,800 ","$1,601,750 ""
164
+ page: https://referencesource.org/conforming-loan-limits/01001/
165
+ verified 2026-08-10
166
+ ```
167
+
168
+ ## What is in the catalogue
169
+
170
+ A sample of the 191 datasets:
171
+
172
+ | dataset | what it answers |
173
+ |---|---|
174
+ | `conforming-loan-limits` | the FHFA and FHA loan limits for every US county |
175
+ | `auto-insurance-minimums` | minimum liability cover by US state |
176
+ | `ai-model-deprecation-and-retirement` | when an API model was deprecated and what replaces it |
177
+ | `software-end-of-support` | end-of-support dates from each vendor's own page |
178
+ | `iso-standard-supersessions` | what withdrew or replaced an ISO standard |
179
+ | `workplace-exposure-limits` | OSHA and Cal/OSHA permissible exposure limits |
180
+ | `fips-140-module-validation-status` | whether a cryptographic module's validation is still active |
181
+ | `drinking-water-contaminant-limits` | EPA maximum contaminant levels |
182
+
183
+ `refsource.datasets()` lists them all, offline.
184
+
185
+ ## Data, licensing and accuracy
186
+
187
+ The records are facts with attribution, not reproductions. Each dataset states
188
+ its own licence position and links the source it was read from; the package code
189
+ is MIT. Where a source's terms forbid reuse, the dataset is not published at
190
+ all.
191
+
192
+ No value is ever supplied by this package or by a model — if a source does not
193
+ state something, the row is omitted rather than guessed. Where you need to be
194
+ sure, the quote and the URL are right there: check it.
195
+
196
+ Found something wrong? That is the one thing worth reporting —
197
+ https://referencesource.org/ has the contact and the method behind every
198
+ dataset.
199
+
200
+ ## Related
201
+
202
+ - **MCP server** — the same catalogue as tools for AI assistants:
203
+ `npx referencesource-mcp`, or add
204
+ `https://referencesource.org/mcp` to any MCP client.
205
+ - **Bulk data** — every dataset publishes `data.json` at its own URL, and the
206
+ catalogue is at https://referencesource.org/catalog.json.
@@ -0,0 +1,43 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "refsource"
7
+ version = "0.1.0"
8
+ description = "Look up reference data that carries its own source: every value comes with the URL it was read from and a verbatim quote from that page."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "referencesource.org" }]
13
+ keywords = [
14
+ "reference-data", "citations", "provenance", "verification", "fact-check",
15
+ "regulations", "compliance", "lookup", "datasets", "source-quote",
16
+ ]
17
+ classifiers = [
18
+ "Development Status :: 4 - Beta",
19
+ "Intended Audience :: Developers",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Programming Language :: Python :: 3",
22
+ "Topic :: Scientific/Engineering :: Information Analysis",
23
+ "Topic :: Software Development :: Libraries :: Python Modules",
24
+ "Typing :: Typed",
25
+ ]
26
+ dependencies = []
27
+
28
+ [project.urls]
29
+ Homepage = "https://referencesource.org"
30
+ Catalogue = "https://referencesource.org/catalog.json"
31
+ Method = "https://referencesource.org/method/"
32
+
33
+ [project.scripts]
34
+ refsource = "refsource.__main__:main"
35
+
36
+ [tool.setuptools]
37
+ package-dir = { "" = "src" }
38
+
39
+ [tool.setuptools.packages.find]
40
+ where = ["src"]
41
+
42
+ [tool.setuptools.package-data]
43
+ refsource = ["manifest.json", "py.typed"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+