{"id":28778643,"url":"https://github.com/thyeem/ouch","last_synced_at":"2026-03-08T11:32:22.169Z","repository":{"id":259620849,"uuid":"879012568","full_name":"thyeem/ouch","owner":"thyeem","description":"A collection of useless utilities","archived":false,"fork":false,"pushed_at":"2025-05-28T18:00:56.000Z","size":177,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-11T05:19:04.919Z","etag":null,"topics":["functional","functional-python","utilities","utility-library"],"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/thyeem.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","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,"zenodo":null}},"created_at":"2024-10-26T18:08:53.000Z","updated_at":"2025-05-28T18:01:00.000Z","dependencies_parsed_at":"2024-10-26T23:28:20.881Z","dependency_job_id":"828c6e79-a9ed-4823-b7b3-6e962be87bb0","html_url":"https://github.com/thyeem/ouch","commit_stats":null,"previous_names":["thyeem/ouch"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thyeem/ouch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thyeem%2Fouch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thyeem%2Fouch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thyeem%2Fouch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thyeem%2Fouch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thyeem","download_url":"https://codeload.github.com/thyeem/ouch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thyeem%2Fouch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266510352,"owners_count":23940642,"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-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["functional","functional-python","utilities","utility-library"],"created_at":"2025-06-17T16:42:28.776Z","updated_at":"2025-10-16T18:22:28.564Z","avatar_url":"https://github.com/thyeem.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e \u003cimg src=\"https://raw.githubusercontent.com/thyeem/ouch/main/ouch.png\" height=\"250\"/\u003e\u003c/p\u003e\n\n[![ouch](https://img.shields.io/pypi/v/ouch)](https://pypi.org/project/ouch)\n\n# ouch\n\n_Odd Utiltiy Collection Hub_.\n\n[`ouch`](https://github.com/thyeem/ouch) is a collection of utilities that are based on and aligned with [`foc`](https://github.com/thyeem/foc).\n\n```bash\n$ pip install -U ouch\n```\n\n```python\nfrom ouch import *\n\n# soft flatten\n\u003e\u003e\u003e flatten([1, [2, 3, (4, 5)]])\n[1, 2, 3, (4, 5)]\n# hard flatten\n\u003e\u003e\u003e [1, [(2,), [[{3}, (x for x in range(3))]]]] | flat | collect\n[1, 2, 3, 0, 1, 2]\n\n# 'shell' command\n\u003e\u003e\u003e shell(f\"du -hs ouch/__init__.py 2\u003e/dev/null\") | fst | ob(_.split)()\n['40K', 'ouch/__init__.py']\n\n# 'ls' command\n\u003e\u003e\u003e ls(\".\", r=True, grep=\"^(ouch).*py$\")\n['ouch/__init__.py']\n\n# poor man's dot-accessible dict, 'dmap' and pretty-printer 'pp'\n\u003e\u003e\u003e d = dmap(name=\"yunchan lim\", age=19)\n\u003e\u003e\u003e d.cliburn.semifinal.concerto = \"Mozart Piano Concerto No.22, K.482\"\n\u003e\u003e\u003e d.cliburn.semifinal.recital = \"Liszt 12 Transcendental Etudes\"\n\u003e\u003e\u003e d.cliburn.final = \"Rachmaninov Piano Concerto No.3, Op.30\"\n\u003e\u003e\u003e d | pp\n  cliburn |     final | Rachmaninov Piano Concerto No.3, Op.30\n            semifinal | concerto | Mozart Piano Concerto No.22, K.482\n                         recital | Liszt 12 Transcendental Etudes\n     name | yunchan lim\n\n# poor man's 'tabulate'\n\u003e\u003e\u003e data = [['Name', 'Age'], ['Sofia', 9], ['Maria', 7]]\n\u003e\u003e\u003e print(tabulate(data, style='grid'))    # style={'org', 'markdown', ...}\n+-------+-----+\n| Name  | Age |\n+=======+=====+\n| Sofia | 9   |\n+-------+-----+\n| Maria | 7   |\n+-------+-----+\n\n# poor man's progress bar, 'tracker'\n\u003e\u003e\u003e for batch in tracker(dataloader, \"training\"):  # single progress bar\n...     model(batch)\n\n\u003e\u003e\u003e for i in tracker(range(10), \"outer\"):  # nested progress bars\n...     ...             \n...     for j in tracker(range(20), \"inner\"):\n...         ...              \n\n\u003e\u003e\u003e g = (x for x in range(100))\n\u003e\u003e\u003e for item in tracker(g, \"task\", total=100):  # generator with known length\n...     process(item)\n\n\n# and see more poor man's things in 'ouch'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthyeem%2Fouch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthyeem%2Fouch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthyeem%2Fouch/lists"}