Skip to content

NameError: CONTENT_TYPE_MAP not defined when using ARC(input_concept_ids=...) as a library at v1.3.0 #369

Description

@PaulMRamirez

At tag v1.3.0, main.py imports CONTENT_TYPE_MAP from code.constants only in its __main__ branch; the package-import branch (the else clause) omits it. Any library use that reaches _validate_with_cmr raises a NameError at main.py line 189:

from pyQuARC import ARC
ARC(input_concept_ids=["C1991543732-POCLOUD"]).validate()
# NameError: name 'CONTENT_TYPE_MAP' is not defined

The CLI path is unaffected (its branch imports the constant), which is probably why this went unnoticed.

Reproduction: Python 3.11, pip install git+https://github.com/NASA-IMPACT/pyQuARC@v1.3.0, then the two lines above with any real collection concept id.

The fix looks like a one-liner: add CONTENT_TYPE_MAP to the package-branch import list in main.py.

We currently work around it in our attestation harness by binding the name from pyQuARC.code.constants before calling validate(), with the tag pin untouched. The smoke run that hit it is documented at open-science-pillars/marketplace#22 (receipt d9408d9e).

Thanks for pyQuARC; happy to open a PR for the import fix if useful.

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