Quickstart
Getting Started¶
Installing somesy¶
Somesy requires Python >=3.8
. To get a first impression, you can install the
latest stable version of somesy from PyPI using pip
:
pip install somesy
Configuring somesy¶
Yes, somesy is another tool with its own configuration. However, for your
project metadata it is hopefully the last file you need, and the only one you
have to think about, somesy
will take care of the others for you!
To get started, create a file named somesy.toml
:
[project]
name = "my-amazing-project"
version = "0.1.0"
description = "Brief description of my amazing software."
keywords = ["some", "descriptive", "keywords"]
license = "MIT"
repository = "https://github.com/username/my-amazing-project"
# This is you, the proud author of your project
[[project.people]]
given-names = "Jane"
family-names = "Doe"
email = "j.doe@example.com"
orcid = "https://orcid.org/0000-0000-0000-0001"
author = true # is a full author of the project (i.e. appears in citations)
maintainer = true # currently maintains the project (i.e. is a contact person)
# this person is a acknowledged contributor, but not author or maintainer:
[[project.people]]
given-names = "Another"
family-names = "Contributor"
email = "a.contributor@example.com"
orcid = "https://orcid.org/0000-0000-0000-0002"
[config]
verbose = true # show detailed information about what somesy is doing
Alternatively, you can also add the somesy configuration to an existing
pyproject.toml
or package.json
file. The somesy manual contains examples showing how to do that.
Using somesy¶
Once somesy is installed and configured, somesy can take over and manage your project metadata.
Now you can run somesy
simply by using
somesy sync
The information in your somesy.toml
is used as the primary and
authoritative source for project metadata, which is used to update all
supported (and enabled) target files. You can find an overview of supported
formats further below.
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.
You can see call available options with somesy --help
,
all of these can also be conveniently set in your somesy.toml
file.
Somesy as a pre-commit hook¶
We highly recommend to use somesy
as a pre-commit hook.
A pre-commit hook runs on every commit to automatically point out issues or fix them on the spot,
so if you do not use pre-commit in your project yet, you should start today!
When used this way, somesy
can fix most typical issues with your project
metadata even before your changes can leave your computer.
To add somesy
as a pre-commit hook, add it to your .pre-commit-config.yaml
file in the root folder of your repository:
repos:
# ... (your other hooks) ...
- repo: https://github.com/Materials-Data-Science-and-Informatics/somesy
rev: "0.1.0"
hooks:
- id: somesy
Note that pre-commit
gives somesy
the staged version of files,
so when using somesy
with pre-commit, keep in mind that
- if
somesy
changed some files, you need togit add
them again (and rerun pre-commit) - if you explicitly run
pre-commit
, make sure togit add
all changed files (just like before a commit)
Supported File Formats¶
Here is an overview of all the currently supported files and formats.
Input Formats | Status | Target Formats | Status | |
---|---|---|---|---|
(.)somesy.toml | ✓ | pyproject.toml (poetry) | ✓ | |
pyproject.toml | ✓(1.) | pyproject.toml (setuptools) | ✓(2.) | |
package.json | ✓ | package.json | ✓(3.) | |
CITATION.cff | ✓ | |||
codemeta.json | ✓(4.) |
Notes:
- information must be placed inside a
tool.somesy
section (as explained above) - note that
somesy
does not support setuptools dynamic fields package.json
only supports one author, sosomesy
will pick the first listed author- unlike other targets,
somesy
will re-create thecodemeta.json
(i.e. do not edit it by hand!)