Okay, I've absolutely had enough of the ridiculous JS ecosystem, except for where I absolutely need it in the browser for something that can't otherwise be done.
I want to learn how to do all the same stuff with Python because it looks like a better ecosystem. I'm a complete noob so I'm going to just accept looking silly and ask noob questions.
Could I make a little executable with python that would simply spin up a localhost and open a bundled static site in the default browser?
@freedcreative i don't have experience with it, but yes I'm pretty sure there's python libraries for this just like there's PHP.
For context, I'm working on a browser game but with all vanilla code. I want people to be able to download & run a copy like they're used to. But I don't see why a downloadable web game, or any app, needs to bundle a browser when everybody already has one.
So the idea is you run the game and it just opens in your preferred browser.
@freedcreative @68km @ItsTheManOnTheMoon @alcinnz @morgan They are lots of options that don't require shipping electron. Every language sucks until you grok it then it makes perfect sense, but you *will* regret your choice no matter what you pick. 😁
But every language had the ability to say "open default browser here" and client/server is still a thing.
So I say, find your language of choice and go on an adventure.
@freedcreative @alcinnz yep, python3 -m SimpleHTTPServer will serve the directory you run it from on port 8000 https://www.hackerearth.com/practice/notes/simple-http-server-in-python/
Though, DeVault's recent rant about Python seem apropos at the moment. https://drewdevault.com/2021/11/16/Python-stop-screwing-distros-over.html
(Technically, his NPM rant also https://drewdevault.com/2021/11/16/Cash-for-leftpad.html )
@freedcreative For something bare bones there's the SimpleHTTPServer module builtin (which as @ItsTheManOnTheMoon mentioned can also be invoked on the commandline to serve as a static file server, exactly what you requested), though there's several modules installable from Pypi which are more convenient for building serverside-dynamic sites.
Popular ones include Flask, CherryPy, and the full-featured Django.
@freedcreative indeed you can! Take a look at flask ( https://flask.palletsprojects.com/en/2.0.x/ ), which is a cute but very powerful "microframework" which can serve static websites and also templates written with jinja so you can serve dynamic content as well. packaging all that is easy in python, but if you really want an executable, you can compile python code with cython and there are tools to make executables from that (py2exe for windows but I never used that)
@freedcreative you're about to find out that:
a) pip is worst than yarn
b) the python ecosystem and community is heavily skewed for AI training
c) python3 is fighting against python2 for its dear life
d) it's very VERY slow
I had to learn it, and I'm glad I did, and you should too.
@freedcreative there's a million languages out there, it doesn't end at python. Keep pulling that thread :)
@neauoire :) Thanks
Talon Voice configs are done in python, so maybe getting more comfy with the language will let me use that to access more languages and build tools, even if I never get my hands back properly.
Being stuck on tablets is a frickin nightmare.
@freedcreative python is a very common language for IoT things, so there might be something there :)
@deianeira I just don't have the bandwidth to write everything from scratch myself. I'd like to move in that direction as much as possible, but for the foreseeable future I'm gonna need some existing tools to lean on.
@exquisitecorp Not at all, I appreciate any help I can get!
I have been wondering about Lua. Atm I have to use an Android tablet for coding, for accessibility purposes, so I've been looking for things I have availability via Termux. It doesn't really deal with anything graphical, which is why I've been looking at the browser to handle said graphics.
But I wonder if there's a way I could access Lua anyhow.
@neauoire I spotted that when I was looking into trying to use pygame! I know almost nothing about it, except that it's a major component of uxn.
I would definitely like to learn more. I did start reading, but I think it's going to take a while though as it's all very new. I got as far as installing it and exploring frameworks and engines that use it.
My coding experience is basically all in the context of web and game engines so I have a lot in front of me.
@exquisitecorp Holy shit LÖVE has an Android APK they say you can use for dev! This might be exactly what I need!
@asquare I'll probably be using localstorage for saving game progress, so I need http for that to be reliable afaik.
sunainapai/makesite, makesite.py Take full control of your static website/blog generation by writing your own simple, lightweight, and magic-free static site generator in
@freedcreative looks like you have lots of suggestions but I'll add a simple option in case it's useful.
In my .bashrc / .zshrc I have this alias
`alias serve="ip address && python -m http.server 1312" `
I just type serve in the dir I need and then I can test stuff on different devices quickly. I also use it to lazily transfer files to my phone or my partner wants to watch a film I torrented on my laptop on theirs.
Revel in the marvels of the universe. We are a collective of forward-thinking individuals who strive to better ourselves and our surroundings through constant creation. We express ourselves through music, art, games, and writing. We also put great value in play. A warm welcome to any like-minded people who feel these ideals resonate with them.