{"id":15062681,"url":"https://github.com/jaanli/nomen","last_synced_at":"2026-01-02T15:47:51.893Z","repository":{"id":57446590,"uuid":"77150279","full_name":"jaanli/nomen","owner":"jaanli","description":":goat: Lightweight configuration trees with command line flags :goat:","archived":false,"fork":false,"pushed_at":"2019-05-18T19:41:38.000Z","size":45,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-17T19:43:02.934Z","etag":null,"topics":["config","configuration","dictionary","nested","nomen","python","tree","yaml"],"latest_commit_sha":null,"homepage":"","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/jaanli.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":"2016-12-22T14:19:59.000Z","updated_at":"2019-05-18T19:41:40.000Z","dependencies_parsed_at":"2022-09-02T23:40:24.950Z","dependency_job_id":null,"html_url":"https://github.com/jaanli/nomen","commit_stats":null,"previous_names":["altosaar/nomen"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaanli%2Fnomen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaanli%2Fnomen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaanli%2Fnomen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaanli%2Fnomen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaanli","download_url":"https://codeload.github.com/jaanli/nomen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243826829,"owners_count":20354220,"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":["config","configuration","dictionary","nested","nomen","python","tree","yaml"],"created_at":"2024-09-24T23:44:37.589Z","updated_at":"2026-01-02T15:47:51.855Z","avatar_url":"https://github.com/jaanli.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nomen\n[![Build Status](https://travis-ci.org/altosaar/nomen.svg?branch=master)](https://travis-ci.org/altosaar/nomen)\n\n[Nomen](https://en.wikipedia.org/wiki/Nomen_nudum) or _nomen nudum_ means _naked name_ in taxonomy. The goal of this package is to provide python programs with highly-readable, minimalist configuration and command line flags based on YAML syntax. The main difference compared to the standard argparse library is that a nomen configuration file and and command line flag definition are the same thing. This means defining command line flags is less verbose.  \n\nDefine a configuration with YAML syntax and any environment variables:\n\nFile `main.py`\n```\nimport yaml\nimport nomen\n\"\"\"\nmodel:\n  learning_rate: 0.1\n  turbo: false\nvariational:\n  learning_rate: 0.3\n\ndata:\n  shape: \u0026shape [28, 28, 1]\neval_data:\n  shape: *shape\n\nlog: $LOG  ## will be replaced by the $LOG environment variable\n\"\"\"\ncfg = nomen.Config(yaml.safe_load('config.yml'))\ncfg.parse_args()\nprint('Model options', cfg['model'])\nprint('Model learning rate', cfg.model.learning_rate)\nprint('Eval options', cfg['eval_data'])\n```\n\nConfigurations define command line arguments:\n```\npython main.py \\\n\t--model/learning_rate 0.001 \\\n\t--log /tmp \\\n\t--model/turbo\n```\n\nConfigurations are portable - save and load using yaml:\n```\nwith open('config.yml', 'w') as f:\n  f.write(str(cfg))\n```\n\n\n### Install\n```\npip install nomen\n```\n\n### Reasons for not using\nIt is easy to write subtle bugs with YAML parsing a boolean incorrectly. c.f. [problems with YAML](https://arp242.net/weblog/yaml_probably_not_so_great_after_all.html). TODO: switch `load` to `safe_load`. Consider switching to StrictYAML.\n\n\n### Testing\n```\n# create a symbolic link to the package for testing\npip install -e .\n# run all the tests\npytest\n```\n\n### Pushing to pypi\n```\n# build the package, possibly with a new version.py\npython setup.py sdist bdist_wheel\n# test the built package\npip install -i https://testpypi.python.org/pypi nomen\n# upload to pypi\ntwine upload dist/*\n# test again\npip install nomen --no-cache-dir\n```\n\n\n### Acknowledgments\nMany thanks to Rajesh - this is based around his advice and ideas, which I've found it very useful. Many props to Bharat for helping subclass addict.Dict in the proper way and providing proper support.\n\n### Contributing\nPull requests and issues welcome. Please help\n\n### Wishlist / todo\n* How to design global options? In yaml?\n* \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaanli%2Fnomen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaanli%2Fnomen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaanli%2Fnomen/lists"}