Post AXAVJPQ7ok5wMtsL6u by kfdm@social.tsun.co
(DIR) More posts by kfdm@social.tsun.co
(DIR) Post #AXAOqnR2quWej5HMAK by simon@fedi.simonwillison.net
2023-06-29T00:25:43Z
2 likes, 2 repeats
TIL there are dozens of neat little command-line tools hidden away in the Python standard library, available to run on any machine that has a Python installation https://til.simonwillison.net/python/stdlib-cli-tools
(DIR) Post #AXAP2Q6PQfQNpsAYbI by simon@fedi.simonwillison.net
2023-06-29T00:27:02Z
0 likes, 0 repeats
"python -m tokenize file.py" and "python -m ast file.py" are particularly fun
(DIR) Post #AXAQHyMcQbDiOSjONs by jbaggs@infosec.exchange
2023-06-29T00:41:56Z
0 likes, 0 repeats
@simon Ha. At least two of those could replace things I quickly scripted and threw in ~/bin
(DIR) Post #AXATOP7a9nNqyqSLsu by brianb@fosstodon.org
2023-06-29T01:16:50Z
0 likes, 0 repeats
@simon http.server is my go-to when I'm toying with an idea that doesn't deserve a full workspace yet. Love that module.I didn't know about calendar. Since it can spit out nicely formatted HTML, this is probably going to be my new method of printing full-year calendars for school. Thanks for that tip π
(DIR) Post #AXAVJPQ7ok5wMtsL6u by kfdm@social.tsun.co
2023-06-29T01:38:10Z
0 likes, 0 repeats
@simon I use `python -m json.tool` a LOT π
(DIR) Post #AXAa0dA901s3G3GX0C by Octarine@wig.gl
2023-06-29T02:30:49Z
0 likes, 0 repeats
@simon zipapp too! Module execution, entry points discoverability from importlib.metadata and zipapp seem to me to be like an underutilised ecosystem of python as a portable platform.
(DIR) Post #AXAiUfdv8qMDGs1pNA by marcin_sawicki@social.abstractionleak.com
2023-06-29T04:05:43Z
0 likes, 0 repeats
@simon Kinda knew about HTTP and few more, but calendar made me wow
(DIR) Post #AXAkviIRaEhHED0PaK by slothrop@chaos.social
2023-06-29T04:33:17Z
0 likes, 0 repeats
@simon Me reading this:Ah, nerd bait, nobody needs thβ¦ Wait, instant local http server???!π
(DIR) Post #AXAlkPaWtrgBySdjdI by jnovinger@mastodon.social
2023-06-29T04:42:25Z
0 likes, 0 repeats
@simon I saw tabnanny and, as a browser tab addict, I had to know more.Turns out it's a tabs vs spaces indent specific linter. Still cool though!https://docs.python.org/3.11/library/tabnanny.html
(DIR) Post #AXAoYoOL9hpBHv6BM0 by asmodai@mastodon.social
2023-06-29T05:13:58Z
0 likes, 0 repeats
@simon With regard to ripgrep, I think you could've done:rg -l -g '!test*' -g '!idlelib' -g '!turtledemo' 'if __name__ ='
(DIR) Post #AXBNVSrQFOoM2PqCdk by feudjais@syndicat.solidaires.org
2023-06-29T11:45:11Z
0 likes, 0 repeats
@simon This is really incredible ! Thanks for that ! I knew about http.server but never thought of digging deeper to see what we could do with the same idea.
(DIR) Post #AXBrQUa3QH2IY6GKEi by m8ta@fediscience.org
2023-06-29T17:20:36Z
0 likes, 0 repeats
@simon Did not know about the tokenize and ast modules -- very useful!
(DIR) Post #AXC8q0uS3lzFHAYgF6 by scruss@xoxo.zone
2023-06-29T20:35:53Z
0 likes, 0 repeats
@simon this fails the standard library test, but pyserial's python3 -m serial.tools.minitermgets you a tiny but good-enough serial debug terminal for those awkward hardware moments
(DIR) Post #AXCAUM7GjVKMaKM0cy by volcan01010@fosstodon.org
2023-06-29T20:53:44Z
0 likes, 0 repeats
@simon Nice list. http.server is handy to get files off Windows machines.I like `python -m pdb -c continue my-script.py` to let me drop into a debugger if my script crashes.`pip` wasn't on the list, but `subprocess.run([sys.executable, '-m', 'pip', 'install', 'geopandas'])` is how I install extra dependencies into the bundled Python environment of the QGIS mapping software.
(DIR) Post #AXCNKckvJMeIhSalQu by jkerhin@fosstodon.org
2023-06-29T23:18:11Z
0 likes, 0 repeats
@simon json.tool will also exit with nonzero status if your json document is invalid.We use it a lot as a quick easy to validate config files
(DIR) Post #AXCP9kO4nTyB5jqYbo by Eris@toot.cat
2023-06-29T23:38:36Z
0 likes, 0 repeats
@simon http.server is the unsung hero. Iβve used the shit out of that.
(DIR) Post #AXCPqlENXJtg9yoyGW by austegard@mastodon.social
2023-06-29T23:46:15Z
0 likes, 0 repeats
@simon https://mastodon.social/@austegard/110630112954237434