Skip to content

Commit 3a11844

Browse files
authored
Merge pull request #105 from Materials-Data-Science-and-Informatics/feature/codemeta_overwrite
Feature/codemeta overwrite
2 parents 5be736d + c67c814 commit 3a11844

22 files changed

Lines changed: 824 additions & 94 deletions

File tree

.somesy.toml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "somesy"
3-
version = "0.5.0"
3+
version = "0.6.0"
44
description = "A CLI tool for synchronizing software project metadata."
55
keywords = ["metadata", "FAIR"]
66
license = "MIT"
@@ -54,7 +54,7 @@ orcid = "https://orcid.org/0000-0002-5149-603X"
5454
contribution = "Discussions and suggestions concerning tool scope and usability."
5555
contribution_begin = "2023-06-01"
5656
contribution_end = "2023-06-30"
57-
contribution_types = ["ideas"]
57+
contribution_types = ["ideas", "doc"]
5858

5959
publication_author = true
6060

@@ -67,17 +67,3 @@ orcid = "https://orcid.org/0000-0001-9560-4728"
6767
contribution_types = ["fundingFinding"]
6868

6969
publication_author = true
70-
71-
[config]
72-
no_sync_cff = false
73-
cff_file = "CITATION.cff"
74-
no_sync_pyproject = false
75-
pyproject_file = "pyproject.toml"
76-
no_sync_codemeta = false
77-
codemeta_file = "codemeta.json"
78-
no_sync_package_json = true
79-
no_sync_julia = true
80-
no_sync_fortran = true
81-
show_info = false
82-
verbose = false
83-
debug = true

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ Please consult the changelog to inform yourself about breaking changes and secur
66

77
## [v0.6.0](https://github.com/Materials-Data-Science-and-Informatics/somesy/tree/v0.6.0) <small>(2025-xx-xx)</small> { id="0.6.0" }
88

9-
- implement CFF Entity model for author/maintainer/contributor
9+
- implement CFF Entity (Organization) model for author/maintainer/contributor
10+
- add a new config option to use existing codemeta.json when syncing
1011
- fix SomesyBaseModel kwargs being overwritten
1112

1213
## [v0.5.0](https://github.com/Materials-Data-Science-and-Informatics/somesy/tree/v0.5.0) <small>(2025-01-15)</small> { id="0.5.0" }
1314

14-
- make person argument email optional
15+
- make person (and entity) argument email optional
1516

1617
## [v0.4.3](https://github.com/Materials-Data-Science-and-Informatics/somesy/tree/v0.4.3) <small>(2024-07-29)</small> { id="0.4.3" }
1718

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ type: software
33
message: If you use this software, please cite it using this metadata.
44

55
title: somesy
6-
version: 0.5.0
6+
version: 0.6.0
77
abstract: A CLI tool for synchronizing software project metadata.
88
url: https://materials-data-science-and-informatics.github.io/somesy
99
repository-code: https://github.com/Materials-Data-Science-and-Informatics/somesy

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ rorid = "https://ror.org/02nv7yv05" # highly recommended set a ror id for your o
118118
verbose = true # show detailed information about what somesy is doing
119119
```
120120

121-
As Helmholtz Metadata Collaboration (HMC), our goal is to increase usage of metadata and improve metadata quality. Therefore, some fields in `somesy.toml` are set as required fields. This is to increase rigour and completeness of metadata recorded with `somesy` .
122-
123121
<!-- --8<-- [end:somesytoml] -->
124122

123+
As Helmholtz Metadata Collaboration (HMC), our goal is to increase usage of metadata and improve metadata quality. Therefore, some fields in `somesy.toml` are set as required fields. This is to increase rigour and completeness of metadata recorded with `somesy` .
124+
125125
Alternatively, you can also add the somesy configuration to an existing
126126
`pyproject.toml`, `package.json`, `Project.toml`, or `fpm.toml` file. The somesy [manual](https://materials-data-science-and-informatics.github.io/somesy/main/manual/#somesy-input-file) contains examples showing how to do that.
127127

@@ -213,7 +213,7 @@ Here is an overview of all the currently supported files and formats.
213213
3. `fpm.toml` only supports one author and maintainer, so `somesy` will pick the _first_ listed author and maintainer
214214
4. `pom.xml` has no concept of `maintainers`, but it can have multiple licenses (somesy only supports one main project license)
215215
5. `mkdocs.yml` is a bit special, as it is not a project file, but a documentation file. `somesy` will only update it if it exists and is enabled in the configuration
216-
6. unlike other targets, `somesy` will _re-create_ the `codemeta.json` (i.e. do not edit it by hand!)
216+
6. For handling `codemeta.json` different options exists: Either (A) `somesy` removes any prior existing `codemata.json` files and re-creates it anew, or (B) `somesy` merges an existing `codemeta.json` with the information handled by `somesy`. See the [user manual](https://materials-data-science-and-informatics.github.io/somesy/main/manual/#codemeta) for additional details about CodeMeta handling.
217217

218218
<!-- --8<-- [end:quickstart] -->
219219

codemeta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
],
2828
"name": "somesy",
2929
"description": "A CLI tool for synchronizing software project metadata.",
30-
"version": "0.5.0",
30+
"version": "0.6.0",
3131
"keywords": [
3232
"metadata",
3333
"FAIR"

docs/manual.md

Lines changed: 66 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,10 @@ one of the supported input formats:
253253

254254
=== "Project.toml"
255255

256-
````toml
257-
name = "my-amazing-project"
258-
version = "0.1.0"
259-
uuid = "c7e460c6-3f3e-11ec-8d3d-0242ac130003"
256+
```toml
257+
name = "my-amazing-project"
258+
version = "0.1.0"
259+
uuid = "c7e460c6-3f3e-11ec-8d3d-0242ac130003"
260260

261261
[deps]
262262
...
@@ -298,9 +298,10 @@ uuid = "c7e460c6-3f3e-11ec-8d3d-0242ac130003"
298298
```
299299

300300
=== "fpm.toml"
301-
```toml
302-
name = "my-amazing-project"
303-
version = "0.1.0"
301+
302+
```toml
303+
name = "my-amazing-project"
304+
version = "0.1.0"
304305

305306
[tool.somesy.project]
306307
name = "my-amazing-project"
@@ -342,34 +343,34 @@ version = "0.1.0"
342343

343344
```json
344345
{
345-
"name": "my-amazing-project",
346-
"version": "0.1.0",
347-
...
346+
"name": "my-amazing-project",
347+
"version": "0.1.0",
348+
...
348349

349-
"somesy": {
350+
"somesy": {
350351
"project": {
351-
"name": "my-amazing-project",
352-
"version": "0.1.0",
353-
"description": "Brief description of my amazing software.",
354-
"keywords": ["some", "descriptive", "keywords"],
355-
"license": "MIT",
356-
"repository": "https://github.com/username/my-amazing-project",
357-
"people": [
352+
"name": "my-amazing-project",
353+
"version": "0.1.0",
354+
"description": "Brief description of my amazing software.",
355+
"keywords": ["some", "descriptive", "keywords"],
356+
"license": "MIT",
357+
"repository": "https://github.com/username/my-amazing-project",
358+
"people": [
358359
{
359-
"given-names": "Jane",
360-
"family-names": "Doe",
361-
"email": "j.doe@example.com",
362-
"orcid": "https://orcid.org/0000-0000-0000-0001",
363-
"author": true,
364-
"maintainer": true
360+
"given-names": "Jane",
361+
"family-names": "Doe",
362+
"email": "j.doe@example.com",
363+
"orcid": "https://orcid.org/0000-0000-0000-0001",
364+
"author": true,
365+
"maintainer": true
365366
},
366367
{
367-
"given-names": "Another",
368-
"family-names": "Contributor",
369-
"email": "a.contributor@example.com",
370-
"orcid": "https://orcid.org/0000-0000-0000-0002"
368+
"given-names": "Another",
369+
"family-names": "Contributor",
370+
"email": "a.contributor@example.com",
371+
"orcid": "https://orcid.org/0000-0000-0000-0002"
371372
}
372-
]
373+
]
373374
},
374375
"entities":[
375376
{
@@ -380,9 +381,9 @@ version = "0.1.0"
380381
}
381382
],
382383
"config": {
383-
"verbose": true
384+
"verbose": true
385+
}
384386
}
385-
}
386387
}
387388
```
388389

@@ -545,26 +546,47 @@ after running somesy (to remove the duplicate entries with the incorrect ROR ID)
545546
### Codemeta
546547

547548
While `somesy` is modifying existing files for most supported formats and implements
548-
features such as person identification and merging,
549-
[CodeMeta](https://codemeta.github.io/) is implemented differently.
549+
features such as person identification and merging, [CodeMeta](https://codemeta.github.io/)
550+
requires special handling.
551+
552+
As `codemeta.json` is a [**JSON-LD**](https://json-ld.org/) file, it represents a graph and
553+
can have various equally valid representations in JSON format. The behavior of `somesy`
554+
when handling CodeMeta files is controlled by the `codemeta_merge` configuration option:
550555

551-
As that `codemeta.json` is a [**JSON-LD**](https://json-ld.org/) file, it actually represents a graph,
552-
has various equally valid representations in a JSON file.
553-
Thus, supporting the same features as for other formats is technically much more
554-
challenging, if at all feasible. Therefore, for the time being, we regenerate the
555-
`codemeta.json` file directly from the source file, in order to avoid data inconsistency
556-
due to many pitfalls hiding in the details of the format.
556+
When `codemeta_merge = true`, `somesy` will:
557+
558+
1. Read and parse any existing `codemeta.json` file
559+
2. Update only the fields that `somesy` manages. Values that are already present will be overwritten.
560+
3. Preserve any additional fields or metadata present in the file and append it to the record.
561+
562+
563+
When `codemeta_merge = false` (default), `somesy` will:
564+
565+
1. Delete any existing `codemeta.json` file
566+
2. Create a new file containing only the metadata from your somesy project configuration
567+
568+
!!! note
569+
570+
If you have additional CodeMeta fields you want to preserve, make sure to set
571+
`codemeta_merge = true` in your somesy configuration.
557572

558573
!!! warning
559574

560-
The `codemeta.json` is overwritten and regenerated from scratch every time you `sync`,
561-
so **do not edit it** if you have the codemeta target enabled in `somesy`!
575+
Unlike other formats, person and entity merging heuristics are not
576+
implemented for CodeMeta. The author, maintainer, and contributor
577+
fields are directly created from your somesy project metadata,
578+
overwriting any existing entries in these fields.
579+
580+
Please note that due to the above behavior and the linked-data nature of values in
581+
`codemeta.json` records using the option `codemeta_merge = true` can create
582+
conflicts within the CodeMeta record, i.e. if values in `somesy.toml` and those
583+
that get appended to the CodeMeta record show inconsistencies.
562584

563585
As `codemeta.json` is considered a technical "backend-format" derived from other
564-
inputs, in most cases you probably do not need or should edit it by hand anyway.
586+
inputs, in most cases you probably do not need to edit it by hand anyway.
565587

566-
Of course, you are welcome to contribute an improved CodeMeta writer for somesy that can correctly
567-
understand and update the linked data graph which the `codemeta.json` file represents!
588+
Of course, you are welcome to contribute improvements to the CodeMeta handling in somesy
589+
to make it even more robust and feature-complete!
568590

569591
## Using somesy to insert metadata into project documentation
570592

0 commit comments

Comments
 (0)