{"slug": "sh", "name": "sh", "category": "dev-libs", "category_name": "Libraries and frameworks", "description": "", "recommenders": 3, "commenters": 4, "warners": 0, "score": 2.779, "rising": -0.98, "first": "2025-12-13", "latest": "2026-05-23", "why": "One thing I can recommend that makes scripting in python with external commands a lot easier is the `sh` module", "why_is_quote": true, "has_verdict": false, "sentiment": {"recommend": 3, "neutral": 1, "compare": 0, "warn": 0}, "spark": [0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], "listed": true, "loved": [], "caveat": "", "short_quote": "One thing I can recommend that makes scripting in python with external commands a lot easier is the `sh` module", "kind": "", "icon": false, "domain": null, "github_repo": "github.com/amoffat/sh", "official_url": "https://github.com/amoffat/sh", "pricing": "", "aliases": ["sh"], "verdict": null, "praise": [{"label": "", "summary": "", "quotes": [{"id": 771954640, "item_id": 48247165, "url": "https://news.ycombinator.com/item?id=48247165", "by": "dmd", "date": "2026-05-23", "version": null, "stance": "recommend", "quote": "have you seen https://sh.readthedocs.io/en/latest/", "excerpt": "have you seen https://sh.readthedocs.io/en/latest/", "context": "", "use_case": "", "switched_from": "", "story": "Rubish: A Unix shell written in pure Ruby"}, {"id": 740160720, "item_id": 46260045, "url": "https://news.ycombinator.com/item?id=46260045", "by": "btown", "date": "2025-12-13", "version": null, "stance": "recommend", "quote": "I love how this import trick shows how hackable Python is", "excerpt": "I love how this import trick shows how hackable Python is - and it\u2019s this very hackability that has led to so many of the advances we see in AI. Arguably without operator overloads we\u2019d be 5 or more years behind. https://github.com/amoffat/sh/blob/2a90b1f87a877e5e09da32fd4346fbe3454a5235/sh.py#L3688", "context": "", "use_case": "calling shell commands from Python", "switched_from": "", "story": "Using Python for Scripting"}, {"id": 740125808, "item_id": 46257863, "url": "https://news.ycombinator.com/item?id=46257863", "by": "theomega", "date": "2025-12-13", "version": null, "stance": "recommend", "quote": "One thing I can recommend that makes scripting in python with external commands a lot easier is the `sh` module", "excerpt": "One thing I can recommend that makes scripting in python with external commands a lot easier is the `sh` module: https://pypi.org/project/sh/ Basically you can just `from sh import [command]` and then have an installed binary command available as function from sh import ifconfig print(ifconfig(\"eth0\"))", "context": "", "use_case": "running shell commands in Python", "switched_from": "", "story": "Using Python for Scripting"}]}], "caveats": [], "who": [], "tags": [], "use_cases": ["calling shell commands from python", "running shell commands from python", "running shell commands in python"], "compared": [], "makers": [], "threads": [{"url": "https://news.ycombinator.com/item?id=46189962", "title": "Using Python for Scripting", "mentions": 3}, {"url": "https://news.ycombinator.com/item?id=48245262", "title": "Rubish: A Unix shell written in pure Ruby", "mentions": 1}], "sentiment_by_month": {"2025-11": {}, "2025-12": {"recommend": 2, "neutral": 1}, "2026-01": {}, "2026-02": {}, "2026-03": {}, "2026-04": {}, "2026-05": {"recommend": 1}, "2026-06": {}, "2026-07": {}, "2026-08": {}, "2026-09": {}, "2026-10": {}}, "versions": [], "version_unnamed": 0, "family_ref": null, "runs_on": null, "lines": [], "quotes": [{"id": 771954640, "item_id": 48247165, "url": "https://news.ycombinator.com/item?id=48247165", "by": "dmd", "date": "2026-05-23", "version": null, "stance": "recommend", "quote": "have you seen https://sh.readthedocs.io/en/latest/", "excerpt": "have you seen https://sh.readthedocs.io/en/latest/", "context": "", "use_case": "", "switched_from": "", "story": "Rubish: A Unix shell written in pure Ruby"}, {"id": 740160720, "item_id": 46260045, "url": "https://news.ycombinator.com/item?id=46260045", "by": "btown", "date": "2025-12-13", "version": null, "stance": "recommend", "quote": "I love how this import trick shows how hackable Python is", "excerpt": "I love how this import trick shows how hackable Python is - and it\u2019s this very hackability that has led to so many of the advances we see in AI. Arguably without operator overloads we\u2019d be 5 or more years behind. https://github.com/amoffat/sh/blob/2a90b1f87a877e5e09da32fd4346fbe3454a5235/sh.py#L3688", "context": "", "use_case": "calling shell commands from Python", "switched_from": "", "story": "Using Python for Scripting"}, {"id": 740130753, "item_id": 46258172, "url": "https://news.ycombinator.com/item?id=46258172", "by": "code_biologist", "date": "2025-12-13", "version": null, "stance": "neutral", "quote": "uv for using sh as a dependency in scripts", "excerpt": "uv for using sh as a dependency in scripts, managed inline, has changed it from \u201ceh, I\u2019ll just use subprocess\u201d to \u201cwhy not\u201d for me. https://docs.astral.sh/uv/guides/scripts/#using-different-python-versions", "context": "", "use_case": "Running shell commands from Python", "switched_from": "", "story": "Using Python for Scripting"}, {"id": 740125808, "item_id": 46257863, "url": "https://news.ycombinator.com/item?id=46257863", "by": "theomega", "date": "2025-12-13", "version": null, "stance": "recommend", "quote": "One thing I can recommend that makes scripting in python with external commands a lot easier is the `sh` module", "excerpt": "One thing I can recommend that makes scripting in python with external commands a lot easier is the `sh` module: https://pypi.org/project/sh/ Basically you can just `from sh import [command]` and then have an installed binary command available as function from sh import ifconfig print(ifconfig(\"eth0\"))", "context": "", "use_case": "running shell commands in Python", "switched_from": "", "story": "Using Python for Scripting"}]}