{"id":14985549,"url":"https://github.com/yaml/pyyaml-future","last_synced_at":"2025-10-19T11:32:04.260Z","repository":{"id":50308230,"uuid":"339546833","full_name":"yaml/pyyaml-future","owner":"yaml","description":null,"archived":false,"fork":false,"pushed_at":"2021-08-09T02:19:42.000Z","size":40,"stargazers_count":3,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-10-29T15:31:42.998Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yaml.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":"License","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-16T22:19:57.000Z","updated_at":"2023-10-28T04:55:32.000Z","dependencies_parsed_at":"2022-09-05T16:40:48.354Z","dependency_job_id":null,"html_url":"https://github.com/yaml/pyyaml-future","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaml%2Fpyyaml-future","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaml%2Fpyyaml-future/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaml%2Fpyyaml-future/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaml%2Fpyyaml-future/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yaml","download_url":"https://codeload.github.com/yaml/pyyaml-future/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237117260,"owners_count":19258378,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T14:11:11.619Z","updated_at":"2025-10-19T11:31:59.000Z","avatar_url":"https://github.com/yaml.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"pyyaml-future\n=============\n\nUse YAML 1.3 Features in PyYAML (YAML 1.1)\n\n## Synopsis\n```\nimport yaml\nfrom yamlfuture import Loader\n\n# Define your own anchors:\nLoader.anchors = {'name': 'YAML'}\n# !import relative to this:\nLoader.filepath = __file__\n\nyamlstream = \"\"\"\\\n---\ngreeting: !+ |\n  Hello {*name}.\n  Welcome to the future!\n\ncopyright: !import [../data.yaml, /copyright/year]\n\"\"\"\n\nprint(yaml.dump(yaml.load(yamlstream, Loader))\n```\n\n## Status\n\nThis module is *very* **ALPHA**.\n\nYAML 1.3 is still being defined.\nAs the various features of the YAML 1.3 evolve, `yamlfuture` will evolve.\n\nUse with caution for now.\n\n## Description\n\nYAML 1.3 is bringing exciting new features to YAML (while keeping the YAML you\nknow and love (or hate) the same).\n\nThis package lets you use the new features (or close approximations) in PyYAML\nnow.\n\nThis is a very early release.\nMore features and documentation coming soon.\n\n## Features\n\nYAML 1.3 adds optional \"language features\" that you can request that a parser\nuse.\nSome of the planned ones are:\n\n* Standard Library node functions:\n  ```\n  - @merge(*base)\n    foo: 42\n  - stuff: @import stuff.yaml\n  ```\n\n* String expansion (interpolation):\n  ```\n  greeting: `Hello {*name}`\n  ```\n\n* Extended aliases with YPath:\n  ```\n  total: @sum(*nums/x, $*nums/y)\n  ```\n\nIn current PyYAML we can emulate these with tags and implicit typing, as long\nas we don't use invalid YAML 1.1 syntax.\n\nFor `@func(1,2)` we use `!func [1,2]`\n\nFor `*alias/path/value` we use `+*alias/path/value`.\n\nFor interpolation we use `!+ Hello {*name}` instead of backticks.\n\nYAML 1.3 actually parses these new things into the same event model.\nIn other words, a 1.3 parser would report `@foo(*bar,42)` as `!foo [*bar, 42]`.\nJust with a cleaner syntax.\n\n### yamlfuture current features\n\n* Merge a sequence of mappings:\n  ```\n  merged: !merge [*map1, *map2, foo: bar]\n  ```\n\n* Define anchors (from Python) outside the YAML stream:\n  ```\n  Loader.anchors = {\"name\": \"world\"}\n  yaml.load(\"hello: *name\", Loader)\n  ```\n\n* Use aliases with paths:\n  ```\n  value: \u0026foo\n    yaml: future\n  when: +*foo/yaml\n  absolute: +*/foo/0/bar\n  siblings:\n    a: 2\n    b: 4\n    all: [+*:a, +*:b]\n  foo: { bar: +*../../siblings/a }\n  ```\n\n* String interpolation:\n  ```\n  greeting: !+ Hello {*name}!\n  ```\n\n* Import other YAML files into any node:\n  ```\n  foo: !import foo.yaml\n  bar: !import [foo.yaml, /0/bar]\n  ```\n\n* Import/render external \"template\" yaml files:\n  ```\n  # file 'template.yaml'\n  foo:\n    bar: *value\n\n  # file 'main.yaml'\n  bar: !render [template.yaml, value: baz]\n  ```\n\n## License \u0026 Copyright\n\nThis project is licensed under the terms of the `MIT` license.\nSee [LICENSE](https://github.com/yaml/pyyaml-future/blob/main/LICENSE) for more\ndetails.\n\nCopyright 2021 Ingy döt Net \u003cingy@ingy.net\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyaml%2Fpyyaml-future","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyaml%2Fpyyaml-future","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyaml%2Fpyyaml-future/lists"}