Skip to main content

Build arbitrary Python objects from YAML or TOML configuration files.

Project description

whereby an artificer uses runes and delicate metalwork to create items capable of amazing feats.

Sygaldry is a Python library for building arbitrary object graphs from YAML or TOML configuration files. It is designed for teams that run many similar scheduled jobs and want to write reusable components, then compose them through configuration rather than code.

Features

  • YAML and TOML configuration with deep-merge includes.

  • Interpolation${VAR} placeholders resolved from config paths, environment variables, or defaults.

  • Component instantiation_type mappings construct classes, _func mappings import callables.

  • References_ref wires components together by name or dotted attribute path.

  • Instance caching – identical specs share instances; named _instance tags give explicit control.

  • Safety – no eval, no arbitrary code; imports are by dotted path only.

Installation

pip install sygaldry

Quick start

Define your components in a YAML file:

# config.yaml
db:
  _type: "myapp.db.Database"
  host: "${DB_HOST:-localhost}"
  port: 5432

service:
  _type: "myapp.services.UserService"
  db: { _ref: "db" }

Then load and resolve:

from sygaldry import load

graph = load("config.yaml")
service = graph["service"]   # a fully wired UserService instance

Or use the Artificery class for more control:

from sygaldry import Artificery

factory = Artificery("config.yaml", transient=True)
graph = factory.resolve()

License

MIT

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

sygaldry-0.2.0.tar.gz (29.3 MB view details)

Uploaded Source

Built Distribution

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

sygaldry-0.2.0-py2.py3-none-any.whl (28.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sygaldry-0.2.0.tar.gz.

File metadata

  • Download URL: sygaldry-0.2.0.tar.gz
  • Upload date:
  • Size: 29.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for sygaldry-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9a700ccc584e1ace995c05ecd10013d9b8de132f0a6e58e4ad792762ffea3855
MD5 7b492b591fae28c575acf397e07b0c75
BLAKE2b-256 df3f81902b4b2be669a21a4dc73e00abb16270778cff7fce0ac319b747e6352a

See more details on using hashes here.

File details

Details for the file sygaldry-0.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: sygaldry-0.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 28.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for sygaldry-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e2263fe80f39073b5b85be719854bc4e61afc5d182d95ce8601d7b1f85d7306b
MD5 8eb4764938ca79c102f0d0caa6c2a865
BLAKE2b-256 5f9f60fca2e3e87336f9e6a11e2793f8c225bacb04696c00612a831aff2bac3a

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