{"id":28201126,"url":"https://github.com/superstrong/yaml-io","last_synced_at":"2026-02-27T15:36:34.469Z","repository":{"id":286495789,"uuid":"961576847","full_name":"superstrong/yaml-io","owner":"superstrong","description":"Import YAML anchors from external files, and export them for re-use in other files","archived":false,"fork":false,"pushed_at":"2025-04-25T12:52:20.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-20T03:02:01.347Z","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/superstrong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-06T19:47:16.000Z","updated_at":"2025-04-25T12:52:23.000Z","dependencies_parsed_at":"2025-04-07T03:29:22.733Z","dependency_job_id":"869c4748-e321-44ac-99b0-3f8814942b5f","html_url":"https://github.com/superstrong/yaml-io","commit_stats":null,"previous_names":["superstrong/yaml_io","superstrong/yaml-io"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/superstrong/yaml-io","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superstrong%2Fyaml-io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superstrong%2Fyaml-io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superstrong%2Fyaml-io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superstrong%2Fyaml-io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/superstrong","download_url":"https://codeload.github.com/superstrong/yaml-io/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/superstrong%2Fyaml-io/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270781393,"owners_count":24643820,"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","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-05-16T22:16:04.217Z","updated_at":"2026-02-27T15:36:34.439Z","avatar_url":"https://github.com/superstrong.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YAML-io\n\nThis Python library enables YAML anchors to be imported from external files via custom directives. It also enables imported anchors to be re-exported, so one file can unify many imports and them export them as one source.\n\nThis has a few benefits:\n\n- Re-use the same aliases in multiple files without repeating yourself\n- Use aliases without worrying about reordering your file, because the anchors are defined elsewhere\n- Use multiple layers of imports to logically separate concerns and create versions of files that update all downstream files simultaneously.\n\n## Setup\n\n1. If a user calls yaml.load(...) and passes in:\n\n- A path to a file on disk\n\n    → _try_file_path_and_load calls load_imports_exports(...) on that file, recursively resolving #!import statements.\n\n- A file object with a valid .name attribute that actually exists on disk\n\n    → same as above.\n\n- Otherwise, the library just falls back to normal PyYAML behavior (e.g., inline YAML in a string, or a non‑file input).\n\n2. There are no code changes.\n\n```python\nimport yaml\nimport yaml_io  # triggers the patch\n\nwith open(\"some_yaml.yaml\") as f:\n    data = yaml.safe_load(f)  # Now automatically supports #!import, #!export\n```\n\n## Usage\n\nMark directives in your YAML like:\n\n```yaml\n#!import ../../global/prod-default/base-package.yml as base\n```\n\nand refer to imported anchors as:\n\n```yaml\n- *base.progress_check_model\n```\n\nAnchors defined directly in the file are automatically available to downstream files. Imported anchors need to be re‑exported with a directive like:\n\n```yaml\n#!export base.progress_check_model\n```\n\n## Versioning Example\n\nA versioned file containing all the anchors we want to define once. Imagine we have multiple files and many anchors.\n\n```yaml\n./global/versions/v1.2/actions.yml\n\n- \u0026anchor1\n- \u0026anchor2\n```\n\nA router-like file where we refer to the versioned files and export them for re-use:\n```\n./global/prod-default/base-package.yml\n\n#!import ../../versions/v1.2/acions.yml as a\n\n#!export a.anchor1, a.anchor2\n```\n\nThe most downstream file where all anchors are resolved and used as aliases, such as this example `./workspace/acme/actions.yml`:\n\n```yaml\n#!import ../../global/prod-default/base-package.yml as base\n\n- *base.anchor1\n- *base.anchor2\n```\n\n- One advantage to using the `base-package` intermediary is the ability to change everything from v1.2 to v1.3 with a small number of changes when you're ready.\n\n- One advantage to using the `prod-default` folder is you can create other folders, such as `prod-beta` or `uat-default` and point specific files there instead for testing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperstrong%2Fyaml-io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuperstrong%2Fyaml-io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperstrong%2Fyaml-io/lists"}