Skip to content

Commit 18ac7c6

Browse files
authored
Merge pull request #213 from catalyst-cooperative/frictionless-5
Update to Frictionless v5 and make the tests pass.
2 parents d2f83b9 + d84e91d commit 18ac7c6

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

environment.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: ferc-xbrl-extractor
22
channels:
33
- conda-forge
4-
- defaults
54
dependencies:
65
# Packages required for setting up the environment
76
- pip>=21.0

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ license = { file = "LICENSE.txt" }
1616
dependencies = [
1717
"arelle-release>=2.3,<3",
1818
"coloredlogs>=14.0,<15.1",
19-
"frictionless>=4.4,<5",
19+
"frictionless>=5,<6",
2020
"lxml>=4.9.1,<6",
2121
"numpy>=1.16,<2",
2222
"pandas>=1.5,<3",

src/ferc_xbrl_extractor/xbrl.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,10 @@ def get_fact_tables(
256256

257257
if datapackage_path:
258258
# Verify that datapackage descriptor is valid before outputting
259-
frictionless_package = Package(descriptor=datapackage.model_dump(by_alias=True))
260-
if not frictionless_package.metadata_valid:
261-
raise RuntimeError(
262-
f"Generated datapackage is invalid - {frictionless_package.metadata_errors}"
263-
)
259+
report = Package.validate_descriptor(datapackage.model_dump(by_alias=True))
260+
261+
if not report.valid:
262+
raise RuntimeError(f"Generated datapackage is invalid - {report.errors}")
264263

265264
# Write to JSON file
266265
with Path(datapackage_path).open(mode="w") as f:

tests/integration/datapackage_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_datapackage_generation(test_dir):
3939
# test than a normative statement
4040
assert len(all_tables) == 366
4141

42-
assert Package(descriptor=datapackage.model_dump(by_alias=True)).metadata_valid
42+
assert Package.validate_descriptor(datapackage.model_dump(by_alias=True))
4343

4444

4545
def _create_schema(instant=True, axes=None):

0 commit comments

Comments
 (0)