Skip to main content

Universal Configuration Language (UCL) Parser

Project description

UCL Parser

A Python library for parsing Universal Configuration Language (UCL) files.

Features

  • Complete implementation of the UCL specification
  • Support for all UCL data types (strings, numbers, booleans, arrays, objects, null)
  • Arithmetic operations and string concatenation
  • Variable references and complex path resolution
  • Environment variable resolution
  • Type conversion system
  • Include/import functionality
  • Defaults section support
  • Comprehensive error handling

Installation

pip install ucl-parser

Quick Start

from ucl_parser import parse_ucl_file, parse_ucl_string

# Parse from file
config = parse_ucl_file("config.ucl")

# Parse from string
config_string = """
[Database]
host = "localhost"
port = 5432
enabled = true
"""

config = parse_ucl_string(config_string)
print(config['Database']['host'])  # Output: localhost

UCL Syntax Overview

UCL supports various data types and features:

Basic Key-Value Pairs

[Section]
key = "value"
number = 42
flag = true

Arrays and Objects

[Data]
list = [1, 2, 3, "four"]
config = {
    "nested": {
        "key": "value"
    }
}

Variable References

[Config]
base_url = "https://api.example.com"
full_url = base_url + "/v1/users"

Environment Variables

[Runtime]
api_key = $ENV{API_KEY}
debug = $ENV{DEBUG_MODE}

Type Conversions

[Conversions]
string_num = "123"
as_int = string_num.int
as_float = string_num.float
as_bool = "true".bool

Testing

Run the test suite:

python -m pytest test_ucl_parser.py -v

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ucl_parser-1.0.0.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ucl_parser-1.0.0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file ucl_parser-1.0.0.tar.gz.

File metadata

  • Download URL: ucl_parser-1.0.0.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for ucl_parser-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d94ab28d4041ba87c7101e0ee57e554a2b038718d76ad6df2df43292d40c748f
MD5 e4591d1f50b30937d12ac54aa74255be
BLAKE2b-256 b8706e3ddd38e19c9a85a6a2340db7bb342611a1407216ca0becb94d8a197ef8

See more details on using hashes here.

File details

Details for the file ucl_parser-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ucl_parser-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for ucl_parser-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a5f3b183cb6f9443e917861e44a058aaefa9c080138eff59379b80642483961a
MD5 291e4ca62e37362e75c69292666a7339
BLAKE2b-256 66841260008a74cb7b65b0549c122df09061e7a4cde3579516a83c25564a1d83

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page