Skip to content

toml table mapping broken at license field #14

@zyzzyxdonta

Description

@zyzzyxdonta

I ran into a problem when using the plugin on the pyproject.toml from hermes.

Here the output from the debugger including the full project(?) table and some formatting:

(Pdb) 
AttributeError: 'str' object has no attribute 'get'
> /home/pape58/.local/pipx/venvs/hermes/lib64/python3.11/site-packages/hermes_toml/harvest.py(115)read_from_one_table()
-> ret_data[field1] = table[field2].get("text", None)

(Pdb) p table[field2]
'Apache-2.0 AND LicenseRef-BSD-Caltech'

(Pdb) p table
{
    "name": "hermes",
    "version": "0.10.0.dev1",
    "description": "Workflow to publish research software with rich metadata",
    "license": "Apache-2.0 AND LicenseRef-BSD-Caltech",
    "authors": [
        {"name": "Michael Meinel", "email": "[email protected]", "@type": "Person"},
        {
            "name": "Stephan Druskat",
            "email": "[email protected]",
            "@type": "Person",
        },
        {
            "name": "Oliver Bertuch",
            "email": "[email protected]",
            "@type": "Person",
        },
        {"name": "Oliver Knodel", "email": "[email protected]", "@type": "Person"},
        {"name": "David Pape", "email": "[email protected]", "@type": "Person"},
        {
            "name": "Sophie Kernchen",
            "email": "[email protected]",
            "@type": "Person",
        },
        {"name": "Nitai Heeb", "email": "[email protected]", "@type": "Person"},
    ],
    "maintainers": [
        {
            "name": "Stephan Druskat",
            "email": "[email protected]",
            "@type": "Person",
        }
    ],
    "readme": "README.md",
    "repository": "https://github.com/softwarepub/hermes",
    "keywords": ["software", "publication", "metadata", "automation"],
    "dependencies": [
        "ruamel.yaml>=0.17.21, <0.18.0",
        "jsonschema>=3.0.0, <4.0.0",
        "pyld>=2.0.3, <3.0.0",
        "cffconvert>=2.0.0, <3.0.0",
        "toml>=0.10.2, <1.0.0",
        "pyparsing>=3.0.9, <4.0.0",
        "requests>=2.28.1, <3.0.0",
        "pydantic>=2.5.1, <3.0.0",
        "pydantic-settings>=2.1.0, <3.0.0",
        "requests-oauthlib>=2.0.0, <3.0.0",
        "pynacl>=1.5.0, <2.0.0",
    ],
    "requires-python": ">=3.10, <4.0.0",
    "urls": {
        "homepage": "https://hermes.software-metadata.pub",
        "documentation": "https://hermes.software-metadata.pub",
        "repository": "https://github.com/softwarepub/hermes.git",
        "issues": "https://github.com/softwarepub/hermes/issues",
    },
    "scripts": {
        "hermes": "hermes.commands.cli:main",
        "hermes-marketplace": "hermes.commands.marketplace:main",
    },
    "entry-points": {
        "hermes.harvest": {
            "cff": "hermes.commands.harvest.cff:CffHarvestPlugin",
            "codemeta": "hermes.commands.harvest.codemeta:CodeMetaHarvestPlugin",
            "file_exists": "hermes.commands.harvest.file_exists:FileExistsHarvestPlugin",
        },
        "hermes.deposit": {
            "file": "hermes.commands.deposit.file:FileDepositPlugin",
            "invenio": "hermes.commands.deposit.invenio:InvenioDepositPlugin",
            "invenio_rdm": "hermes.commands.deposit.invenio_rdm:IvenioRDMDepositPlugin",
            "rodare": "hermes.commands.deposit.rodare:RodareDepositPlugin",
        },
        "hermes.postprocess": {
            "config_invenio_record_id": "hermes.commands.postprocess.invenio:config_record_id",
            "config_invenio_rdm_record_id": "hermes.commands.postprocess.invenio_rdm:config_record_id",
            "cff_doi": "hermes.commands.postprocess.invenio:cff_doi",
        },
    },
}

(Pdb) p field2
'license'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions