{"id":3880,"library":"application-properties","title":"Application Properties","description":"Application-properties is a Python library (current version 0.9.2) that provides a simple, unified manner of accessing program properties. It supports loading configuration from various formats including JSON, TOML, YAML, JSON5, and traditional .properties files. The library emphasizes ease of use, testability, extensibility, and hierarchical property access, releasing frequently with new features and fixes.","status":"active","version":"0.9.2","language":"en","source_language":"en","source_url":"https://github.com/jackdewinter/application_properties","tags":["configuration","properties","yaml","json","toml","json5","ini"],"install":[{"cmd":"pip install application-properties","lang":"bash","label":"Base installation"},{"cmd":"pip install application-properties[yaml,toml,json5]","lang":"bash","label":"With all optional loaders"}],"dependencies":[{"reason":"Required for loading properties from YAML files.","package":"PyYAML","optional":true},{"reason":"Required for loading properties from TOML files.","package":"toml","optional":true},{"reason":"Required for loading properties from JSON5 files (which support comments).","package":"json5","optional":true}],"imports":[{"symbol":"ApplicationProperties","correct":"from application_properties import ApplicationProperties"}],"quickstart":{"code":"import os\nfrom application_properties import ApplicationProperties\n\n# Create a dummy config file for demonstration\nconfig_content = \"\"\"\nmy.setting = some_value\nanother.setting = 123\n\"\"\"\nwith open(\"config.properties\", \"w\") as f:\n    f.write(config_content)\n\ntry:\n    # Load properties from a file named config.properties\n    app_props = ApplicationProperties(\"config.properties\")\n\n    # Access a property\n    value = app_props.get_string_property(\"my.setting\")\n    print(f\"Value of 'my.setting': {value}\")\n\n    # Access a property with a default value if not found\n    not_found_value = app_props.get_string_property(\"non.existent\", \"default_value\")\n    print(f\"Value of 'non.existent' (with default): {not_found_value}\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\nfinally:\n    # Clean up the dummy file\n    if os.path.exists(\"config.properties\"):\n        os.remove(\"config.properties\")","lang":"python","description":"Demonstrates how to load properties from a simple `.properties` file and access values. The example creates a temporary `config.properties` file and cleans it up afterwards."},"warnings":[{"fix":"Review configuration files (especially JSON, YAML, TOML) to ensure correct hierarchical parsing. If a literal `.` in a key is intended, consult the official documentation for the 'master switch' to disable hierarchical interpretation for specific keys or loaders.","message":"Starting from version 0.9.2, the library's loaders for JSON, YAML, and TOML gained enhanced support for handling `.` characters within keys. By default, `.` implies hierarchical structure. If you relied on `.` being treated as a literal character in keys for these formats in older versions, you might need to adjust your configuration or use the 'master switch' to control this behavior.","severity":"gotcha","affected_versions":">=0.9.2"},{"fix":"Install with optional extras, e.g., `pip install application-properties[yaml,toml,json5]` to include all supported loaders. Install only the specific extras you need to avoid unnecessary dependencies.","message":"Functionality for YAML, TOML, and JSON5 files requires installing optional dependencies. If these are not installed, attempts to load these file types will fail with import errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your Python environment is version 3.10.0 or higher. Upgrade Python if necessary.","message":"The `application-properties` library requires Python 3.10 or newer. Installing or running on older Python versions will result in environment or syntax errors.","severity":"breaking","affected_versions":"<3.10.0"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}