10 ms·
> I actually wrote a Python solution at first, but having to install the pip dependencies on my clean varnish box seemed like a bad idea and it keep breaking i
by reacharavindh 7y ago
> I actually wrote a Python solution at first, but having to install the pip dependencies on my clean varnish box seemed like a bad idea and it keep breaking in odd ways which I didn’t feel like debugging.
Amen!
This is why I am learning Go at the moment and considering using it instead of Python for admin and data processing tasks on a fleet of servers. The single binary deployment makes it a lot easier for users to adopt. Python misses out on a lot of use because of the inability to do this. And No! I do not want to pip install a lot of stuff on the servers just to be able to run this script once. Heck, some of these servers don't even have access to public internet to be able to pip install whatever.
Yes, I have looked into pyinstaller and Nuitka. They threw up some errors that were indicative of deeper issues that I didnt feel like a good use of my time to debug. I'd rather choose a language that has this as a priority/design goal instead.
- deleted 7y ago[deleted]
- EdwardDiego 7y agoYeah, I was writing a Docker image built around Prometheus' jmx_exporter intended to be used as a mixin for our Java apps, and part of what I needed to do was provide a simple script to preprocess separate config files to produce the config used by jmx_exporter. My initial thought was Python, but it needed a couple of 3rd party dependencies, and there wasn't an overly clean _and_ simple way to copy the script in from the mixin and run locally. So I shrugged, rewrote my script in Go, and then used a multi-stage build to copy in the binary and nothing else. Ending up with a single statically linked binary was cool, even if Go does some stuff that made my eyebrows quirk a tad (I still can't believe that an idiomatic set in Go is map[T]struct{}...)
- twic 7y ago> I was writing a Docker image built around Prometheus' jmx_exporter intended to be used as a mixin for our Java apps, and part of what I needed to do was provide a simple script to preprocess separate config files to produce the config used by jmx_exporter Did you consider, and stop me if this suggestion is completely wild, Java?
- EdwardDiego 7y agoIt's a script that merges YAML objects, there's an overhead to Java for this use case. I did consider Kotlin, but that same overhead of a POM, plugins to build capsules/fat jars etc.
- reubenmorais 7y agoI don't get it... Can't you just use a virtualenv? Then there's no worry about namespace pollution or conflicts between dependencies of different projects.
- eeZah7Ux 7y agoThis is becoming a parody of software engineering. People are now irrationally scared of using dynamic libraries, OS packages and even directories, like virtualenvs. Instead, a simple solution is replaced with containers, or by rewriting tons of code in the new hyped language. Are we trying to create job security through unnecessary complexity?
- grumpydba 7y ago> Are we trying to create job security through unnecessary complexity? As a python/go dev, I can assure you that go is not much more complex. And as a server admin, it's much easier to deploy. It does have drawbacks when compared to python, but it can often be the optimal solution.
- giancarlostoro 7y agoAlso a Python dev. I do use VirtualEnv but the other thing is a huge performance boost for small performance intensive projects.
- folkrav 7y agoIsolation is merely one utility of containers.
- weberc2 7y agoThis is the weirdest straw man I've seen in a while. Python, not Go, benefits most from containerization. Installing "Dynamic libraries, OS packages, and even directories like virtualenvs" on target machines is far more complicated than sending a single file. I say all this as the DevOps guy in a Python shop.
- 7y ago
- giancarlostoro 7y agoYou didnt mention virtualenv. That is what I use. I even made a deb installer that forces itself to use virtualenv and fetches system python files for those packages available to Debian but not pip (kind of a hack but it worked! Look mah!). I agree though I like that with D and Go deployment seems simpler.
- weberc2 7y agoFully agree about Go; however, if you can't move away from Python, github.com/pantsbuild/pex is a pretty good alternative. It's an executable zip file that contains all of your python dependencies; you still need the Python interpreter and any shared objects that don't come with pip (e.g., for whatever reason, the Python graphviz package depends on the graphviz-devel system package and the latter doesn't ship via Pypi). It's still an order of magnitude worse than Go, but it's an order of magnitude better than pip or pipenv. :)
- catacombs 7y ago> The single binary deployment makes it a lot easier for users to adopt. I've had some success making a Python file an executable. Though, I do understand your gripe with needing to install dependencies.
- Too 7y agozipapp, which comes bundled with python since 3.5, is your friend. It can produce a single .pyz file which has all dependencies except the interpreter itself inside. Actually this format is compatible all the way back to Python 2.6, it's only the zipapp convenience scripts that are new. https://docs.python.org/3/library/zipapp.html#creating-standalone-applications-with-zipapp https://docs.python.org/3/library/zipapp.html#creating-stand...