commonmeta-py 0.49__tar.gz → 0.51__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. {commonmeta_py-0.49 → commonmeta_py-0.51}/PKG-INFO +3 -5
  2. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/__init__.py +1 -1
  3. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/date_utils.py +16 -0
  4. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/writers/inveniordm_writer.py +12 -8
  5. {commonmeta_py-0.49 → commonmeta_py-0.51}/pyproject.toml +11 -5
  6. {commonmeta_py-0.49 → commonmeta_py-0.51}/LICENSE +0 -0
  7. {commonmeta_py-0.49 → commonmeta_py-0.51}/README.md +0 -0
  8. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/api_utils.py +0 -0
  9. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/author_utils.py +0 -0
  10. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/base_utils.py +0 -0
  11. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/cli.py +0 -0
  12. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/constants.py +0 -0
  13. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/crossref_utils.py +0 -0
  14. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/doi_utils.py +0 -0
  15. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/metadata.py +0 -0
  16. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/readers/__init__.py +0 -0
  17. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/readers/bibtex_reader.py +0 -0
  18. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/readers/cff_reader.py +0 -0
  19. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/readers/codemeta_reader.py +0 -0
  20. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/readers/commonmeta_reader.py +0 -0
  21. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/readers/crossref_reader.py +0 -0
  22. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/readers/crossref_xml_reader.py +0 -0
  23. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/readers/csl_reader.py +0 -0
  24. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/readers/datacite_reader.py +0 -0
  25. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/readers/datacite_xml_reader.py +0 -0
  26. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/readers/inveniordm_reader.py +0 -0
  27. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/readers/json_feed_reader.py +0 -0
  28. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/readers/kbase_reader.py +0 -0
  29. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/readers/ris_reader.py +0 -0
  30. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/readers/schema_org_reader.py +0 -0
  31. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/cff_v1.2.0.json +0 -0
  32. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/commonmeta_v0.12.json +0 -0
  33. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/commonmeta_v0.13.json +0 -0
  34. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/commonmeta_v0.14.json +0 -0
  35. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/commonmeta_v0.15.json +0 -0
  36. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/crossref/AccessIndicators.xsd +0 -0
  37. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/crossref/JATS-journalpublishing1-3d2-mathml3-elements.xsd +0 -0
  38. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/crossref/JATS-journalpublishing1-3d2-mathml3.xsd +0 -0
  39. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/crossref/JATS-journalpublishing1-elements.xsd +0 -0
  40. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/crossref/JATS-journalpublishing1-mathml3-elements.xsd +0 -0
  41. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/crossref/JATS-journalpublishing1-mathml3.xsd +0 -0
  42. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/crossref/JATS-journalpublishing1.xsd +0 -0
  43. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/crossref/clinicaltrials.xsd +0 -0
  44. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/crossref/common5.3.1.xsd +0 -0
  45. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/crossref/crossref5.3.1.xsd +0 -0
  46. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/crossref/crossref_query_output3.0.xsd +0 -0
  47. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/crossref/fundref.xsd +0 -0
  48. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/crossref/module-ali.xsd +0 -0
  49. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/crossref/relations.xsd +0 -0
  50. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/crossref-v0.2.json +0 -0
  51. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/csl-data.json +0 -0
  52. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/datacite-v4.5.json +0 -0
  53. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/datacite-v4.5pr.json +0 -0
  54. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/ietf-bcp-47.json +0 -0
  55. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/iso-8601.json +0 -0
  56. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/spdx/licenses.json +0 -0
  57. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/spdx-schema.json +0 -0
  58. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/styles/apa.csl +0 -0
  59. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/styles/chicago-author-date.csl +0 -0
  60. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/styles/harvard-cite-them-right.csl +0 -0
  61. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/styles/ieee.csl +0 -0
  62. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/styles/modern-language-association.csl +0 -0
  63. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/resources/styles/vancouver.csl +0 -0
  64. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/schema_utils.py +0 -0
  65. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/translators.py +0 -0
  66. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/utils.py +0 -0
  67. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/writers/__init__.py +0 -0
  68. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/writers/bibtex_writer.py +0 -0
  69. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/writers/citation_writer.py +0 -0
  70. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/writers/commonmeta_writer.py +0 -0
  71. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/writers/crossref_xml_writer.py +0 -0
  72. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/writers/csl_writer.py +0 -0
  73. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/writers/datacite_writer.py +0 -0
  74. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/writers/ris_writer.py +0 -0
  75. {commonmeta_py-0.49 → commonmeta_py-0.51}/commonmeta/writers/schema_org_writer.py +0 -0
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: commonmeta-py
3
- Version: 0.49
3
+ Version: 0.51
4
4
  Summary: Library for conversions to/from the Commonmeta scholarly metadata format
5
5
  Home-page: https://python.commonmeta.org
6
6
  License: MIT
7
7
  Keywords: science,metadata,commonmeta,bibtex,csl,crossref,datacite
8
8
  Author: Martin Fenner
9
9
  Author-email: martin@front-matter.io
10
- Requires-Python: >=3.9,<4.0.0
10
+ Requires-Python: >=3.9,<3.13
11
11
  Classifier: License :: OSI Approved :: MIT License
12
12
  Classifier: Programming Language :: Python :: 3
13
13
  Classifier: Programming Language :: Python :: 3.9
@@ -27,11 +27,10 @@ Requires-Dist: click (>=8.1.7,<9.0.0)
27
27
  Requires-Dist: datacite (>=1.1,<2.0)
28
28
  Requires-Dist: dateparser (>=1.1.7,<2.0.0)
29
29
  Requires-Dist: docutils (>=0.19,<0.20)
30
+ Requires-Dist: edtf (>=4.0.1,<5.0.0)
30
31
  Requires-Dist: furl (>=2.1.3,<3.0.0)
31
32
  Requires-Dist: httpx (>=0.27,<0.28)
32
33
  Requires-Dist: jsonschema (>=4.21,<5.0)
33
- Requires-Dist: jupyterlab (>=4.0.9,<5.0.0)
34
- Requires-Dist: jupyterlab-quarto (>=0.2.8,<0.3.0)
35
34
  Requires-Dist: lxml (>=4.8)
36
35
  Requires-Dist: nameparser (>=1.1.2,<2.0.0)
37
36
  Requires-Dist: nbstripout (>=0.6,<0.7)
@@ -43,7 +42,6 @@ Requires-Dist: pycountry (>=23.12.11,<24.0.0)
43
42
  Requires-Dist: pydash (>=7.0,<8.0)
44
43
  Requires-Dist: pyjwt (>=2.8.0,<3.0.0)
45
44
  Requires-Dist: python-dateutil (>=2.8.2,<3.0.0)
46
- Requires-Dist: quartodoc (>=0.7.1,<0.8.0)
47
45
  Requires-Dist: setuptools (>=70.0,<71.0)
48
46
  Requires-Dist: simplejson (>=3.18,<4.0)
49
47
  Requires-Dist: sphinx-autodoc-typehints (>=1.19,<2.0)
@@ -10,7 +10,7 @@ commonmeta-py is a Python library to convert scholarly metadata
10
10
  """
11
11
 
12
12
  __title__ = "commonmeta-py"
13
- __version__ = "0.49"
13
+ __version__ = "0.51"
14
14
  __author__ = "Martin Fenner"
15
15
  __license__ = "MIT"
16
16
 
@@ -3,6 +3,8 @@ import datetime
3
3
  from datetime import datetime as dt
4
4
  from typing import Optional, Union
5
5
  import dateparser
6
+ from edtf import parse_edtf, DateAndTime, Date
7
+ from edtf.parser.edtf_exceptions import EDTFParseException
6
8
  import pydash as py_
7
9
 
8
10
  from .base_utils import compact
@@ -191,3 +193,17 @@ def normalize_date_dict(data: dict) -> dict:
191
193
  "withdrawn": data.get("Withdrawn", None),
192
194
  }
193
195
  )
196
+
197
+
198
+ def validate_edtf(iso8601_time: Optional[str]) -> Optional[str]:
199
+ """Validate EDTF string using edtf. Return None if invalid"""
200
+ if iso8601_time is None:
201
+ return None
202
+ try:
203
+ edtf = parse_edtf(iso8601_time)
204
+ except EDTFParseException as e:
205
+ print(e)
206
+ return None
207
+ if not isinstance(edtf, (DateAndTime, Date)):
208
+ return None
209
+ return edtf.isoformat()
@@ -2,10 +2,9 @@
2
2
 
3
3
  import orjson as json
4
4
  from typing import Optional
5
- from furl import furl
6
5
 
7
6
  from ..base_utils import compact, wrap, parse_attributes, presence
8
- from ..date_utils import get_iso8601_date
7
+ from ..date_utils import get_iso8601_date, validate_edtf
9
8
  from ..doi_utils import doi_from_url, normalize_doi
10
9
  from ..constants import (
11
10
  CM_TO_INVENIORDM_TRANSLATIONS,
@@ -78,12 +77,15 @@ def write_inveniordm(metadata):
78
77
  )
79
78
  dates = []
80
79
  if metadata.date.get("updated", None):
81
- dates.append(
82
- {
83
- "date": metadata.date.get("updated"),
84
- "type": {"id": "updated"},
85
- }
86
- )
80
+ # workaround for InvenioRDM issue parsing some iso8601 strings
81
+ date_updated = validate_edtf(metadata.date.get("updated"))
82
+ if date_updated:
83
+ dates.append(
84
+ {
85
+ "date": metadata.date.get("updated"),
86
+ "type": {"id": "updated"},
87
+ }
88
+ )
87
89
 
88
90
  subjects = [to_inveniordm_subject(i) for i in wrap(metadata.subjects)]
89
91
  data = compact(
@@ -305,3 +307,5 @@ def to_inveniordm_funding(funding: dict) -> Optional[dict]:
305
307
  ),
306
308
  }
307
309
  )
310
+
311
+
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name="commonmeta-py"
3
- version="0.49"
3
+ version="0.51"
4
4
  repository = "https://github.com/front-matter/commonmeta-py"
5
5
  homepage = "https://python.commonmeta.org"
6
6
  documentation = "https://python.commonmeta.org"
@@ -12,7 +12,7 @@ license = "MIT"
12
12
  packages = [{include = "commonmeta"}]
13
13
 
14
14
  [tool.poetry.dependencies]
15
- python = ">=3.9,<4.0.0"
15
+ python = ">=3.9,<3.13"
16
16
  docutils = "^0.19"
17
17
  setuptools = "^70.0"
18
18
  sphinxcontrib-issuetracker = "^0.11"
@@ -38,9 +38,6 @@ types-xmltodict = "^0.13"
38
38
  nameparser = "^1.1.2"
39
39
  pycountry = "^23.12.11"
40
40
  click = "^8.1.7"
41
- quartodoc = "^0.7.1"
42
- jupyterlab = "^4.0.9"
43
- jupyterlab-quarto = "^0.2.8"
44
41
  furl = "^2.1.3"
45
42
  lxml = ">=4.8"
46
43
  python-dateutil = "^2.8.2"
@@ -52,6 +49,15 @@ anyio = "^4.2.0"
52
49
  orjson = "^3.9.14"
53
50
  orjsonl = "^1.0.0"
54
51
  pikepdf = "^8.14.0"
52
+ edtf = "^4.0.1"
53
+
54
+ [tool.poetry.group.docs]
55
+ optional = true
56
+
57
+ [tool.poetry.group.docs.dependencies]
58
+ quartodoc = "^0.7.1"
59
+ jupyterlab = "^4.0.9"
60
+ jupyterlab-quarto = "^0.2.8"
55
61
 
56
62
  [tool.poetry.scripts]
57
63
  commonmeta = "commonmeta.cli:cli"
File without changes
File without changes