{"id":17623526,"url":"https://github.com/maxme1/lazycon","last_synced_at":"2025-04-30T22:08:44.618Z","repository":{"id":37551908,"uuid":"342012291","full_name":"maxme1/lazycon","owner":"maxme1","description":"Easy config files in pure Python","archived":false,"fork":false,"pushed_at":"2024-11-16T21:30:42.000Z","size":358,"stargazers_count":8,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-30T22:08:32.894Z","etag":null,"topics":["config","python"],"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/maxme1.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-24T19:30:11.000Z","updated_at":"2025-04-23T15:57:16.000Z","dependencies_parsed_at":"2025-03-09T15:41:42.046Z","dependency_job_id":null,"html_url":"https://github.com/maxme1/lazycon","commit_stats":{"total_commits":221,"total_committers":3,"mean_commits":73.66666666666667,"dds":"0.018099547511312264","last_synced_commit":"bfeebc0a677c42321bcd27e685160cbc16cb3028"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxme1%2Flazycon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxme1%2Flazycon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxme1%2Flazycon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxme1%2Flazycon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxme1","download_url":"https://codeload.github.com/maxme1/lazycon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251789612,"owners_count":21644085,"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","python"],"created_at":"2024-10-22T21:10:30.670Z","updated_at":"2025-04-30T22:08:44.576Z","avatar_url":"https://github.com/maxme1.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![codecov](https://codecov.io/gh/maxme1/lazycon/branch/master/graph/badge.svg)](https://codecov.io/gh/maxme1/lazycon)\n[![pypi](https://img.shields.io/pypi/v/lazycon?logo=pypi\u0026label=PyPi)](https://pypi.org/project/lazycon/)\n![License](https://img.shields.io/github/license/maxme1/lazycon)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/lazycon)](https://pypi.org/project/lazycon/)\n![GitHub branch checks state](https://img.shields.io/github/checks-status/maxme1/lazycon/master)\n\nEasy config files in pure Python!\n\nWhat you can do directly in your configs:\n\n- define constants\n- define functions\n- use import statements\n- call functions and apply arithmetic operations\n- a static read-only scope\n- static checking: cycles detection, undefined variables detection\n\n# Install\n\n```shell\npip install lazycon\n```\n\n# Features\n\n## Basic\n\nLet's define a config file `example.config` and see what it can do\n\n```python\n# define constants\nnum_steps = 100\ndatabase_table = 'user_data'\n\n# or more complex structures\nparameters = {\n    'C': 10,\n    'metric': 'roc_auc',\n}\nvalues_to_try = [0, 1, 2, 3, 4]\n\n# you can use and call builtins\nsome_range = list(range(100))\n# or even comprehensions!\nsquares = [i ** 2 for i in range(20)]\n```\n\nNow let's load our config from python\n\n```python\nfrom lazycon import load\n\nconfig = load('example.config')\nprint(config.database_table)\n# 'user_data'\n```\n\nNeed to change an existing config? No problem!\n\n```python\nfrom lazycon import load\n\nconfig = load('example.config')\nconfig.update(\n    database_table='customer_data',\n    some_range=[1, 3, 5],\n)\nconfig.dump('updated.config')\n```\n\n## Advanced\n\nPython-based configs can do so much more! Let's create another `advanced.config`:\n\n```python\n# combine config entries\nx = 1\ny = 2\nz = x + y\n\n# define lambdas\ncallback = lambda value: 1 if value == 0 else (1 / value)\n\n\n# or more complex functions\ndef strange_normalize(a, b):\n    temp = a ** 2 + b ** 2\n    return a / temp, b / temp\n```\n\nYou can import from other python libraries:\n\n```python\nimport numpy as np\nfrom math import sqrt\n\nconst = np.pi / np.e\nproportions = sqrt(2)\n```\n\nOr even other configs!\n\n```python\n# import from `example.config` defined above\nfrom .example import *\n\nextended_values_to_try = values_to_try + [101, 102]\n```\n\n# Contribute\n\nJust get the project from GitHub and modify it how you please!\n\n```shell\ngit clone https://github.com/maxme1/lazycon.git\ncd lazycon\npip install -e .\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxme1%2Flazycon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxme1%2Flazycon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxme1%2Flazycon/lists"}