Skip to content

Commit 1fd7ad0

Browse files
authored
Merge pull request #69 from Materials-Data-Science-and-Informatics/feature/julia_support
julia support
2 parents f78ea63 + 5760d73 commit 1fd7ad0

26 files changed

Lines changed: 632 additions & 71 deletions

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# don't add custom python shell scratchpad file
2-
scratch*.py
3-
scratch
2+
scratch*
43

54
# generated badges
65
docs/*_badge.svg

.somesy.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ keywords = ["metadata", "FAIR"]
66
license = "MIT"
77
repository = "https://github.com/Materials-Data-Science-and-Informatics/somesy"
88
homepage = "https://materials-data-science-and-informatics.github.io/somesy"
9+
documentation = "https://materials-data-science-and-informatics.github.io/somesy"
910

1011
[[project.people]]
1112
family-names = "Soylu"
@@ -74,6 +75,7 @@ pyproject_file = "pyproject.toml"
7475
no_sync_codemeta = false
7576
codemeta_file = "codemeta.json"
7677
no_sync_package_json = true
78+
no_sync_julia = true
7779
show_info = false
7880
verbose = false
7981
debug = true

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Here we provide notes that summarize the most important changes in each released
44

55
Please consult the changelog to inform yourself about breaking changes and security issues.
66

7+
## [v0.4.0](https://github.com/Materials-Data-Science-and-Informatics/somesy/tree/v0.4.0) <small>(2024-02-??)</small> { id="0.4.0" }
8+
9+
* added separate `documentation` URL to Project metadata model
10+
* added support for Julia `Project.toml` file
11+
712
## [v0.3.1](https://github.com/Materials-Data-Science-and-Informatics/somesy/tree/v0.3.1) <small>(2024-01-23)</small> { id="0.3.1" }
813

914
* fix setuptools license writing bug

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ message: If you use this software, please cite it using this metadata.
55
title: somesy
66
version: 0.3.1
77
abstract: A CLI tool for synchronizing software project metadata.
8+
url: https://materials-data-science-and-informatics.github.io/somesy
89
repository-code: https://github.com/Materials-Data-Science-and-Informatics/somesy
910
license: MIT
1011
keywords:
@@ -32,4 +33,3 @@ contact:
3233
family-names: Soylu
3334
given-names: Mustafa
3435
orcid: https://orcid.org/0000-0003-2637-0432
35-
url: https://materials-data-science-and-informatics.github.io/somesy

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ verbose = true # show detailed information about what somesy is doing
109109
<!-- --8<-- [end:somesytoml] -->
110110

111111
Alternatively, you can also add the somesy configuration to an existing
112-
`pyproject.toml` or `package.json` 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.
112+
`pyproject.toml`, `package.json` or `Project.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.
113113

114114
### Using somesy
115115

@@ -125,7 +125,7 @@ authoritative** source for project metadata, which is used to update all
125125
supported (and enabled) *target files*. You can find an overview of supported
126126
formats further below.
127127

128-
By default, `somesy` will create (if they did not exist) or update `CITATION.cff` and `codemeta.json` files in your repository. If you happen to use `pyproject.toml` (in Python projects) or `package.json` (in JavaScript projects), somesy would also update the respective information there.
128+
By default, `somesy` will create (if they did not exist) or update `CITATION.cff` and `codemeta.json` files in your repository. If you happen to use `pyproject.toml` (in Python projects), `package.json` (in JavaScript projects), or `Project.toml` (in Julia projects), somesy would also update the respective information there.
129129

130130
You can see call available options with `somesy --help`,
131131
all of these can also be conveniently set in your `somesy.toml` file.
@@ -169,6 +169,7 @@ Here is an overview of all the currently supported files and formats.
169169
| (.)somesy.toml | ✓ | | pyproject.toml _(poetry)_ | ✓ |
170170
| pyproject.toml | ✓ | | pyproject.toml _(setuptools)_ | ✓(1.) |
171171
| package.json | ✓ | | package.json | ✓(2.) |
172+
| Project.toml | ✓ | | Project.toml | ✓ |
172173
| | | | CITATION.cff | ✓ |
173174
| | | | codemeta.json | ✓(3.) |
174175

codemeta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
],
4545
"softwareHelp": "https://materials-data-science-and-informatics.github.io/somesy",
4646
"codeRepository": "https://github.com/Materials-Data-Science-and-Informatics/somesy",
47+
"buildInstructions": "https://materials-data-science-and-informatics.github.io/somesy",
4748
"contributor": [
4849
{
4950
"@type": "Person",

docs/manual.md

Lines changed: 64 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -113,34 +113,37 @@ print(model2md(SomesyConfig).getvalue())
113113

114114
From its own schema `somesy` must convert the information into the target formats.
115115
The following tables sketch how fields are mapped to corresponding other fields in
116-
some of the currently supported formats.
116+
some of the currently supported formats. Bold field names are mandatory, the others are optional.
117117

118118
=== "Person Metadata"
119119

120-
| Field Name | Poetry Config | SetupTools Config | CITATION.cff | package.json | Requirement |
121-
| ---------------- | ------------- | ----------------- | --------------- | ------------ | ----------- |
122-
| given-names | name+email | name | given-names | name | required |
123-
| family-names | name+email | name | family-names | name | required |
124-
| email | name+email | email | email | email | required |
125-
| orcid | - | - | orcid | url | optional |
126-
| *(many others)* | - | - | *(same)* | - | optional |
120+
| Somesy Field | Poetry Config | SetupTools Config | Julia Config | package.json | CITATION.cff | CodeMeta |
121+
| ---------------- | ------------- | ----------------- | ------------ | ------------ | --------------- | --------------- |
122+
| | | | | | | |
123+
| **given-names** | name+email | name | name+email | name | given-names | givenName |
124+
| **family-names** | name+email | name | name+email | name | family-names | familyName |
125+
| **email** | name+email | email | name+email | email | email | email |
126+
| orcid | - | - | - | url | orcid | id |
127+
| *(many others)* | - | - | - | - | *(same)* | *(same)* |
127128

128129
=== "Project Metadata"
129130

130-
| Field Name | Poetry Config | SetupTools Config | CITATION.cff | package.json | Requirement |
131-
| ----------------- | ------------- | ----------------- | --------------- | ------------ | ----------- |
132-
| name | name | name | title | name | required |
133-
| description | description | description | abstract | description | required |
134-
| license | license | license | license | license | required |
135-
| version | version | version | version | version | optional |
136-
| | | | | | |
137-
| *author=true* | authors | authors | authors | author | required |
138-
| *maintainer=true* | maintainers | maintainers | contact | maintainers | optional |
139-
| *people* | - | - | - | contributors | optional |
140-
| | | | | | |
141-
| keywords | keywords | keywords | keywords | keywords | optional |
142-
| repository | repository | urls.repository | repository_code | repository | optional |
143-
| homepage | homepage | urls.homepage | url | homepage | optional |
131+
| Somesy Field | Poetry Config | SetupTools Config | Julia Config | package.json | CITATION.cff | CodeMeta |
132+
| ----------------- | ------------- | ------------------ | ------------ | ------------ | --------------- | ----------------- |
133+
| | | | | | |
134+
| **name** | name | name | name | name | title | name |
135+
| **description** | description | description | - | description | abstract | description |
136+
| **license** | license | license | - | license | license | license |
137+
| **version** | version | version | version | version | version | version |
138+
| | | | | | | |
139+
| ***author=true*** | authors | authors | authors | author | authors | author |
140+
| *maintainer=true* | maintainers | maintainers | - | maintainers | contact | maintainer |
141+
| *people* | - | - | - | contributors | - | contributor |
142+
| | | | | | | |
143+
| keywords | keywords | keywords | - | keywords | keywords | keywords |
144+
| homepage | homepage | urls.homepage | - | homepage | url | url |
145+
| repository | repository | urls.repository | - | repository | repository_code | codeRepository |
146+
| documentation | documentation | urls.documentation | - | - | - | buildInstructions |
144147

145148
Note that the mapping is often not 1-to-1. For example, CITATION.cff allows rich
146149
specification of author contact information and complex names. In contrast,
@@ -167,6 +170,7 @@ Without an input file specifically provided, somesy will check if it can find a
167170
* `.somesy.toml`
168171
* `somesy.toml`
169172
* `pyproject.toml` (in `tool.somesy` section)
173+
* `Project.toml` (in `tool.somesy` section)
170174
* `package.json` (in `somesy` section)
171175

172176
which is located in the current working directory. If you want to provide
@@ -218,6 +222,44 @@ one of the supported input formats:
218222
verbose = true # show detailed information about what somesy is doing
219223
```
220224

225+
=== "Project.toml"
226+
```toml
227+
name = "my-amazing-project"
228+
version = "0.1.0"
229+
uuid = "c7e460c6-3f3e-11ec-8d3d-0242ac130003"
230+
231+
[deps]
232+
...
233+
234+
[tool.somesy.project]
235+
name = "my-amazing-project"
236+
version = "0.1.0"
237+
description = "Brief description of my amazing software."
238+
239+
keywords = ["some", "descriptive", "keywords"]
240+
license = "MIT"
241+
repository = "https://github.com/username/my-amazing-project"
242+
243+
# This is you, the proud author of your project
244+
[[tool.somesy.project.people]]
245+
given-names = "Jane"
246+
family-names = "Doe"
247+
email = "j.doe@example.com"
248+
orcid = "https://orcid.org/0000-0000-0000-0001"
249+
author = true # is a full author of the project (i.e. appears in citations)
250+
maintainer = true # currently maintains the project (i.e. is a contact person)
251+
252+
# this person is a acknowledged contributor, but not author or maintainer:
253+
[[tool.somesy.project.people]]
254+
given-names = "Another"
255+
family-names = "Contributor"
256+
email = "a.contributor@example.com"
257+
orcid = "https://orcid.org/0000-0000-0000-0002"
258+
259+
[tool.somesy.config]
260+
verbose = true # show detailed information about what somesy is doing
261+
```
262+
221263
=== "package.json"
222264

223265
```json

src/somesy/cff/writer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from ruamel.yaml import YAML
88

99
from somesy.core.models import Person, ProjectMetadata
10-
from somesy.core.writer import ProjectMetadataWriter
10+
from somesy.core.writer import FieldKeyMapping, IgnoreKey, ProjectMetadataWriter
1111

1212

1313
class CFF(ProjectMetadataWriter):
@@ -25,11 +25,12 @@ def __init__(
2525
self._yaml = YAML()
2626
self._yaml.preserve_quotes = True
2727

28-
mappings = {
28+
mappings: FieldKeyMapping = {
2929
"name": ["title"],
3030
"description": ["abstract"],
3131
"homepage": ["url"],
3232
"repository": ["repository-code"],
33+
"documentation": IgnoreKey(),
3334
"maintainers": ["contact"],
3435
}
3536
super().__init__(

src/somesy/cli/init.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ def config():
5656
if codemeta_file is not None or codemeta_file != "":
5757
options["codemeta_file"] = codemeta_file
5858

59+
options["no_sync_julia"] = not typer.confirm(
60+
"Do you want to sync to a Project.toml(Julia) file?", default=True
61+
)
62+
julia_file = typer.prompt("Project.toml(Julia) file path", default="Project.toml")
63+
if julia_file is not None or julia_file != "":
64+
options["julia_file"] = julia_file
65+
5966
options["show_info"] = typer.confirm(
6067
"Do you want to show info about the sync process?"
6168
)

src/somesy/cli/sync.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,24 @@ def sync(
101101
resolve_path=True,
102102
help="Custom codemeta.json file path",
103103
),
104+
no_sync_julia: bool = typer.Option(
105+
None,
106+
"--no-sync-julia",
107+
"-M",
108+
help="Do not sync Project.toml(Julia) file",
109+
),
110+
julia_file: Path = typer.Option(
111+
None,
112+
"--julia-file",
113+
"-m",
114+
exists=True,
115+
file_okay=True,
116+
dir_okay=False,
117+
writable=True,
118+
readable=True,
119+
resolve_path=True,
120+
help="Custom Project.toml(Julia) file path",
121+
),
104122
):
105123
"""Sync project metadata input with metadata files."""
106124
somesy_input = resolved_somesy_input(
@@ -113,6 +131,8 @@ def sync(
113131
package_json_file=package_json_file,
114132
no_sync_codemeta=no_sync_codemeta,
115133
codemeta_file=codemeta_file,
134+
no_sync_julia=no_sync_julia,
135+
julia_file=julia_file,
116136
)
117137
run_sync(somesy_input)
118138

0 commit comments

Comments
 (0)