{"id":9542,"library":"bagit-profile","title":"BagIt Profile Validator","description":"The `bagit-profile` library provides tools to validate BagIt Profiles, ensuring that digital preservation packages conform to a specified set of rules. It is designed to work in conjunction with the `bagit` library to validate actual BagIt bags against these profiles. The current version is 1.3.1, with an infrequent release cadence (last major release in 2020).","status":"active","version":"1.3.1","language":"en","source_language":"en","source_url":"https://github.com/bagit-profiles/bagit-profiles-validator","tags":["bagit","digital preservation","validation","archiving","data packaging"],"install":[{"cmd":"pip install bagit-profile","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required for creating and working with BagIt bags, which are validated against BagIt Profiles. Specifically depends on `bagit==1.7.0`.","package":"bagit","optional":false}],"imports":[{"note":"The primary class `BagitProfile` is typically imported directly from the top-level package.","wrong":"import bagit_profile; profile = bagit_profile.BagitProfile(...)","symbol":"BagitProfile","correct":"from bagit_profile import BagitProfile"}],"quickstart":{"code":"import os\nfrom bagit_profile import BagitProfile\n\n# Define a public BagIt Profile URI for demonstration\nprofile_uri = \"https://raw.githubusercontent.com/bagit-profiles/bagit-profiles/master/bagitProfileFAB.json\"\n\nprint(f\"Attempting to load BagIt Profile from URI: {profile_uri}\")\n\ntry:\n    # Load the BagIt Profile from the URI\n    profile = BagitProfile.from_uri(profile_uri)\n    \n    print(f\"\\nSuccessfully loaded profile with identifier: {profile.bag_profile_identifier}\")\n    print(f\"Profile version: {profile.profile_version}\")\n    print(f\"BagIt-Profile-Description: {profile.bag_info.get('BagIt-Profile-Description', 'N/A')}\")\n    \n    # To perform actual validation, you would need a 'bagit.Bag' object:\n    # from bagit import Bag\n    # bag = Bag('/path/to/your/bag') # Replace with an actual Bag path\n    # is_valid = profile.validate(bag)\n    # print(f\"\\nBag validation result: {is_valid}\")\n    # if not is_valid:\n    #     print(\"Validation errors:\")\n    #     for error in profile.errors:\n    #         print(f\"- {error}\")\n\nexcept Exception as e:\n    print(f\"\\nAn error occurred during profile loading: {e}\")\n","lang":"python","description":"This quickstart demonstrates how to load a BagIt Profile from a remote URI. It prints some basic information from the loaded profile. To perform actual validation, you would additionally need to create or load a `bagit.Bag` object and pass it to the `profile.validate()` method."},"warnings":[{"fix":"Thoroughly test with your specific Python and `bagit` library versions. Consider forking or contributing if critical updates are needed.","message":"The `bagit-profile` library has not been updated since March 2020. While functional, users should be aware of its infrequent maintenance and consider potential compatibility issues with newer Python versions or significant changes in the `bagit` library.","severity":"gotcha","affected_versions":"All versions post 1.3.1"},{"fix":"Upgrade to `bagit-profile` version 1.3.1 or later to enable case-insensitive Bag-Info tag validation. Ensure your BagIt Profile also defines tag names consistently.","message":"Prior to version 1.3.1, validation of Bag-Info tags was case-sensitive, which could lead to unexpected validation failures if tag names varied in casing (e.g., 'Bagging-Date' vs 'bagging-date').","severity":"breaking","affected_versions":"<1.3.1"},{"fix":"When installing, ensure `bagit==1.7.0` is installed alongside `bagit-profile`. If encountering issues, check the `bagit` version and try to downgrade it to `1.7.0` if a newer version was installed.","message":"The library explicitly depends on `bagit==1.7.0`. While `bagit` is generally stable, future breaking changes in the `bagit` library could cause incompatibilities if `bagit-profile` is not updated.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Run `pip install bagit-profile` to install the library.","cause":"The `bagit-profile` library is not installed in your current Python environment.","error":"ModuleNotFoundError: No module named 'bagit_profile'"},{"fix":"Use the correct import statement: `from bagit_profile import BagitProfile`. Then you can directly use `profile = BagitProfile(...)`.","cause":"This usually happens when you try to access the `BagitProfile` class after a generic `import bagit_profile` without explicitly importing the class. For example: `import bagit_profile; profile = bagit_profile.BagitProfile(...)`","error":"AttributeError: module 'bagit_profile' has no attribute 'BagitProfile'"},{"fix":"Inspect the JSON content (from file or URI) for syntax errors (e.g., missing commas, unclosed brackets, incorrect string escaping). Use a JSON validator tool to pinpoint the exact issue.","cause":"The BagIt Profile JSON file or URI you are trying to load is malformed or invalid JSON, preventing the library from parsing it.","error":"json.decoder.JSONDecodeError: Expecting value: line X column Y (char Z)"}]}