commonmeta-py 0.17.2__tar.gz → 0.17.3__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 (71) hide show
  1. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/PKG-INFO +1 -1
  2. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/author_utils.py +4 -1
  3. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/crossref_utils.py +14 -11
  4. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/readers/crossref_reader.py +3 -3
  5. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/readers/datacite_reader.py +14 -16
  6. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/commonmeta_v0.13.json +0 -2
  7. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/writers/datacite_writer.py +1 -1
  8. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/pyproject.toml +1 -1
  9. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/LICENSE +0 -0
  10. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/README.md +0 -0
  11. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/__init__.py +0 -0
  12. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/api_utils.py +0 -0
  13. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/base_utils.py +0 -0
  14. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/cli.py +0 -0
  15. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/constants.py +0 -0
  16. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/date_utils.py +0 -0
  17. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/doi_utils.py +0 -0
  18. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/metadata.py +0 -0
  19. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/readers/__init__.py +0 -0
  20. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/readers/bibtex_reader.py +0 -0
  21. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/readers/cff_reader.py +0 -0
  22. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/readers/codemeta_reader.py +0 -0
  23. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/readers/commonmeta_reader.py +0 -0
  24. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/readers/crossref_xml_reader.py +0 -0
  25. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/readers/csl_reader.py +0 -0
  26. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/readers/datacite_xml_reader.py +0 -0
  27. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/readers/inveniordm_reader.py +0 -0
  28. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/readers/json_feed_reader.py +0 -0
  29. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/readers/kbase_reader.py +0 -0
  30. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/readers/ris_reader.py +0 -0
  31. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/readers/schema_org_reader.py +0 -0
  32. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/cff_v1.2.0.json +0 -0
  33. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/commonmeta_v0.12.json +0 -0
  34. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/crossref/AccessIndicators.xsd +0 -0
  35. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/crossref/JATS-journalpublishing1-3d2-mathml3-elements.xsd +0 -0
  36. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/crossref/JATS-journalpublishing1-3d2-mathml3.xsd +0 -0
  37. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/crossref/JATS-journalpublishing1-elements.xsd +0 -0
  38. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/crossref/JATS-journalpublishing1-mathml3-elements.xsd +0 -0
  39. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/crossref/JATS-journalpublishing1-mathml3.xsd +0 -0
  40. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/crossref/JATS-journalpublishing1.xsd +0 -0
  41. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/crossref/clinicaltrials.xsd +0 -0
  42. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/crossref/common5.3.1.xsd +0 -0
  43. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/crossref/crossref5.3.1.xsd +0 -0
  44. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/crossref/crossref_query_output3.0.xsd +0 -0
  45. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/crossref/fundref.xsd +0 -0
  46. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/crossref/module-ali.xsd +0 -0
  47. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/crossref/relations.xsd +0 -0
  48. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/crossref-v0.2.json +0 -0
  49. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/csl-data.json +0 -0
  50. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/datacite-v4.5.json +0 -0
  51. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/ietf-bcp-47.json +0 -0
  52. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/iso-8601.json +0 -0
  53. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/spdx/licenses.json +0 -0
  54. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/spdx-schema..json +0 -0
  55. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/styles/apa.csl +0 -0
  56. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/styles/chicago-author-date.csl +0 -0
  57. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/styles/harvard-cite-them-right.csl +0 -0
  58. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/styles/ieee.csl +0 -0
  59. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/styles/modern-language-association.csl +0 -0
  60. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/resources/styles/vancouver.csl +0 -0
  61. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/schema_utils.py +0 -0
  62. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/translators.py +0 -0
  63. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/utils.py +0 -0
  64. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/writers/__init__.py +0 -0
  65. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/writers/bibtex_writer.py +0 -0
  66. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/writers/citation_writer.py +0 -0
  67. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/writers/commonmeta_writer.py +0 -0
  68. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/writers/crossref_xml_writer.py +0 -0
  69. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/writers/csl_writer.py +0 -0
  70. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/writers/ris_writer.py +0 -0
  71. {commonmeta_py-0.17.2 → commonmeta_py-0.17.3}/commonmeta/writers/schema_org_writer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: commonmeta-py
3
- Version: 0.17.2
3
+ Version: 0.17.3
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
@@ -108,6 +108,9 @@ def get_one_author(author, **kwargs):
108
108
  else:
109
109
  given_name = None
110
110
  family_name = None
111
+
112
+ # support various keys for affiliations
113
+ affiliations = author.get("affiliation", None) or author.get("affiliations", None)
111
114
 
112
115
  # return author in commonmeta format, using name vs. given/family name
113
116
  # depending on type
@@ -119,7 +122,7 @@ def get_one_author(author, **kwargs):
119
122
  "name": name if _type == "Organization" else None,
120
123
  "givenName": given_name if _type == "Person" else None,
121
124
  "familyName": family_name if _type == "Person" else None,
122
- "affiliation": presence(get_affiliations(wrap(author.get("affiliation", None)))
125
+ "affiliations": presence(get_affiliations(wrap(affiliations))
123
126
  ),
124
127
  }
125
128
  )
@@ -131,8 +131,12 @@ def insert_crossref_contributors(metadata, xml):
131
131
  ]
132
132
  for num, contributor in enumerate(con):
133
133
  contributor_role = (
134
- "author" if contributor.get("contributorRoles") == ["Author"] else "editor"
134
+ "author" if "Author" in contributor.get("contributorRoles") else None
135
135
  )
136
+ if contributor_role is None:
137
+ contributor_role = (
138
+ "editor" if "Editor" in contributor.get("contributorRoles") else None
139
+ )
136
140
  sequence = "first" if num == 0 else "additional"
137
141
  if (
138
142
  contributor.get("type", None) == "Organization"
@@ -153,7 +157,7 @@ def insert_crossref_contributors(metadata, xml):
153
157
  {"contributor_role": contributor_role, "sequence": sequence},
154
158
  )
155
159
  person_name = insert_crossref_person(contributor, person_name)
156
- elif contributor.get("affiliation", None) is not None:
160
+ elif contributor.get("affiliations", None) is not None:
157
161
  anonymous = etree.SubElement(
158
162
  contributors,
159
163
  "anonymous",
@@ -176,18 +180,17 @@ def insert_crossref_person(contributor, xml):
176
180
  if contributor.get("familyName", None) is not None:
177
181
  etree.SubElement(xml, "surname").text = contributor.get("familyName")
178
182
 
179
- if contributor.get("affiliation", None) is not None:
183
+ if contributor.get("affiliations", None) is not None:
180
184
  affiliations = etree.SubElement(xml, "affiliations")
181
185
  institution = etree.SubElement(affiliations, "institution")
182
- if py_.get(contributor, "affiliation.0.name") is not None:
186
+ if py_.get(contributor, "affiliations.0.name") is not None:
183
187
  etree.SubElement(institution, "institution_name").text = py_.get(
184
- contributor, "affiliation.0.name"
188
+ contributor, "affiliations.0.name"
185
189
  )
186
- if py_.get(contributor, "affiliation.0.id") is not None:
190
+ if py_.get(contributor, "affiliations.0.id") is not None:
187
191
  etree.SubElement(
188
192
  institution, "institution_id", {"type": "ror"}
189
- ).text = py_.get(contributor, "affiliation.0.id")
190
-
193
+ ).text = py_.get(contributor, "affiliations.0.id")
191
194
  orcid = normalize_orcid(contributor.get("id", None))
192
195
  if orcid is not None:
193
196
  etree.SubElement(xml, "ORCID").text = orcid
@@ -196,13 +199,13 @@ def insert_crossref_person(contributor, xml):
196
199
 
197
200
  def insert_crossref_anonymous(contributor, xml):
198
201
  """Insert crossref anonymous"""
199
- if contributor.get("affiliation", None) is None:
202
+ if contributor.get("affiliations", None) is None:
200
203
  return xml
201
204
  affiliations = etree.SubElement(xml, "affiliations")
202
205
  institution = etree.SubElement(affiliations, "institution")
203
- if py_.get(contributor, "affiliation.0.name") is not None:
206
+ if py_.get(contributor, "affiliations.0.name") is not None:
204
207
  etree.SubElement(institution, "institution_name").text = py_.get(
205
- contributor, "affiliation.0.name"
208
+ contributor, "affiliations.0.name"
206
209
  )
207
210
  return xml
208
211
 
@@ -95,7 +95,7 @@ def read_crossref(data: Optional[dict], **kwargs) -> Commonmeta:
95
95
  identifiers.append(
96
96
  compact(
97
97
  {
98
- "identifier": normalize_doi(_id),
98
+ "identifier": _id,
99
99
  "identifierType": "DOI",
100
100
  }
101
101
  )
@@ -144,11 +144,11 @@ def read_crossref(data: Optional[dict], **kwargs) -> Commonmeta:
144
144
  "type": _type,
145
145
  # recommended and optional properties
146
146
  "additionalType": None,
147
- "archiveLocations": archive_locations,
147
+ "archiveLocations": presence(archive_locations),
148
148
  "container": presence(container),
149
149
  "contributors": presence(contributors),
150
150
  "date": presence(date),
151
- "descriptions": descriptions,
151
+ "descriptions": presence(descriptions),
152
152
  "files": presence(files),
153
153
  "fundingReferences": presence(funding_references),
154
154
  "geoLocations": None,
@@ -113,28 +113,26 @@ def read_datacite(data: dict, **kwargs) -> Commonmeta:
113
113
  # required properties
114
114
  "id": _id,
115
115
  "type": _type,
116
- "doi": doi_from_url(_id),
117
- "url": normalize_url(meta.get("url", None)),
118
- "contributors": presence(contributors),
119
- "titles": titles,
120
- "publisher": publisher,
121
- "date": compact(date),
122
116
  # recommended and optional properties
123
117
  "additionalType": additional_type,
124
- "subjects": presence(subjects),
125
- "language": meta.get("language", None),
118
+ "container": presence(container),
119
+ "contributors": presence(contributors),
120
+ "date": compact(date),
121
+ "descriptions": presence(descriptions),
122
+ "files": presence(files),
123
+ "fundingReferences": presence(meta.get("fundingReferences", None)),
124
+ "geoLocations": presence(geo_locations),
126
125
  "identifiers": presence(identifiers),
127
- "version": meta.get("version", None),
126
+ "language": meta.get("language", None),
128
127
  "license": presence(license_),
129
- "descriptions": descriptions,
130
- "geoLocations": presence(geo_locations),
131
- "fundingReferences": presence(meta.get("fundingReferences", None)),
128
+ "provider": "DataCite",
129
+ "publisher": publisher,
132
130
  "references": presence(references),
133
131
  "relations": presence(relations),
134
- # other properties
135
- "files": presence(files),
136
- "container": presence(container),
137
- "provider": "DataCite",
132
+ "subjects": presence(subjects),
133
+ "titles": presence(titles),
134
+ "url": normalize_url(meta.get("url", None)),
135
+ "version": meta.get("version", None),
138
136
  } | read_options
139
137
 
140
138
 
@@ -248,7 +248,6 @@
248
248
  "$ref": "#/definitions/contributorRole"
249
249
  },
250
250
  "type": "array",
251
- "minItems": 1,
252
251
  "uniqueItems": true
253
252
  }
254
253
  }
@@ -333,7 +332,6 @@
333
332
  },
334
333
  "required": ["url"]
335
334
  },
336
- "minItems": 1,
337
335
  "uniqueItems": true
338
336
  },
339
337
  "fundingReferences": {
@@ -160,7 +160,7 @@ def to_datacite_creator(creator: dict) -> dict:
160
160
  "familyName": creator.get("familyName", None),
161
161
  "nameType": _type + "al" if _type else None,
162
162
  "nameIdentifiers": name_identifiers,
163
- "affiliation": creator.get("affiliation", None),
163
+ "affiliation": creator.get("affiliations", None),
164
164
  }
165
165
  )
166
166
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name="commonmeta-py"
3
- version="0.17.2"
3
+ version="0.17.3"
4
4
  repository = "https://github.com/front-matter/commonmeta-py"
5
5
  homepage = "https://python.commonmeta.org"
6
6
  documentation = "https://python.commonmeta.org"
File without changes
File without changes