parsimony-bdf 0.4.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.
- parsimony_bdf-0.4.0/.gitignore +40 -0
- parsimony_bdf-0.4.0/CHANGELOG.md +21 -0
- parsimony_bdf-0.4.0/LICENSE +190 -0
- parsimony_bdf-0.4.0/PKG-INFO +100 -0
- parsimony_bdf-0.4.0/README.md +65 -0
- parsimony_bdf-0.4.0/parsimony_bdf/__init__.py +704 -0
- parsimony_bdf-0.4.0/parsimony_bdf/py.typed +0 -0
- parsimony_bdf-0.4.0/parsimony_bdf/search.py +116 -0
- parsimony_bdf-0.4.0/pyproject.toml +76 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*$py.class
|
|
4
|
+
*.so
|
|
5
|
+
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
dist/
|
|
9
|
+
*.egg-info/
|
|
10
|
+
*.egg
|
|
11
|
+
|
|
12
|
+
.venv/
|
|
13
|
+
.env
|
|
14
|
+
.env.*
|
|
15
|
+
!.env.example
|
|
16
|
+
|
|
17
|
+
.pytest_cache/
|
|
18
|
+
.mypy_cache/
|
|
19
|
+
.ruff_cache/
|
|
20
|
+
.coverage
|
|
21
|
+
htmlcov/
|
|
22
|
+
coverage.xml
|
|
23
|
+
|
|
24
|
+
uv.lock
|
|
25
|
+
|
|
26
|
+
.vscode/
|
|
27
|
+
.council/
|
|
28
|
+
PLAN-*.md
|
|
29
|
+
.idea/
|
|
30
|
+
*.swp
|
|
31
|
+
.DS_Store
|
|
32
|
+
|
|
33
|
+
outputs/
|
|
34
|
+
|
|
35
|
+
# Recorded HTTP cassettes must never be committed — respx mocks are hand-authored
|
|
36
|
+
# from upstream API documentation. A pre-commit / CI regex scan is the belt; this
|
|
37
|
+
# ignore is the braces. Override per-file via `!` if you need a hand-authored
|
|
38
|
+
# fixture checked in.
|
|
39
|
+
packages/*/tests/fixtures/**
|
|
40
|
+
!packages/*/tests/fixtures/README.md
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Changelog — parsimony-bdf
|
|
2
|
+
|
|
3
|
+
All notable changes to `parsimony-bdf` will be documented in this file. The
|
|
4
|
+
format is based on [Keep a Changelog](https://keepachangelog.com/) and
|
|
5
|
+
this project adheres to [Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.4.0] — 2026-04-24
|
|
10
|
+
|
|
11
|
+
Part of the first coordinated release of the
|
|
12
|
+
[`parsimony-connectors`](https://github.com/ockham-sh/parsimony-connectors)
|
|
13
|
+
monorepo under `parsimony-core==0.4`.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- Connector rewritten against the kernel's `parsimony.discover` surface
|
|
18
|
+
(`iter_providers`, `load`, `load_all`) and the `@connector(env=...)`
|
|
19
|
+
decorator-level env-var declaration that replaced module-level
|
|
20
|
+
`ENV_VARS`.
|
|
21
|
+
- Pin bumped to `parsimony-core>=0.4,<0.5`.
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding any notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Ockham.sh
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: parsimony-bdf
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Banque de France connector for the parsimony framework
|
|
5
|
+
Project-URL: Homepage, https://www.banque-france.fr
|
|
6
|
+
Project-URL: Repository, https://github.com/ockham-sh/parsimony-connectors
|
|
7
|
+
Project-URL: Issues, https://github.com/ockham-sh/parsimony-connectors/issues
|
|
8
|
+
Author-email: "Ockham.sh" <team@ockham.sh>
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: bdf,connectors,data,finance,parsimony
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Requires-Dist: pandas<3,>=2.3.0
|
|
25
|
+
Requires-Dist: parsimony-core<0.5,>=0.4.0
|
|
26
|
+
Requires-Dist: pydantic<3,>=2.11.1
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest-asyncio>=1.3.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest>=9.0.3; extra == 'dev'
|
|
32
|
+
Requires-Dist: respx>=0.22.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: ruff>=0.15.10; extra == 'dev'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# parsimony-bdf
|
|
37
|
+
|
|
38
|
+
Banque de France connector — French macroeconomic, monetary, and financial time series via the SDMX-based Webstat API.
|
|
39
|
+
|
|
40
|
+
Part of the [parsimony-connectors](https://github.com/ockham-sh/parsimony-connectors) monorepo. Distributed standalone on PyPI as `parsimony-bdf`.
|
|
41
|
+
|
|
42
|
+
## Connectors
|
|
43
|
+
|
|
44
|
+
| Name | Kind | Description |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| `bdf_fetch` | fetch | Fetch a Banque de France SDMX time series by key (e.g. `EXR.M.USD.EUR.SP00.E`). |
|
|
47
|
+
| `enumerate_bdf` | enumerator | Enumerate all BdF datasets via the SDMX catalogue endpoint. |
|
|
48
|
+
|
|
49
|
+
## Install
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install parsimony-bdf
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Pulls in `parsimony-core>=0.4,<0.5` automatically. Verify discovery:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
python -c "from parsimony import discover; print([p.name for p in discover.iter_providers()])"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Configuration
|
|
62
|
+
|
|
63
|
+
Set the following environment variable:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
export BANQUEDEFRANCE_KEY="<your-key>"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Register for a free key at https://developer.webstat.banque-france.fr/. The key is sent via the `X-IBM-Client-Id` header (IBM API Connect gateway).
|
|
70
|
+
|
|
71
|
+
## Quick start
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
import asyncio
|
|
75
|
+
from parsimony_bdf import CONNECTORS
|
|
76
|
+
|
|
77
|
+
async def main():
|
|
78
|
+
connectors = CONNECTORS.bind_env()
|
|
79
|
+
result = await connectors["bdf_fetch"](key="EXR.M.USD.EUR.SP00.E")
|
|
80
|
+
print(result.data.head())
|
|
81
|
+
|
|
82
|
+
asyncio.run(main())
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
For multi-plugin composition (autoloads everything installed):
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from parsimony import discover
|
|
89
|
+
connectors = discover.load_all().bind_env()
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Provider
|
|
93
|
+
|
|
94
|
+
- Homepage: https://www.banque-france.fr
|
|
95
|
+
- Webstat portal: https://webstat.banque-france.fr
|
|
96
|
+
- Developer portal: https://developer.webstat.banque-france.fr/
|
|
97
|
+
|
|
98
|
+
## License
|
|
99
|
+
|
|
100
|
+
See [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# parsimony-bdf
|
|
2
|
+
|
|
3
|
+
Banque de France connector — French macroeconomic, monetary, and financial time series via the SDMX-based Webstat API.
|
|
4
|
+
|
|
5
|
+
Part of the [parsimony-connectors](https://github.com/ockham-sh/parsimony-connectors) monorepo. Distributed standalone on PyPI as `parsimony-bdf`.
|
|
6
|
+
|
|
7
|
+
## Connectors
|
|
8
|
+
|
|
9
|
+
| Name | Kind | Description |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `bdf_fetch` | fetch | Fetch a Banque de France SDMX time series by key (e.g. `EXR.M.USD.EUR.SP00.E`). |
|
|
12
|
+
| `enumerate_bdf` | enumerator | Enumerate all BdF datasets via the SDMX catalogue endpoint. |
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install parsimony-bdf
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Pulls in `parsimony-core>=0.4,<0.5` automatically. Verify discovery:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
python -c "from parsimony import discover; print([p.name for p in discover.iter_providers()])"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Configuration
|
|
27
|
+
|
|
28
|
+
Set the following environment variable:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
export BANQUEDEFRANCE_KEY="<your-key>"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Register for a free key at https://developer.webstat.banque-france.fr/. The key is sent via the `X-IBM-Client-Id` header (IBM API Connect gateway).
|
|
35
|
+
|
|
36
|
+
## Quick start
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
import asyncio
|
|
40
|
+
from parsimony_bdf import CONNECTORS
|
|
41
|
+
|
|
42
|
+
async def main():
|
|
43
|
+
connectors = CONNECTORS.bind_env()
|
|
44
|
+
result = await connectors["bdf_fetch"](key="EXR.M.USD.EUR.SP00.E")
|
|
45
|
+
print(result.data.head())
|
|
46
|
+
|
|
47
|
+
asyncio.run(main())
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
For multi-plugin composition (autoloads everything installed):
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from parsimony import discover
|
|
54
|
+
connectors = discover.load_all().bind_env()
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Provider
|
|
58
|
+
|
|
59
|
+
- Homepage: https://www.banque-france.fr
|
|
60
|
+
- Webstat portal: https://webstat.banque-france.fr
|
|
61
|
+
- Developer portal: https://developer.webstat.banque-france.fr/
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
See [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,704 @@
|
|
|
1
|
+
"""Banque de France (BdF): fetch + catalog enumeration.
|
|
2
|
+
|
|
3
|
+
API base: ``https://webstat.banque-france.fr/api/explore/v2.1/catalog/datasets``
|
|
4
|
+
(Webstat Opendatasoft public API). Requires a free API key via the
|
|
5
|
+
``BANQUEDEFRANCE_KEY`` environment variable, sent in the
|
|
6
|
+
``Authorization: Apikey <KEY>`` header (literal word ``Apikey`` — *not*
|
|
7
|
+
``Bearer``). Register at https://developer.webstat.banque-france.fr/.
|
|
8
|
+
|
|
9
|
+
The catalog enumerator is series-grained — every individual time series
|
|
10
|
+
across BdF's 45 datasets (~41,607 series total) is published as its own
|
|
11
|
+
row, alongside synthetic ``dataset:`` parent stub rows so agents can
|
|
12
|
+
navigate from search hits to their parent dataset context.
|
|
13
|
+
|
|
14
|
+
Endpoints used:
|
|
15
|
+
|
|
16
|
+
* ``GET /webstat-datasets/exports/json`` — list of 45 datasets in a
|
|
17
|
+
single response (no pagination).
|
|
18
|
+
* ``GET /series/exports/json?refine=dataset_id:{ID}`` — list of every
|
|
19
|
+
series in a given dataset, in a single response. Each row carries
|
|
20
|
+
``series_key``, multilingual titles, time bounds, source agency and a
|
|
21
|
+
JSON-encoded ``series_dimensions_and_values`` dict.
|
|
22
|
+
* ``GET /observations/exports/json?where=series_key="{KEY}"`` — fetch
|
|
23
|
+
observations for a single series. Used by :func:`bdf_fetch`.
|
|
24
|
+
|
|
25
|
+
Quota: 10,000 requests/day. Updates at 9am/1pm/9pm Paris. Full publish
|
|
26
|
+
costs ~46 requests (1 dataset list + 45 series listings); well within
|
|
27
|
+
the daily cap.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
from __future__ import annotations
|
|
31
|
+
|
|
32
|
+
import asyncio
|
|
33
|
+
import json
|
|
34
|
+
import logging
|
|
35
|
+
from typing import Annotated, Any
|
|
36
|
+
|
|
37
|
+
import httpx
|
|
38
|
+
import pandas as pd
|
|
39
|
+
from parsimony.connector import Connectors, connector, enumerator
|
|
40
|
+
from parsimony.errors import EmptyDataError
|
|
41
|
+
from parsimony.result import (
|
|
42
|
+
Column,
|
|
43
|
+
ColumnRole,
|
|
44
|
+
OutputConfig,
|
|
45
|
+
Provenance,
|
|
46
|
+
Result,
|
|
47
|
+
)
|
|
48
|
+
from parsimony.transport import map_http_error
|
|
49
|
+
from pydantic import BaseModel, Field, field_validator
|
|
50
|
+
|
|
51
|
+
logger = logging.getLogger(__name__)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
_BASE_URL = "https://webstat.banque-france.fr/api/explore/v2.1/catalog/datasets"
|
|
55
|
+
|
|
56
|
+
_ENV: dict[str, str] = {"api_key": "BANQUEDEFRANCE_KEY"}
|
|
57
|
+
|
|
58
|
+
# Conservative throttling. The Opendatasoft endpoint is rate-limited
|
|
59
|
+
# globally at 10K requests/day and per-IP at a modest QPS; concurrency=4
|
|
60
|
+
# with a 0.25s inter-request delay keeps enumeration smooth without
|
|
61
|
+
# tripping the WAF.
|
|
62
|
+
_METADATA_CONCURRENCY = 4
|
|
63
|
+
_INTER_REQUEST_DELAY_S = 0.25
|
|
64
|
+
_RETRY_STATUSES = frozenset({429, 500, 502, 503, 504})
|
|
65
|
+
_RETRY_BACKOFFS_S: tuple[float, ...] = (1.0, 2.0, 4.0)
|
|
66
|
+
|
|
67
|
+
# Cap descriptions before they reach the embedder. BdF titles are short,
|
|
68
|
+
# but bilingual concatenation can expand the description meaningfully —
|
|
69
|
+
# a hard cap keeps the embedder context-window-safe.
|
|
70
|
+
_DESCRIPTION_CHAR_CAP = 1500
|
|
71
|
+
|
|
72
|
+
# Series payloads can be 1.6MB+ (the full series listing for big
|
|
73
|
+
# datasets); allow long reads.
|
|
74
|
+
_HTTP_TIMEOUT = httpx.Timeout(connect=30.0, read=120.0, write=30.0, pool=30.0)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
# ---------------------------------------------------------------------------
|
|
78
|
+
# Parameter models
|
|
79
|
+
# ---------------------------------------------------------------------------
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class BdfFetchParams(BaseModel):
|
|
83
|
+
"""Parameters for fetching Banque de France time series."""
|
|
84
|
+
|
|
85
|
+
key: Annotated[str, "ns:bdf"] = Field(
|
|
86
|
+
...,
|
|
87
|
+
description=(
|
|
88
|
+
"Dot-separated SDMX series key as published by BdF Webstat "
|
|
89
|
+
"(e.g. EXR.D.USD.EUR.SP00.A or ICP.M.FR.N.000000.4.ANR). "
|
|
90
|
+
"Discover keys via bdf_search or enumerate_bdf."
|
|
91
|
+
),
|
|
92
|
+
)
|
|
93
|
+
start_period: str | None = Field(
|
|
94
|
+
default=None,
|
|
95
|
+
description="Start period (YYYY-MM-DD); filters time_period_start.",
|
|
96
|
+
)
|
|
97
|
+
end_period: str | None = Field(
|
|
98
|
+
default=None,
|
|
99
|
+
description="End period (YYYY-MM-DD); filters time_period_start.",
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
@field_validator("key")
|
|
103
|
+
@classmethod
|
|
104
|
+
def _non_empty(cls, v: str) -> str:
|
|
105
|
+
v = v.strip()
|
|
106
|
+
if not v:
|
|
107
|
+
raise ValueError("key must be non-empty")
|
|
108
|
+
return v
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
class BdfEnumerateParams(BaseModel):
|
|
112
|
+
"""No parameters needed — enumerates BdF datasets and series."""
|
|
113
|
+
|
|
114
|
+
pass
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
# ---------------------------------------------------------------------------
|
|
118
|
+
# Output configs
|
|
119
|
+
# ---------------------------------------------------------------------------
|
|
120
|
+
|
|
121
|
+
BDF_ENUMERATE_OUTPUT = OutputConfig(
|
|
122
|
+
columns=[
|
|
123
|
+
# KEY shape:
|
|
124
|
+
# * dataset rows — ``"dataset:{dataset_id}"`` (45 of these).
|
|
125
|
+
# * series rows — the raw ``series_key`` (already globally unique
|
|
126
|
+
# e.g. ``EXR.M.USD.EUR.SP00.A``); not prefixed.
|
|
127
|
+
# The synthetic ``dataset:`` prefix mirrors BoJ's ``db:`` and BdP's
|
|
128
|
+
# ``dataset:`` so downstream consumers can split entity types by
|
|
129
|
+
# KEY alone (or by the ``entity_type`` METADATA column).
|
|
130
|
+
Column(name="code", role=ColumnRole.KEY, namespace="bdf"),
|
|
131
|
+
Column(name="title", role=ColumnRole.TITLE),
|
|
132
|
+
Column(name="description", role=ColumnRole.DESCRIPTION),
|
|
133
|
+
Column(name="entity_type", role=ColumnRole.METADATA), # "dataset" | "series"
|
|
134
|
+
Column(name="dataset_id", role=ColumnRole.METADATA),
|
|
135
|
+
Column(name="dataset_description", role=ColumnRole.METADATA),
|
|
136
|
+
Column(name="series_key", role=ColumnRole.METADATA),
|
|
137
|
+
Column(name="title_fr", role=ColumnRole.METADATA),
|
|
138
|
+
Column(name="title_long_en", role=ColumnRole.METADATA),
|
|
139
|
+
Column(name="title_long_fr", role=ColumnRole.METADATA),
|
|
140
|
+
Column(name="frequency", role=ColumnRole.METADATA),
|
|
141
|
+
Column(name="ref_area", role=ColumnRole.METADATA),
|
|
142
|
+
Column(name="first_time_period", role=ColumnRole.METADATA),
|
|
143
|
+
Column(name="last_time_period", role=ColumnRole.METADATA),
|
|
144
|
+
Column(name="source_agency", role=ColumnRole.METADATA),
|
|
145
|
+
Column(name="dimensions_json", role=ColumnRole.METADATA),
|
|
146
|
+
]
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
BDF_FETCH_OUTPUT = OutputConfig(
|
|
150
|
+
columns=[
|
|
151
|
+
Column(name="key", role=ColumnRole.KEY, param_key="key", namespace="bdf"),
|
|
152
|
+
Column(name="title", role=ColumnRole.TITLE),
|
|
153
|
+
Column(name="date", dtype="datetime", role=ColumnRole.DATA),
|
|
154
|
+
Column(name="value", dtype="numeric", role=ColumnRole.DATA),
|
|
155
|
+
]
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
_ENUMERATE_COLUMNS: tuple[str, ...] = (
|
|
160
|
+
"code",
|
|
161
|
+
"title",
|
|
162
|
+
"description",
|
|
163
|
+
"entity_type",
|
|
164
|
+
"dataset_id",
|
|
165
|
+
"dataset_description",
|
|
166
|
+
"series_key",
|
|
167
|
+
"title_fr",
|
|
168
|
+
"title_long_en",
|
|
169
|
+
"title_long_fr",
|
|
170
|
+
"frequency",
|
|
171
|
+
"ref_area",
|
|
172
|
+
"first_time_period",
|
|
173
|
+
"last_time_period",
|
|
174
|
+
"source_agency",
|
|
175
|
+
"dimensions_json",
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
# ---------------------------------------------------------------------------
|
|
180
|
+
# Helpers
|
|
181
|
+
# ---------------------------------------------------------------------------
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def _truncate(text: str, cap: int = _DESCRIPTION_CHAR_CAP) -> str:
|
|
185
|
+
"""Cap a string at ``cap`` chars; return as-is if shorter."""
|
|
186
|
+
if not text:
|
|
187
|
+
return ""
|
|
188
|
+
if len(text) <= cap:
|
|
189
|
+
return text
|
|
190
|
+
return text[:cap].rstrip()
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def _retry_after_seconds(response: httpx.Response) -> float | None:
|
|
194
|
+
"""Parse the ``Retry-After`` header; ``None`` if absent/malformed."""
|
|
195
|
+
raw = response.headers.get("Retry-After")
|
|
196
|
+
if not raw:
|
|
197
|
+
return None
|
|
198
|
+
try:
|
|
199
|
+
return float(raw)
|
|
200
|
+
except ValueError:
|
|
201
|
+
return None
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def _auth_headers(api_key: str) -> dict[str, str]:
|
|
205
|
+
"""Build the BdF Webstat Opendatasoft auth + transport headers.
|
|
206
|
+
|
|
207
|
+
Note the literal ``Apikey`` token (not ``Bearer``) — Opendatasoft's
|
|
208
|
+
auth scheme is non-standard.
|
|
209
|
+
"""
|
|
210
|
+
return {
|
|
211
|
+
"Authorization": f"Apikey {api_key}",
|
|
212
|
+
"Accept": "application/json",
|
|
213
|
+
"User-Agent": "parsimony-bdf/0.1",
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
async def _get_json(
|
|
218
|
+
client: httpx.AsyncClient,
|
|
219
|
+
url: str,
|
|
220
|
+
*,
|
|
221
|
+
semaphore: asyncio.Semaphore,
|
|
222
|
+
params: dict[str, str] | None = None,
|
|
223
|
+
) -> Any | None:
|
|
224
|
+
"""GET ``url`` and return the parsed JSON body.
|
|
225
|
+
|
|
226
|
+
Retries 429/5xx with exponential backoff and honors ``Retry-After``.
|
|
227
|
+
On exhausted retries / network errors / non-JSON bodies, logs a
|
|
228
|
+
WARNING and returns ``None`` so the caller can decide whether to
|
|
229
|
+
skip.
|
|
230
|
+
"""
|
|
231
|
+
async with semaphore:
|
|
232
|
+
await asyncio.sleep(_INTER_REQUEST_DELAY_S)
|
|
233
|
+
last_status: int | None = None
|
|
234
|
+
last_error: str | None = None
|
|
235
|
+
for attempt, backoff in enumerate((*_RETRY_BACKOFFS_S, None)):
|
|
236
|
+
try:
|
|
237
|
+
response = await client.get(url, params=params)
|
|
238
|
+
except httpx.HTTPError as exc:
|
|
239
|
+
last_error = f"{type(exc).__name__}: {exc}"
|
|
240
|
+
if backoff is None:
|
|
241
|
+
break
|
|
242
|
+
await asyncio.sleep(backoff)
|
|
243
|
+
continue
|
|
244
|
+
|
|
245
|
+
if response.status_code == 200:
|
|
246
|
+
try:
|
|
247
|
+
return response.json()
|
|
248
|
+
except ValueError as exc:
|
|
249
|
+
logger.warning("BdF %s returned non-JSON body: %s", url, exc)
|
|
250
|
+
return None
|
|
251
|
+
|
|
252
|
+
last_status = response.status_code
|
|
253
|
+
if response.status_code in _RETRY_STATUSES and backoff is not None:
|
|
254
|
+
wait = _retry_after_seconds(response) or backoff
|
|
255
|
+
logger.info(
|
|
256
|
+
"BdF %s returned %s (attempt %d); retrying in %.1fs",
|
|
257
|
+
url,
|
|
258
|
+
response.status_code,
|
|
259
|
+
attempt + 1,
|
|
260
|
+
wait,
|
|
261
|
+
)
|
|
262
|
+
await asyncio.sleep(wait)
|
|
263
|
+
continue
|
|
264
|
+
break
|
|
265
|
+
|
|
266
|
+
logger.warning(
|
|
267
|
+
"BdF fetch failed for %s after retries (last_status=%s, last_error=%s)",
|
|
268
|
+
url,
|
|
269
|
+
last_status,
|
|
270
|
+
last_error,
|
|
271
|
+
)
|
|
272
|
+
return None
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
def _parse_dimensions(raw: str | None) -> dict[str, Any]:
|
|
276
|
+
"""Decode the ``series_dimensions_and_values`` JSON-string field.
|
|
277
|
+
|
|
278
|
+
BdF emits the dimensions dict as a JSON-encoded *string* (not a
|
|
279
|
+
nested object) in the JSON response. Returns an empty dict on
|
|
280
|
+
missing / malformed input.
|
|
281
|
+
"""
|
|
282
|
+
if not raw:
|
|
283
|
+
return {}
|
|
284
|
+
try:
|
|
285
|
+
decoded = json.loads(raw)
|
|
286
|
+
except (TypeError, ValueError):
|
|
287
|
+
return {}
|
|
288
|
+
if not isinstance(decoded, dict):
|
|
289
|
+
return {}
|
|
290
|
+
return decoded
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
def _dataset_title(dataset_id: str, description_en: str) -> str:
|
|
294
|
+
"""Pick the dataset row's TITLE: dataset_id, or description_en capped."""
|
|
295
|
+
desc = (description_en or "").strip()
|
|
296
|
+
if desc:
|
|
297
|
+
return desc[:90]
|
|
298
|
+
return dataset_id
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
def _dataset_description(*, description_en: str, description_fr: str) -> str:
|
|
302
|
+
"""Combine EN + FR descriptions for the embedder, deduping if equal."""
|
|
303
|
+
en = (description_en or "").strip()
|
|
304
|
+
fr = (description_fr or "").strip()
|
|
305
|
+
if en and fr:
|
|
306
|
+
if en.lower() == fr.lower():
|
|
307
|
+
return _truncate(en)
|
|
308
|
+
return _truncate(f"{en} | {fr}")
|
|
309
|
+
return _truncate(en or fr)
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
def _series_title(
|
|
313
|
+
*,
|
|
314
|
+
title_en: str,
|
|
315
|
+
title_fr: str,
|
|
316
|
+
title_long_en: str,
|
|
317
|
+
title_long_fr: str,
|
|
318
|
+
series_key: str,
|
|
319
|
+
) -> str:
|
|
320
|
+
"""Pick the most informative non-empty title for a series row."""
|
|
321
|
+
for candidate in (title_en, title_fr, title_long_en, title_long_fr):
|
|
322
|
+
cand = (candidate or "").strip()
|
|
323
|
+
if cand:
|
|
324
|
+
return cand
|
|
325
|
+
return series_key
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
def _series_description(
|
|
329
|
+
*,
|
|
330
|
+
title_en: str,
|
|
331
|
+
title_fr: str,
|
|
332
|
+
title_long_en: str,
|
|
333
|
+
title_long_fr: str,
|
|
334
|
+
dataset_id: str,
|
|
335
|
+
dataset_description: str,
|
|
336
|
+
source_agency: str,
|
|
337
|
+
) -> str:
|
|
338
|
+
"""Build a bilingual series description for the embedder.
|
|
339
|
+
|
|
340
|
+
Folds EN + FR titles plus dataset context into one string so the
|
|
341
|
+
multilingual embedder sees both languages and the parent dataset's
|
|
342
|
+
semantic context. EN/FR halves are deduped when identical.
|
|
343
|
+
"""
|
|
344
|
+
en_part = (title_long_en or title_en or "").strip()
|
|
345
|
+
fr_part = (title_long_fr or title_fr or "").strip()
|
|
346
|
+
|
|
347
|
+
bilingual: str
|
|
348
|
+
if en_part and fr_part:
|
|
349
|
+
bilingual = en_part if en_part.lower() == fr_part.lower() else f"{en_part} | {fr_part}"
|
|
350
|
+
else:
|
|
351
|
+
bilingual = en_part or fr_part
|
|
352
|
+
|
|
353
|
+
chunks: list[str] = []
|
|
354
|
+
if bilingual:
|
|
355
|
+
chunks.append(bilingual)
|
|
356
|
+
if dataset_id:
|
|
357
|
+
ds_ctx = f"Dataset: {dataset_id}"
|
|
358
|
+
if dataset_description:
|
|
359
|
+
ds_ctx += f" ({dataset_description})"
|
|
360
|
+
ds_ctx += "."
|
|
361
|
+
chunks.append(ds_ctx)
|
|
362
|
+
if source_agency:
|
|
363
|
+
chunks.append(f"Source: {source_agency}.")
|
|
364
|
+
return _truncate(" | ".join(c for c in chunks if c).strip())
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
# ---------------------------------------------------------------------------
|
|
368
|
+
# Connectors
|
|
369
|
+
# ---------------------------------------------------------------------------
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
@connector(env=_ENV, output=BDF_FETCH_OUTPUT, tags=["macro", "fr"])
|
|
373
|
+
async def bdf_fetch(params: BdfFetchParams, *, api_key: str) -> Result:
|
|
374
|
+
"""Fetch Banque de France time series via the Webstat Opendatasoft API.
|
|
375
|
+
|
|
376
|
+
Pulls observation rows for a single series key and returns
|
|
377
|
+
``(key, title, date, value)`` rows. Optional ``start_period`` /
|
|
378
|
+
``end_period`` filter on ``time_period_start``.
|
|
379
|
+
"""
|
|
380
|
+
headers = _auth_headers(api_key)
|
|
381
|
+
where = f'series_key="{params.key}"'
|
|
382
|
+
if params.start_period:
|
|
383
|
+
where += f" and time_period_start>=date'{params.start_period}'"
|
|
384
|
+
if params.end_period:
|
|
385
|
+
where += f" and time_period_start<=date'{params.end_period}'"
|
|
386
|
+
|
|
387
|
+
req_params: dict[str, str] = {
|
|
388
|
+
"select": (
|
|
389
|
+
"series_key,title_en,title_fr,time_period,"
|
|
390
|
+
"time_period_start,time_period_end,obs_value,obs_status"
|
|
391
|
+
),
|
|
392
|
+
"where": where,
|
|
393
|
+
"order_by": "time_period_start",
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
url = f"{_BASE_URL}/observations/exports/json"
|
|
397
|
+
|
|
398
|
+
async with httpx.AsyncClient(timeout=_HTTP_TIMEOUT, headers=headers) as client:
|
|
399
|
+
response = await client.get(url, params=req_params)
|
|
400
|
+
try:
|
|
401
|
+
response.raise_for_status()
|
|
402
|
+
except httpx.HTTPStatusError as exc:
|
|
403
|
+
map_http_error(exc, provider="bdf", op_name="observations")
|
|
404
|
+
try:
|
|
405
|
+
payload = response.json()
|
|
406
|
+
except ValueError as exc:
|
|
407
|
+
raise EmptyDataError(
|
|
408
|
+
provider="bdf",
|
|
409
|
+
message=f"BdF returned non-JSON body for key={params.key}: {exc}",
|
|
410
|
+
) from exc
|
|
411
|
+
|
|
412
|
+
if not isinstance(payload, list) or not payload:
|
|
413
|
+
raise EmptyDataError(provider="bdf", message=f"No data returned for key: {params.key}")
|
|
414
|
+
|
|
415
|
+
rows: list[dict[str, Any]] = []
|
|
416
|
+
for row in payload:
|
|
417
|
+
if not isinstance(row, dict):
|
|
418
|
+
continue
|
|
419
|
+
date_str = row.get("time_period_start") or row.get("time_period") or ""
|
|
420
|
+
if not date_str:
|
|
421
|
+
continue
|
|
422
|
+
raw_value = row.get("obs_value")
|
|
423
|
+
try:
|
|
424
|
+
value = float(raw_value) if raw_value is not None else None
|
|
425
|
+
except (ValueError, TypeError):
|
|
426
|
+
value = None
|
|
427
|
+
title = (
|
|
428
|
+
row.get("title_en")
|
|
429
|
+
or row.get("title_fr")
|
|
430
|
+
or row.get("series_key")
|
|
431
|
+
or params.key
|
|
432
|
+
)
|
|
433
|
+
rows.append(
|
|
434
|
+
{
|
|
435
|
+
"key": str(row.get("series_key") or params.key),
|
|
436
|
+
"title": str(title),
|
|
437
|
+
"date": str(date_str),
|
|
438
|
+
"value": value,
|
|
439
|
+
}
|
|
440
|
+
)
|
|
441
|
+
|
|
442
|
+
if not rows:
|
|
443
|
+
raise EmptyDataError(
|
|
444
|
+
provider="bdf",
|
|
445
|
+
message=f"No observations parsed for key: {params.key}",
|
|
446
|
+
)
|
|
447
|
+
|
|
448
|
+
return Result.from_dataframe(
|
|
449
|
+
pd.DataFrame(rows),
|
|
450
|
+
Provenance(
|
|
451
|
+
source="bdf",
|
|
452
|
+
params={"key": params.key},
|
|
453
|
+
properties={"source_url": "https://webstat.banque-france.fr"},
|
|
454
|
+
),
|
|
455
|
+
)
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
# ---------------------------------------------------------------------------
|
|
459
|
+
# Enumerator helpers
|
|
460
|
+
# ---------------------------------------------------------------------------
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
async def _list_datasets(
|
|
464
|
+
client: httpx.AsyncClient,
|
|
465
|
+
semaphore: asyncio.Semaphore,
|
|
466
|
+
) -> list[dict[str, Any]]:
|
|
467
|
+
"""Return every BdF dataset (45 entries) in a single request."""
|
|
468
|
+
url = f"{_BASE_URL}/webstat-datasets/exports/json"
|
|
469
|
+
params = {
|
|
470
|
+
"select": (
|
|
471
|
+
"dataset_id,description_en,description_fr,"
|
|
472
|
+
"series_count,last_observation_date"
|
|
473
|
+
),
|
|
474
|
+
"order_by": "dataset_id",
|
|
475
|
+
}
|
|
476
|
+
payload = await _get_json(client, url, params=params, semaphore=semaphore)
|
|
477
|
+
if not isinstance(payload, list):
|
|
478
|
+
return []
|
|
479
|
+
return [d for d in payload if isinstance(d, dict)]
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
async def _list_series(
|
|
483
|
+
client: httpx.AsyncClient,
|
|
484
|
+
dataset_id: str,
|
|
485
|
+
semaphore: asyncio.Semaphore,
|
|
486
|
+
) -> list[dict[str, Any]] | None:
|
|
487
|
+
"""Return every series row for ``dataset_id``.
|
|
488
|
+
|
|
489
|
+
The Webstat Opendatasoft series export returns the full listing in
|
|
490
|
+
one response (no pagination needed, even for the largest datasets).
|
|
491
|
+
Returns ``None`` on transport / parse failure so the caller can
|
|
492
|
+
decide to skip the dataset's series rows but still emit the dataset
|
|
493
|
+
stub.
|
|
494
|
+
"""
|
|
495
|
+
url = f"{_BASE_URL}/series/exports/json"
|
|
496
|
+
params = {
|
|
497
|
+
"select": (
|
|
498
|
+
"series_key,title_fr,title_en,title_long_fr,title_long_en,"
|
|
499
|
+
"first_time_period_date,last_time_period_date,source_agency,"
|
|
500
|
+
"series_dimensions_and_values"
|
|
501
|
+
),
|
|
502
|
+
"refine": f"dataset_id:{dataset_id}",
|
|
503
|
+
}
|
|
504
|
+
payload = await _get_json(client, url, params=params, semaphore=semaphore)
|
|
505
|
+
if payload is None:
|
|
506
|
+
return None
|
|
507
|
+
if not isinstance(payload, list):
|
|
508
|
+
return []
|
|
509
|
+
return [s for s in payload if isinstance(s, dict)]
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
def _emit_rows_for_dataset(
|
|
513
|
+
*,
|
|
514
|
+
dataset: dict[str, Any],
|
|
515
|
+
series_rows: list[dict[str, Any]],
|
|
516
|
+
) -> list[dict[str, str]]:
|
|
517
|
+
"""Build catalog rows for a single dataset (1 stub + N series)."""
|
|
518
|
+
dataset_id = str(dataset.get("dataset_id") or "").strip()
|
|
519
|
+
if not dataset_id:
|
|
520
|
+
return []
|
|
521
|
+
description_en = str(dataset.get("description_en") or "").strip()
|
|
522
|
+
description_fr = str(dataset.get("description_fr") or "").strip()
|
|
523
|
+
dataset_desc_canonical = description_en or description_fr
|
|
524
|
+
|
|
525
|
+
rows: list[dict[str, str]] = []
|
|
526
|
+
|
|
527
|
+
# Dataset stub row.
|
|
528
|
+
rows.append(
|
|
529
|
+
{
|
|
530
|
+
"code": f"dataset:{dataset_id}",
|
|
531
|
+
"title": _dataset_title(dataset_id, description_en),
|
|
532
|
+
"description": _dataset_description(
|
|
533
|
+
description_en=description_en,
|
|
534
|
+
description_fr=description_fr,
|
|
535
|
+
),
|
|
536
|
+
"entity_type": "dataset",
|
|
537
|
+
"dataset_id": dataset_id,
|
|
538
|
+
"dataset_description": dataset_desc_canonical,
|
|
539
|
+
"series_key": "",
|
|
540
|
+
"title_fr": "",
|
|
541
|
+
"title_long_en": "",
|
|
542
|
+
"title_long_fr": "",
|
|
543
|
+
"frequency": "",
|
|
544
|
+
"ref_area": "",
|
|
545
|
+
"first_time_period": "",
|
|
546
|
+
"last_time_period": "",
|
|
547
|
+
"source_agency": "",
|
|
548
|
+
"dimensions_json": "",
|
|
549
|
+
}
|
|
550
|
+
)
|
|
551
|
+
|
|
552
|
+
# Series rows.
|
|
553
|
+
for series in series_rows:
|
|
554
|
+
series_key = str(series.get("series_key") or "").strip()
|
|
555
|
+
if not series_key:
|
|
556
|
+
continue
|
|
557
|
+
title_en = str(series.get("title_en") or "").strip()
|
|
558
|
+
title_fr = str(series.get("title_fr") or "").strip()
|
|
559
|
+
title_long_en = str(series.get("title_long_en") or "").strip()
|
|
560
|
+
title_long_fr = str(series.get("title_long_fr") or "").strip()
|
|
561
|
+
first_period = str(series.get("first_time_period_date") or "").strip()
|
|
562
|
+
last_period = str(series.get("last_time_period_date") or "").strip()
|
|
563
|
+
source_agency = str(series.get("source_agency") or "").strip()
|
|
564
|
+
dims_raw = series.get("series_dimensions_and_values")
|
|
565
|
+
dims_str = dims_raw if isinstance(dims_raw, str) else ""
|
|
566
|
+
dims = _parse_dimensions(dims_str)
|
|
567
|
+
frequency = str(dims.get("FREQ") or "").strip()
|
|
568
|
+
ref_area = str(dims.get("REF_AREA") or "").strip()
|
|
569
|
+
|
|
570
|
+
rows.append(
|
|
571
|
+
{
|
|
572
|
+
"code": series_key,
|
|
573
|
+
"title": _series_title(
|
|
574
|
+
title_en=title_en,
|
|
575
|
+
title_fr=title_fr,
|
|
576
|
+
title_long_en=title_long_en,
|
|
577
|
+
title_long_fr=title_long_fr,
|
|
578
|
+
series_key=series_key,
|
|
579
|
+
),
|
|
580
|
+
"description": _series_description(
|
|
581
|
+
title_en=title_en,
|
|
582
|
+
title_fr=title_fr,
|
|
583
|
+
title_long_en=title_long_en,
|
|
584
|
+
title_long_fr=title_long_fr,
|
|
585
|
+
dataset_id=dataset_id,
|
|
586
|
+
dataset_description=dataset_desc_canonical,
|
|
587
|
+
source_agency=source_agency,
|
|
588
|
+
),
|
|
589
|
+
"entity_type": "series",
|
|
590
|
+
"dataset_id": dataset_id,
|
|
591
|
+
"dataset_description": dataset_desc_canonical,
|
|
592
|
+
"series_key": series_key,
|
|
593
|
+
"title_fr": title_fr,
|
|
594
|
+
"title_long_en": title_long_en,
|
|
595
|
+
"title_long_fr": title_long_fr,
|
|
596
|
+
"frequency": frequency,
|
|
597
|
+
"ref_area": ref_area,
|
|
598
|
+
"first_time_period": first_period,
|
|
599
|
+
"last_time_period": last_period,
|
|
600
|
+
"source_agency": source_agency,
|
|
601
|
+
"dimensions_json": dims_str,
|
|
602
|
+
}
|
|
603
|
+
)
|
|
604
|
+
|
|
605
|
+
return rows
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
@enumerator(env=_ENV, output=BDF_ENUMERATE_OUTPUT, tags=["macro", "fr"])
|
|
609
|
+
async def enumerate_bdf(params: BdfEnumerateParams, *, api_key: str) -> pd.DataFrame:
|
|
610
|
+
"""Enumerate every BdF series with parent dataset context.
|
|
611
|
+
|
|
612
|
+
Pipeline:
|
|
613
|
+
|
|
614
|
+
1. ``GET /webstat-datasets/exports/json`` — pull all 45 datasets in
|
|
615
|
+
a single request.
|
|
616
|
+
2. For each dataset, ``GET /series/exports/json?refine=dataset_id:{ID}``
|
|
617
|
+
— pull all series for that dataset (full listing in one
|
|
618
|
+
response).
|
|
619
|
+
3. Emit one ``entity_type='dataset'`` stub per dataset (~45) and one
|
|
620
|
+
``entity_type='series'`` row per discovered series (~41,607).
|
|
621
|
+
|
|
622
|
+
Concurrency is capped at 4 with a 0.25 s inter-request delay; 429/
|
|
623
|
+
5xx responses retry up to 3 times with exponential backoff and
|
|
624
|
+
honor ``Retry-After``. After exhausting retries the affected
|
|
625
|
+
dataset's series rows are skipped (the dataset stub is still
|
|
626
|
+
emitted) with a WARNING.
|
|
627
|
+
|
|
628
|
+
Cost: ~46 requests total (well under the 10K/day quota).
|
|
629
|
+
"""
|
|
630
|
+
del params
|
|
631
|
+
|
|
632
|
+
semaphore = asyncio.Semaphore(_METADATA_CONCURRENCY)
|
|
633
|
+
rows: list[dict[str, str]] = []
|
|
634
|
+
failed_datasets: list[str] = []
|
|
635
|
+
|
|
636
|
+
async with httpx.AsyncClient(
|
|
637
|
+
timeout=_HTTP_TIMEOUT,
|
|
638
|
+
headers=_auth_headers(api_key),
|
|
639
|
+
follow_redirects=True,
|
|
640
|
+
) as client:
|
|
641
|
+
datasets = await _list_datasets(client, semaphore)
|
|
642
|
+
if not datasets:
|
|
643
|
+
logger.warning("BdF enumerate: dataset list fetch failed; emitting empty catalog")
|
|
644
|
+
return pd.DataFrame(columns=list(_ENUMERATE_COLUMNS))
|
|
645
|
+
|
|
646
|
+
logger.info("BdF enumerate: discovered %d datasets", len(datasets))
|
|
647
|
+
|
|
648
|
+
async def _crawl_one(dataset: dict[str, Any]) -> list[dict[str, str]]:
|
|
649
|
+
dataset_id = str(dataset.get("dataset_id") or "").strip()
|
|
650
|
+
if not dataset_id:
|
|
651
|
+
return []
|
|
652
|
+
series_rows = await _list_series(client, dataset_id, semaphore)
|
|
653
|
+
if series_rows is None:
|
|
654
|
+
# Transport failure — emit dataset stub only, log warning.
|
|
655
|
+
failed_datasets.append(dataset_id)
|
|
656
|
+
series_rows = []
|
|
657
|
+
return _emit_rows_for_dataset(dataset=dataset, series_rows=series_rows)
|
|
658
|
+
|
|
659
|
+
per_dataset_rows = await asyncio.gather(*[_crawl_one(d) for d in datasets])
|
|
660
|
+
for batch in per_dataset_rows:
|
|
661
|
+
rows.extend(batch)
|
|
662
|
+
|
|
663
|
+
if failed_datasets:
|
|
664
|
+
logger.warning(
|
|
665
|
+
"BdF enumerate: %d datasets failed series fetch (stubs emitted, series omitted): %s",
|
|
666
|
+
len(failed_datasets),
|
|
667
|
+
", ".join(failed_datasets[:20]),
|
|
668
|
+
)
|
|
669
|
+
else:
|
|
670
|
+
logger.info("BdF enumerate: emitted %d rows", len(rows))
|
|
671
|
+
|
|
672
|
+
columns = list(_ENUMERATE_COLUMNS)
|
|
673
|
+
return pd.DataFrame(rows, columns=columns) if rows else pd.DataFrame(columns=columns)
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
# ---------------------------------------------------------------------------
|
|
677
|
+
# Exports
|
|
678
|
+
# ---------------------------------------------------------------------------
|
|
679
|
+
|
|
680
|
+
from parsimony_bdf.search import ( # noqa: E402 (after public decorators)
|
|
681
|
+
BDF_SEARCH_OUTPUT,
|
|
682
|
+
PARSIMONY_BDF_CATALOG_URL_ENV,
|
|
683
|
+
BdfSearchParams,
|
|
684
|
+
bdf_search,
|
|
685
|
+
)
|
|
686
|
+
|
|
687
|
+
CATALOGS: list[tuple[str, object]] = [("bdf", enumerate_bdf)]
|
|
688
|
+
|
|
689
|
+
CONNECTORS = Connectors([bdf_fetch, enumerate_bdf, bdf_search])
|
|
690
|
+
|
|
691
|
+
__all__ = [
|
|
692
|
+
"BDF_ENUMERATE_OUTPUT",
|
|
693
|
+
"BDF_FETCH_OUTPUT",
|
|
694
|
+
"BDF_SEARCH_OUTPUT",
|
|
695
|
+
"CATALOGS",
|
|
696
|
+
"CONNECTORS",
|
|
697
|
+
"BdfEnumerateParams",
|
|
698
|
+
"BdfFetchParams",
|
|
699
|
+
"BdfSearchParams",
|
|
700
|
+
"PARSIMONY_BDF_CATALOG_URL_ENV",
|
|
701
|
+
"bdf_fetch",
|
|
702
|
+
"bdf_search",
|
|
703
|
+
"enumerate_bdf",
|
|
704
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"""Semantic search over the published Banque de France (BdF) catalog.
|
|
2
|
+
|
|
3
|
+
Wraps the parquet+FAISS catalog at ``hf://parsimony-dev/bdf`` (override
|
|
4
|
+
with ``PARSIMONY_BDF_CATALOG_URL`` for local testing) as an MCP tool.
|
|
5
|
+
|
|
6
|
+
Codes returned by this tool fall into two families:
|
|
7
|
+
|
|
8
|
+
* ``"<series_key>"`` — a single series (dot-separated SDMX key, e.g.
|
|
9
|
+
``"EXR.D.USD.EUR.SP00.A"``). Pass directly to :func:`bdf_fetch` via
|
|
10
|
+
the ``key`` parameter.
|
|
11
|
+
* ``"dataset:{dataset_id}"`` — a whole dataset (a coherent bundle of
|
|
12
|
+
series). Strip the ``dataset:`` prefix to get the dataset id; the
|
|
13
|
+
individual series codes inside that dataset can be discovered via
|
|
14
|
+
another search refined on the dataset name.
|
|
15
|
+
|
|
16
|
+
The catalog row's ``entity_type`` METADATA column makes the prefix
|
|
17
|
+
unambiguous for downstream consumers that prefer not to parse the KEY.
|
|
18
|
+
The catalog is embedded with a *multilingual* model
|
|
19
|
+
(``paraphrase-multilingual-MiniLM-L12-v2``) because BdF metadata is
|
|
20
|
+
bilingual (FR + EN) — French queries hit the row directly via the
|
|
21
|
+
shared embedding space, not just via subword overlap.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
from __future__ import annotations
|
|
25
|
+
|
|
26
|
+
import asyncio
|
|
27
|
+
import logging
|
|
28
|
+
import os
|
|
29
|
+
from typing import Annotated
|
|
30
|
+
|
|
31
|
+
import pandas as pd
|
|
32
|
+
from parsimony.catalog import Catalog
|
|
33
|
+
from parsimony.connector import connector
|
|
34
|
+
from parsimony.result import Column, ColumnRole, OutputConfig
|
|
35
|
+
from pydantic import BaseModel, Field
|
|
36
|
+
|
|
37
|
+
logger = logging.getLogger(__name__)
|
|
38
|
+
|
|
39
|
+
PARSIMONY_BDF_CATALOG_URL_ENV = "PARSIMONY_BDF_CATALOG_URL"
|
|
40
|
+
_DEFAULT_CATALOG_URL = "hf://parsimony-dev/bdf"
|
|
41
|
+
|
|
42
|
+
_catalog: Catalog | None = None
|
|
43
|
+
_catalog_lock = asyncio.Lock()
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
async def _get_catalog() -> Catalog:
|
|
47
|
+
global _catalog
|
|
48
|
+
if _catalog is not None:
|
|
49
|
+
return _catalog
|
|
50
|
+
async with _catalog_lock:
|
|
51
|
+
if _catalog is None:
|
|
52
|
+
url = os.environ.get(PARSIMONY_BDF_CATALOG_URL_ENV, _DEFAULT_CATALOG_URL)
|
|
53
|
+
logger.info("loading BdF catalog from %s", url)
|
|
54
|
+
_catalog = await Catalog.from_url(url)
|
|
55
|
+
return _catalog
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
BDF_SEARCH_OUTPUT = OutputConfig(
|
|
59
|
+
columns=[
|
|
60
|
+
Column(name="code", role=ColumnRole.KEY, namespace="bdf"),
|
|
61
|
+
Column(name="title", role=ColumnRole.TITLE),
|
|
62
|
+
Column(name="similarity", role=ColumnRole.METADATA),
|
|
63
|
+
]
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class BdfSearchParams(BaseModel):
|
|
68
|
+
"""Parameters for :func:`bdf_search`."""
|
|
69
|
+
|
|
70
|
+
query: Annotated[
|
|
71
|
+
str,
|
|
72
|
+
Field(
|
|
73
|
+
min_length=1,
|
|
74
|
+
max_length=512,
|
|
75
|
+
description=(
|
|
76
|
+
"Natural-language description of the BdF series or dataset "
|
|
77
|
+
"you want (e.g. 'France inflation rate', 'EUR USD exchange "
|
|
78
|
+
"rate', 'taux de change euro dollar', 'dette publique "
|
|
79
|
+
"française'). French and English queries both work — the "
|
|
80
|
+
"catalog is embedded with a multilingual model."
|
|
81
|
+
),
|
|
82
|
+
),
|
|
83
|
+
]
|
|
84
|
+
limit: int = Field(default=10, ge=1, le=50, description="Top-N results.")
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
@connector(
|
|
88
|
+
output=BDF_SEARCH_OUTPUT,
|
|
89
|
+
tags=["macro", "fr", "tool"],
|
|
90
|
+
)
|
|
91
|
+
async def bdf_search(params: BdfSearchParams) -> pd.DataFrame:
|
|
92
|
+
"""Semantic-search the Banque de France (BdF) Webstat catalog.
|
|
93
|
+
|
|
94
|
+
Returns the top matching series / dataset codes from BdF's Webstat
|
|
95
|
+
database (45 datasets, ~41,607 series spanning exchange rates,
|
|
96
|
+
interest rates, monetary aggregates, balance of payments, French
|
|
97
|
+
public finance, eurozone statistics, and more).
|
|
98
|
+
|
|
99
|
+
Pass series codes (dot-separated SDMX keys like
|
|
100
|
+
``EXR.D.USD.EUR.SP00.A``) directly into :func:`bdf_fetch` via the
|
|
101
|
+
``key`` parameter. Codes prefixed ``dataset:`` identify whole
|
|
102
|
+
datasets — strip the prefix to use the dataset id for refined
|
|
103
|
+
searches.
|
|
104
|
+
"""
|
|
105
|
+
catalog = await _get_catalog()
|
|
106
|
+
matches = await catalog.search(params.query, limit=params.limit)
|
|
107
|
+
return pd.DataFrame(
|
|
108
|
+
[
|
|
109
|
+
{
|
|
110
|
+
"code": m.code,
|
|
111
|
+
"title": m.title,
|
|
112
|
+
"similarity": round(m.similarity, 6),
|
|
113
|
+
}
|
|
114
|
+
for m in matches
|
|
115
|
+
]
|
|
116
|
+
)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "parsimony-bdf"
|
|
3
|
+
version = "0.4.0"
|
|
4
|
+
description = "Banque de France connector for the parsimony framework"
|
|
5
|
+
authors = [{ name = "Ockham.sh", email = "team@ockham.sh" }]
|
|
6
|
+
license = "Apache-2.0"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
requires-python = ">=3.11"
|
|
9
|
+
keywords = ["finance", "data", "connectors", "parsimony", "bdf"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 4 - Beta",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"Intended Audience :: Financial and Insurance Industry",
|
|
14
|
+
"License :: OSI Approved :: Apache Software License",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.11",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Programming Language :: Python :: 3.13",
|
|
19
|
+
"Topic :: Office/Business :: Financial",
|
|
20
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
21
|
+
"Typing :: Typed",
|
|
22
|
+
]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"parsimony-core>=0.4.0,<0.5",
|
|
25
|
+
"pydantic>=2.11.1,<3",
|
|
26
|
+
"pandas>=2.3.0,<3",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.optional-dependencies]
|
|
30
|
+
dev = [
|
|
31
|
+
"pytest>=9.0.3",
|
|
32
|
+
"pytest-asyncio>=1.3.0",
|
|
33
|
+
"pytest-cov>=5.0",
|
|
34
|
+
"respx>=0.22.0",
|
|
35
|
+
"ruff>=0.15.10",
|
|
36
|
+
"mypy>=1.10",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[project.urls]
|
|
40
|
+
Homepage = "https://www.banque-france.fr"
|
|
41
|
+
Repository = "https://github.com/ockham-sh/parsimony-connectors"
|
|
42
|
+
Issues = "https://github.com/ockham-sh/parsimony-connectors/issues"
|
|
43
|
+
|
|
44
|
+
[project.entry-points."parsimony.providers"]
|
|
45
|
+
bdf = "parsimony_bdf"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
[build-system]
|
|
49
|
+
requires = ["hatchling"]
|
|
50
|
+
build-backend = "hatchling.build"
|
|
51
|
+
|
|
52
|
+
[tool.hatch.build.targets.wheel]
|
|
53
|
+
packages = ["parsimony_bdf"]
|
|
54
|
+
|
|
55
|
+
[tool.hatch.build.targets.sdist]
|
|
56
|
+
include = ["parsimony_bdf", "README.md", "LICENSE", "CHANGELOG.md"]
|
|
57
|
+
|
|
58
|
+
[tool.ruff]
|
|
59
|
+
target-version = "py311"
|
|
60
|
+
line-length = 120
|
|
61
|
+
|
|
62
|
+
[tool.ruff.lint]
|
|
63
|
+
select = ["E", "F", "I", "UP", "B", "SIM"]
|
|
64
|
+
|
|
65
|
+
[tool.mypy]
|
|
66
|
+
python_version = "3.11"
|
|
67
|
+
warn_return_any = true
|
|
68
|
+
warn_unused_ignores = true
|
|
69
|
+
ignore_missing_imports = true
|
|
70
|
+
|
|
71
|
+
[tool.pytest.ini_options]
|
|
72
|
+
addopts = "--import-mode=importlib -m 'not integration'"
|
|
73
|
+
asyncio_mode = "auto"
|
|
74
|
+
markers = [
|
|
75
|
+
"integration: hits live APIs (may be slow, requires env vars)",
|
|
76
|
+
]
|