codemeticulous

practical validation and conversion between software metadata standards with pydantic

https://github.com/SciCodes/codemeticulous

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.2%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

practical validation and conversion between software metadata standards with pydantic

Basic Info
  • Host: GitHub
  • Owner: SciCodes
  • License: gpl-3.0
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 248 KB
Statistics
  • Stars: 7
  • Watchers: 1
  • Forks: 1
  • Open Issues: 1
  • Releases: 0
Created over 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme License Citation Codemeta

README.md

[!WARNING] codemeticulous is in an early state of development and things are subject to change. Refer to the table below to see currently supported formats and conversions.

codemeticulous is a python library and command line utility for working with different metadata standards for software. Several Pydantic models that mirror metadata schemas are provided which allows for simple validation, (de)serialization and type-safety for developers.

For converting between different standards, an extension of CodeMeta, called CanonicalCodeMeta, is used as a canonical data model or central "hub" representation, along with conversion logic back and forth between it and supported standards. This design allows for conversion between any two formats without needing to implement each bridge. CodeMeta was chosen as it is the most exhaustive and provides crosswalk definitions between other formats. Still, some data loss can occur, so some extension is needed to fill schema gaps and resolve abiguity. Note that CanonicalCodeMeta is not a proposed standard, but an internal data model used by this library.

Feature Roadmap

Schema Pydantic model Backward-compatible with[1] Convert to Convert from
CodeMeta v3 [2] v2
Datacite 4.6 4.0, 4.1, 4.2, 4.3, 4.4, 4.5
Citation File Format 1.2.0
GitHub Repository 2022-11-28
Zenodo?
...
[1]

Lists the versions that can be safely used as input. Output will always use the specified version. For example, the CodeMetaV3 model will accept v2 property names and automatically change them to v3 equivalents.

[2]

The CodeMeta model is currently implemented as a pydantic v1 model, due to a heavy reliance on pydantic_schemaorg which has not been fully updated.

Installation

$ pip install git+https://github.com/sgfost/codemeticulous.git

Usage

As a command line tool

$ codemeticulous convert --from codemeta --to cff codemeta.json > CITATION.cff $ codemeticulous validate --format cff CITATION.cff

As a python library

```python from codemeticulous.codemeta import CodeMeta, Person from codemeticulous import convert

codemeta = CodeMeta( name="My Project", author=Person(givenName="Dale", familyName="Earnhardt"), )

commit kwarg is an override that can be used to insert

a custom field into the resulting metadata after conversion

cff = convert("codemeta", "cff", codemeta, commit="abcdef123456789")

print(codemeta.json(indent=True))

{

"@context": "https://w3id.org/codemeta/3.0",

"@type": "SoftwareSourceCode",

"name": "My Project",

"author": {"@type": "Person", "givenName": "Dale", "familyName": "Earnhardt"}

}

print(cff.yaml())

authors:

- family-names: Earnhardt

given-names: Dale

cff-version: 1.2.0

message: If you use this software, please cite it using the metadata from this file.

title: My Project

type: software

commit: abcdef123456789

```

Development

codemeticulous uses uv for project management. The following assumes that you have installed uv.

Get started by cloning the repository and setting up a virtual environment

$ git clone https://github.com/sgfost/codemeticulous.git $ cd codemeticulous $ uv sync --dev $ source .venv/bin/activate

Run tests

$ uv run pytest tests

Owner

  • Name: SciCodes
  • Login: SciCodes
  • Kind: organization
  • Location: International

Consortium of scientific software registries and repositories.

Citation (CITATION.cff)

abstract: validate and convert between software metadata standards with pydantic
authors:
- affiliation: Arizona State University
  email: sgfost@asu.edu
  family-names: Foster
  given-names: Scott
cff-version: 1.2.0
keywords:
- software metadata
- codemeta
- research software
- FAIR
license: GPL-3.0
message: If you use this software, please cite it using the metadata from this file.
repository-code: https://github.com/sgfost/codemeticulous/
title: codemeticulous
type: software
version: 0.1.0

CodeMeta (codemeta.json)

{
  "@context": "https://w3id.org/codemeta/3.0",
  "@type": "SoftwareSourceCode",
  "author": [
    {
      "@id": "https://github.com/sgfost",
      "@type": "Person",
      "affiliation": {
        "type": "Organization",
        "name": "Arizona State University"
      },
      "email": "sgfost@asu.edu",
      "familyName": "Foster",
      "givenName": "Scott"
    },
    {
      "@type": "Role",
      "@id": "https://github.com/sgfost",
      "roleName": "Developer"
    }
  ],
  "codeRepository": "https://github.com/sgfost/codemeticulous/",
  "dateCreated": "2024-11-05",
  "description": "validate and convert between software metadata standards with pydantic",
  "keywords": [
    "software metadata",
    "codemeta",
    "research software",
    "FAIR"
  ],
  "license": "https://spdx.org/licenses/GPL-3.0",
  "name": "codemeticulous",
  "programmingLanguage": "Python 3",
  "softwareRequirements": "Python 3.10",
  "version": "0.1.0",
  "continuousIntegration": "https://github.com/sgfost/codemeticulous/actions/",
  "issueTracker": "https://github.com/sgfost/codemeticulous/issues"
}

GitHub Events

Total
  • Issues event: 1
  • Watch event: 1
Last Year
  • Issues event: 1
  • Watch event: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • sgfost (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

pyproject.toml pypi
  • pydantic >=2.9.2
  • pydantic2-schemaorg ==0.2.0