commonmeta-py 0.111__tar.gz → 0.112__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.
- {commonmeta_py-0.111 → commonmeta_py-0.112}/PKG-INFO +1 -1
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/__init__.py +1 -1
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/metadata.py +3 -1
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/writers/inveniordm_writer.py +18 -28
- {commonmeta_py-0.111 → commonmeta_py-0.112}/pyproject.toml +1 -1
- {commonmeta_py-0.111 → commonmeta_py-0.112}/.gitignore +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/LICENSE +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/README.md +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/api_utils.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/author_utils.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/base_utils.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/cli.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/constants.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/date_utils.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/doi_utils.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/file_utils.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/readers/__init__.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/readers/bibtex_reader.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/readers/cff_reader.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/readers/codemeta_reader.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/readers/commonmeta_reader.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/readers/crossref_reader.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/readers/crossref_xml_reader.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/readers/csl_reader.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/readers/datacite_reader.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/readers/datacite_xml_reader.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/readers/inveniordm_reader.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/readers/jsonfeed_reader.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/readers/kbase_reader.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/readers/openalex_reader.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/readers/ris_reader.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/readers/schema_org_reader.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/cff_v1.2.0.json +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/commonmeta_v0.12.json +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/commonmeta_v0.13.json +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/commonmeta_v0.14.json +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/commonmeta_v0.15.json +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/commonmeta_v0.16.json +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/AccessIndicators.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/JATS-journalpublishing1-3d2-mathml3-elements.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/JATS-journalpublishing1-3d2-mathml3.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/JATS-journalpublishing1-elements.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/JATS-journalpublishing1-mathml3-elements.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/JATS-journalpublishing1-mathml3.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/JATS-journalpublishing1.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/clinicaltrials.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/common5.4.0.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/crossref5.4.0.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/crossref_query_output3.0.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/doi_resources5.4.0.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/fundingdata5.4.0.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/fundref.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/languages5.4.0.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/mediatypes5.4.0.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/module-ali.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/relations.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/standard-modules/mathml3/mathml3-common.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/standard-modules/mathml3/mathml3-content.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/standard-modules/mathml3/mathml3-presentation.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/standard-modules/mathml3/mathml3-strict-content.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/standard-modules/mathml3/mathml3.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/standard-modules/mathml3/module-ali.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/standard-modules/module-ali.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/standard-modules/xlink.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/standard-modules/xml.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/xml.xsd +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref-v0.2.json +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/csl-data.json +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/datacite-v4.5.json +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/datacite-v4.5pr.json +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/spdx/licenses.json +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/spdx-schema.json +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/styles/apa.csl +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/styles/chicago-author-date.csl +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/styles/harvard-cite-them-right.csl +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/styles/ieee.csl +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/styles/modern-language-association.csl +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/styles/vancouver.csl +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/schema_utils.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/translators.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/utils.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/writers/__init__.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/writers/bibtex_writer.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/writers/citation_writer.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/writers/commonmeta_writer.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/writers/crossref_xml_writer.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/writers/csl_writer.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/writers/datacite_writer.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/writers/ris_writer.py +0 -0
- {commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/writers/schema_org_writer.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: commonmeta-py
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.112
|
4
4
|
Summary: Library for conversions to/from the Commonmeta scholarly metadata format
|
5
5
|
Project-URL: Homepage, https://python.commonmeta.org
|
6
6
|
Project-URL: Repository, https://github.com/front-matter/commonmeta-py
|
@@ -490,7 +490,9 @@ class MetadataList:
|
|
490
490
|
elif to == "datacite":
|
491
491
|
raise ValueError("Datacite not yet supported for metadata lists")
|
492
492
|
elif to == "inveniordm":
|
493
|
-
response = push_inveniordm_list(
|
493
|
+
response = push_inveniordm_list(
|
494
|
+
self, host=self.host, token=self.token, legacy_key=self.legacy_key
|
495
|
+
)
|
494
496
|
return response
|
495
497
|
else:
|
496
498
|
raise ValueError("No valid output format found")
|
@@ -371,7 +371,7 @@ def write_inveniordm_list(metalist):
|
|
371
371
|
return [write_inveniordm(item) for item in metalist.items]
|
372
372
|
|
373
373
|
|
374
|
-
def push_inveniordm(metadata, host: str, token: str, legacy_key:str):
|
374
|
+
def push_inveniordm(metadata, host: str, token: str, legacy_key: str):
|
375
375
|
"""Push record to InvenioRDM"""
|
376
376
|
|
377
377
|
record = {}
|
@@ -382,8 +382,9 @@ def push_inveniordm(metadata, host: str, token: str, legacy_key:str):
|
|
382
382
|
community_index = None
|
383
383
|
if hasattr(metadata, "relations") and metadata.relations:
|
384
384
|
for i, relation in enumerate(metadata.relations):
|
385
|
-
if
|
386
|
-
|
385
|
+
if relation.get("type") == "IsPartOf" and relation.get(
|
386
|
+
"id", ""
|
387
|
+
).startswith("https://rogue-scholar.org/api/communities/"):
|
387
388
|
slug = relation.get("id").split("/")[5]
|
388
389
|
community_id, _ = search_by_slug(slug, "blog", host, token)
|
389
390
|
if community_id:
|
@@ -413,7 +414,6 @@ def push_inveniordm(metadata, host: str, token: str, legacy_key:str):
|
|
413
414
|
record["id"] = search_by_doi(doi_from_url(metadata.id), host, token)
|
414
415
|
|
415
416
|
if record["id"] is not None:
|
416
|
-
|
417
417
|
# Create draft record from published record
|
418
418
|
record = edit_published_record(record, host, token)
|
419
419
|
|
@@ -443,9 +443,7 @@ def push_inveniordm(metadata, host: str, token: str, legacy_key:str):
|
|
443
443
|
|
444
444
|
community_id = search_by_slug(slug, "topic", host, token)
|
445
445
|
if community_id:
|
446
|
-
record = add_record_to_community(
|
447
|
-
record, host, token, community_id
|
448
|
-
)
|
446
|
+
record = add_record_to_community(record, host, token, community_id)
|
449
447
|
|
450
448
|
# Add record to communities defined as IsPartOf relation in inveniordm metadata's RelatedIdentifiers
|
451
449
|
related_identifiers = py_.get(input, "metadata.related_identifiers")
|
@@ -460,21 +458,19 @@ def push_inveniordm(metadata, host: str, token: str, legacy_key:str):
|
|
460
458
|
and len(path_parts) == 3
|
461
459
|
and path_parts[1] == "communities"
|
462
460
|
):
|
463
|
-
record = add_record_to_community(
|
464
|
-
record, host, token, path_parts[2]
|
465
|
-
)
|
461
|
+
record = add_record_to_community(record, host, token, path_parts[2])
|
466
462
|
|
467
463
|
# optionally update rogue-scholar legacy record
|
468
464
|
if host == "rogue-scholar.org" and legacy_key is not None:
|
469
465
|
record = update_legacy_record(record, legacy_key)
|
470
|
-
|
466
|
+
print("g", record)
|
471
467
|
except Exception as e:
|
472
468
|
raise InvenioRDMError(f"Unexpected error: {str(e)}")
|
473
469
|
|
474
470
|
return record
|
475
471
|
|
476
472
|
|
477
|
-
def push_inveniordm_list(metalist, host: str, token: str, legacy_key:str) -> list:
|
473
|
+
def push_inveniordm_list(metalist, host: str, token: str, legacy_key: str) -> list:
|
478
474
|
"""Push inveniordm list to InvenioRDM, returns list of push results."""
|
479
475
|
|
480
476
|
if metalist is None:
|
@@ -491,7 +487,9 @@ def search_by_doi(doi, host, token) -> Optional[str]:
|
|
491
487
|
}
|
492
488
|
params = {"q": f"doi:{doi}", "size": 1}
|
493
489
|
try:
|
494
|
-
response = requests.get(
|
490
|
+
response = requests.get(
|
491
|
+
f"https://{host}/api/records", headers=headers, params=params
|
492
|
+
)
|
495
493
|
response.raise_for_status()
|
496
494
|
data = response.json()
|
497
495
|
if py_.get(data, "hits.total") or 0 > 0:
|
@@ -508,14 +506,16 @@ def create_draft_record(record, host, token, input):
|
|
508
506
|
"Content-Type": "application/json",
|
509
507
|
}
|
510
508
|
try:
|
511
|
-
response = requests.post(
|
509
|
+
response = requests.post(
|
510
|
+
f"https://{host}/api/records", headers=headers, json=input
|
511
|
+
)
|
512
512
|
response.raise_for_status()
|
513
513
|
data = response.json()
|
514
514
|
return {
|
515
515
|
"id": data.get("id", None),
|
516
516
|
"created": data.get("created", None),
|
517
517
|
"updated": data.get("updated", None),
|
518
|
-
"status": "updated"
|
518
|
+
"status": "updated",
|
519
519
|
}
|
520
520
|
except requests.exceptions.RequestException as e:
|
521
521
|
raise InvenioRDMError(f"Error creating draft record: {str(e)}")
|
@@ -620,12 +620,7 @@ def update_legacy_record(record, legacy_key: str):
|
|
620
620
|
if not record.get("doi", None):
|
621
621
|
return ValueError("no valid doi to update")
|
622
622
|
|
623
|
-
output = {
|
624
|
-
"doi": record["doi"],
|
625
|
-
"indexed_at": now,
|
626
|
-
"indexed": "true",
|
627
|
-
"archived": "true"
|
628
|
-
}
|
623
|
+
output = {"indexed_at": now, "indexed": "true", "archived": "true"}
|
629
624
|
|
630
625
|
request_url = f"https://{legacy_host}/rest/v1/posts?id=eq.{record['uuid']}"
|
631
626
|
|
@@ -633,16 +628,11 @@ def update_legacy_record(record, legacy_key: str):
|
|
633
628
|
"Content-Type": "application/json",
|
634
629
|
"apikey": legacy_key,
|
635
630
|
"Authorization": f"Bearer {legacy_key}",
|
636
|
-
"Prefer": "return=minimal"
|
631
|
+
"Prefer": "return=minimal",
|
637
632
|
}
|
638
633
|
|
639
634
|
try:
|
640
|
-
response = requests.patch(
|
641
|
-
request_url,
|
642
|
-
json=output,
|
643
|
-
headers=headers,
|
644
|
-
timeout=30
|
645
|
-
)
|
635
|
+
response = requests.patch(request_url, json=output, headers=headers, timeout=30)
|
646
636
|
response.raise_for_status()
|
647
637
|
if response.status_code != 204:
|
648
638
|
return record, Exception(f"Unexpected status code: {response.status_code}")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "commonmeta-py"
|
3
|
-
version = "0.
|
3
|
+
version = "0.112"
|
4
4
|
description = "Library for conversions to/from the Commonmeta scholarly metadata format"
|
5
5
|
authors = [{ name = "Martin Fenner", email = "martin@front-matter.io" }]
|
6
6
|
requires-python = ">=3.9,<4.0"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/AccessIndicators.xsd
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/clinicaltrials.xsd
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/doi_resources5.4.0.xsd
RENAMED
File without changes
|
{commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/fundingdata5.4.0.xsd
RENAMED
File without changes
|
File without changes
|
{commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/languages5.4.0.xsd
RENAMED
File without changes
|
{commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/mediatypes5.4.0.xsd
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/standard-modules/xlink.xsd
RENAMED
File without changes
|
{commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/crossref/standard-modules/xml.xsd
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/styles/chicago-author-date.csl
RENAMED
File without changes
|
{commonmeta_py-0.111 → commonmeta_py-0.112}/commonmeta/resources/styles/harvard-cite-them-right.csl
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|