{"id":7200,"library":"eido","title":"Eido: Project Metadata Validator","description":"Eido (pronounced 'eye-doe') is a Python library and CLI tool designed for validating project metadata, primarily within the Portable Encapsulated Project (PEP) framework. It leverages JSON Schema to ensure the correctness and consistency of project configuration files and sample annotations. The current version is 0.2.5, and releases are relatively infrequent, often tied to updates in the broader PEPKit ecosystem.","status":"active","version":"0.2.5","language":"en","source_language":"en","source_url":"https://github.com/pepkit/eido/","tags":["data validation","metadata","schema validation","PEP","peppy","genomics","bioinformatics"],"install":[{"cmd":"pip install eido","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core dependency for JSON schema validation engine.","package":"jsonschema"},{"reason":"Primary interface for validating Portable Encapsulated Projects (PEPs). Required for `validate_project` and `validate_sample`.","package":"peppy"},{"reason":"Logging utility.","package":"logmuse"},{"reason":"YAML/Config file handling.","package":"yacman"}],"imports":[{"symbol":"validate_project","correct":"from eido import validate_project"},{"symbol":"validate_sample","correct":"from eido import validate_sample"},{"symbol":"validate_config","correct":"from eido import validate_config"}],"quickstart":{"code":"import os\nimport peppy\nimport eido\nimport yaml\nfrom jsonschema import ValidationError\n\n# Create a dummy project config file\nconfig_content = \"\"\"\nproject_name: MyTestProject\noutput_dir: output/\nsamples:\n  - sample_name: sample1\n    file_path: data/sample1.txt\n    organism: human\n  - sample_name: sample2\n    file_path: data/sample2.txt\n    organism: mouse\n\"\"\"\n\n# Create a dummy schema file\nschema_content = \"\"\"\ntype: object\nproperties:\n  project_name: { type: string }\n  output_dir: { type: string }\n  samples:\n    type: array\n    items:\n      type: object\n      properties:\n        sample_name: { type: string }\n        file_path: { type: string }\n        organism: { type: string, enum: [human, mouse, rat] }\n      required: [sample_name, file_path, organism]\nrequired: [project_name, samples]\n\"\"\"\n\nconfig_file = \"_eido_test_config.yaml\"\nschema_file = \"_eido_test_schema.yaml\"\n\ntry:\n    # Write dummy files\n    with open(config_file, 'w') as f:\n        f.write(config_content)\n    with open(schema_file, 'w') as f:\n        f.write(schema_content)\n\n    # Load the project using peppy\n    project = peppy.Project(config_file)\n\n    # Validate the project using eido\n    print(f\"Attempting to validate project '{project.name}'...\")\n    eido.validate_project(project, schema_file)\n    print(\"Project validated successfully!\")\n\n    # Example of validation failure (optional, for demonstration)\n    print(\"\\n--- Demonstrating a validation failure ---\")\n    bad_config_content = \"\"\"\nproject_name: AnotherProject\nsamples:\n  - sample_name: invalid_sample\n    organism: alien # 'alien' is not in enum\n\"\"\"\n    bad_config_file = \"_eido_bad_config.yaml\"\n    with open(bad_config_file, 'w') as f:\n        f.write(bad_config_content)\n    bad_project = peppy.Project(bad_config_file)\n    try:\n        print(\"Attempting to validate a project with invalid organism...\")\n        eido.validate_project(bad_project, schema_file)\n        print(\"Unexpected: Validation passed for bad project!\")\n    except ValidationError as e:\n        print(f\"Caught expected validation error: {e.message}\")\n\nfinally:\n    # Clean up dummy files\n    if os.path.exists(config_file):\n        os.remove(config_file)\n    if os.path.exists(schema_file):\n        os.remove(schema_file)\n    if os.path.exists(bad_config_file):\n        os.remove(bad_config_file)\n","lang":"python","description":"This quickstart demonstrates how to use eido to validate a peppy Project object against a JSON schema. It involves creating temporary config and schema files, loading them with `peppy`, and then invoking `eido.validate_project` for both a valid and an intentionally invalid project."},"warnings":[{"fix":"Update project schemas and configurations to use the new key names (`sizing`, `tangible_key`, `samples`). Review `peppy` and `eido` documentation for updated schema requirements.","message":"In `v0.2.3`, several internal keys/attributes used in schema definition or project configuration were renamed: `files_key` to `sizing`, `required_files_key` to `tangible_key`, and `_samples` to `samples`. This may break existing PEP configurations or custom schemas.","severity":"breaking","affected_versions":">=0.2.3"},{"fix":"Remove `--exclude-case` from CLI calls. If case-insensitive validation is still required, check `jsonschema` documentation for equivalent options or implement custom pre-processing.","message":"The `--exclude-case` option was removed from the CLI in `v0.2.2`. Users relying on this command-line argument will find their scripts failing.","severity":"breaking","affected_versions":">=0.2.2"},{"fix":"For generic dictionary validation, consider using the `jsonschema` library directly. If you need `eido`'s schema discovery or specialized PEP validation, ensure your data is wrapped in a `peppy.Project` or `peppy.Sample` object. Refer to `peppy` documentation for creating project objects.","message":"Eido is primarily designed to validate `peppy.Project` and `peppy.Sample` objects. While it uses JSON Schema internally, directly passing arbitrary Python dictionaries to `validate_project` or `validate_sample` will likely fail unless the dictionary mimics the structure of a `peppy` object.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Carefully compare your project's `config.yaml` and `sample_table.csv` (or equivalent) against the `project_schema.yaml`. Pay attention to data types, required fields, enum values, and allowed patterns. The error message often includes details about the specific failing validation condition.","cause":"The data in your project configuration or sample table does not conform to the specified JSON schema. This error is directly from the underlying `jsonschema` library, which `eido` uses.","error":"jsonschema.exceptions.ValidationError: '...' is not valid under any of the given schemas"},{"fix":"Double-check the file paths passed to `peppy.Project()` and `eido.validate_project()`. Ensure the files exist and are accessible from where your script is running. Use absolute paths or verify your current working directory.","cause":"The path provided for your project configuration, sample table, or schema file is incorrect or the file does not exist at the specified location.","error":"FileNotFoundError: [Errno 2] No such file or directory: 'your_schema.yaml'"},{"fix":"Inspect your `config.yaml` for syntax errors (e.g., incorrect YAML formatting, missing required sections). Ensure `peppy` can parse your project configuration independently before passing it to `eido`. Check `peppy`'s documentation for valid project structures and common parsing issues.","cause":"This usually indicates that `peppy.Project()` failed to load your project configuration correctly, resulting in a `Project` object that is either `None` or incomplete. `eido` then tries to access non-existent attributes of this invalid project object.","error":"AttributeError: 'NoneType' object has no attribute 'get' (or similar error when accessing project attributes)"}]}