{"id":7495,"library":"peppy","title":"peppy","description":"peppy is the official Python package for reading Portable Encapsulated Projects (PEPs). It provides a Python interface for managing project metadata, including samples and their attributes. The library facilitates loading, validating, and interacting with PEP-formatted metadata. The current stable version is 0.40.8, with significant breaking changes anticipated in the upcoming 0.50.0aX releases. It maintains an active development and release cadence.","status":"active","version":"0.40.8","language":"en","source_language":"en","source_url":"https://github.com/pepkit/peppy/","tags":["data management","metadata","bioinformatics","PEP","project management"],"install":[{"cmd":"pip install peppy","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"Project","correct":"from peppy import Project"}],"quickstart":{"code":"import os\nfrom peppy import Project\n\n# For a runnable example, clone the example_peps repository:\n# git clone https://github.com/pepkit/example_peps.git\n# and adjust the path below to 'example_peps/example_basic/project_config.yaml'\n\n# Placeholder for a project configuration file (YAML or CSV).\n# In a real scenario, replace with the actual path to your PEP config.\nproject_path = os.environ.get('PEPPY_PROJECT_CONFIG', 'path/to/your/project_config.yaml')\n\ntry:\n    # Instantiate an in-memory Project representation\n    prj = Project(cfg=project_path)\n    print(f\"Successfully loaded Project: '{prj.name}'\")\n    print(f\"Number of samples: {len(prj.samples)}\")\n\n    if prj.samples:\n        first_sample = prj.samples[0]\n        print(f\"\\nFirst sample name: {first_sample.sample_name}\")\n        # Access a sample attribute, e.g., 'protocol' or 'file'\n        if 'protocol' in first_sample:\n            print(f\"First sample's protocol: {first_sample.protocol}\")\n    else:\n        print(\"No samples found in the project.\")\n\nexcept FileNotFoundError:\n    print(f\"Error: Project configuration file not found at '{project_path}'.\")\n    print(\"Please ensure the path is correct or clone a PEP example.\")\nexcept Exception as e:\n    print(f\"An error occurred during project loading: {e}\")","lang":"python","description":"Demonstrates how to initialize a `peppy.Project` object from a configuration file and access its samples and their attributes. Users should provide their own PEP configuration file."},"warnings":[{"fix":"Review the `peppy` documentation for 0.50.0aX to understand how merged functionalities are accessed internally. Remove direct `pephubclient` and `eido` imports related to PEP processing.","message":"Starting from version 0.50.0a1, functionality previously provided by external `pephubclient` and `eido` libraries has been merged directly into `peppy`. Code relying on direct imports or usage of these separate packages for PEP-related operations will break.","severity":"breaking","affected_versions":">=0.50.0a1"},{"fix":"Consult the updated CLI documentation for version 0.50.0aX to learn the new command structure and usage with `typer`.","message":"The command-line interface (CLI) in `peppy` has been completely revamped and switched to `typer` in version 0.50.0a1. Existing CLI commands will no longer work as before.","severity":"breaking","affected_versions":">=0.50.0a1"},{"fix":"Ensure the `cfg` path is absolute or correctly relative to the current working directory. Validate your YAML file for syntax errors and confirm that all referenced files (like `sample_table.csv`) exist and are accessible. Refer to the PEP specification for correct format.","message":"Project initialization (`peppy.Project(cfg=...)`) requires a correctly formatted PEP configuration file (typically YAML) that points to a sample table. Incorrect paths, malformed YAML, or missing files are common issues leading to errors.","severity":"gotcha","affected_versions":"<0.50.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Install the library using pip: `pip install peppy`","cause":"The 'peppy' library is not installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'peppy'"},{"fix":"Verify that the `project_config.yaml` file exists at the specified path. Use an absolute path or ensure the relative path is correct from where your script is run. Consider cloning the `pepkit/example_peps` repository for test data.","cause":"The configuration file specified during `Project` initialization either does not exist or the provided path is incorrect.","error":"FileNotFoundError: [Errno 2] No such file or directory: 'path/to/project_config.yaml'"},{"fix":"Review your `project_config.yaml` and associated sample table(s) to ensure they correctly define samples. If you initialized with `defer_samples_creation=True`, call `prj.create_samples()` before attempting to access `prj.samples`.","cause":"This often occurs if the project configuration (e.g., `sample_table.csv`) is empty, malformed, or if `defer_samples_creation=True` was used without subsequently creating samples.","error":"AttributeError: 'Project' object has no attribute 'samples' (or similar errors when accessing project/sample data)"}]}