Hacker Newsnew | past | comments | ask | show | jobs | submit | more BiteCode_dev's commentslogin

While it would be nice to have the core and the framework dissociated, stating that it provide no advantage over Ansible seems overly broad.

You can use python logic to compose your deployment scenario, use imports to reuse features, package modules the same way, etc. The whole ecosystem is also at your disposal, be it libraries, IDE support, linters, formatters, debuggers and so on.

It doesn't need to reinvent the wheel, and you don't need to learn a new syntax.

I would call that a win.

Now, is pyinfra well designed enough to be practical in production, that's another matter that needs testing.


Thanks for sharing Shlax, I didn't know about it, and at first glance, I like the design choices: encapsulate task, pass the target object so you can mock it for testing, use await to delegate I/O...


Shlax still has to prove it can do what it aims with the simple design it strives to keep.


It seems more complementary than a competition, as Pulumi targets clouds, while pyinfra has a lot of tools for self hosting.


I'm looking for an alternative to ansible and fabric 2, some kind of middleground, and pyinfra looks like something I want to give a try to.

Is there any way to attach the deployement scenario in a Python object ?

All the examples I see are global functions called at a root of a module.

How do I make a scenario pluggable? Reusable? Introspectable?


> Is there any way to attach the deployement scenario in a Python object ?

It is possible to use pyinfra as a Python API, but this is not currently officially supported/may not follow semver, example: https://github.com/Fizzadar/pyinfra/blob/master/examples/api....

> How do I make a scenario pluggable? Reusable? Introspectable?

pyinfra comes with builtin support for packaging "deploys" as Python packages, see: https://pyinfra.readthedocs.io/en/v0.14.5/api/deploys.html, an example: https://github.com/Fizzadar/pyinfra-docker.


Thanks. I like the fact you can do a quick and dirty script, but the wrap it up in tasks if you want.


Fair question.

Ansible is a great system, with a terrible DSL.

YAML is not a programming language, and deployment is not a toy task. You need power.

The result is that ansible has pushed a markup language to its limit, then pushed the templating engine used in it to its limit too. Then used a bunch of duck tape + conventions to glue everything and ended up with 10% of an unclean verbose unexpressive real programming language with ridiculous limited tooling, testability and had to document + support it.

As with most DSL.

For what? For the quest of having something "declarative", and that any language could read.

Well you can have declarative API written in any language, and nobody except ansible ever read playbooks.

In the end, it's just a big weight at the ankle. I never ever used it and though, "damn, what a pleasant tech choice, I'm happy they didn't directly expose the API through Python".

It's the same reason I use "nox" and not "tox", or "doit" and not "make". DSL really seem like a great idea, but they fail most of the time. There is a reason only few of them - like SQL, CSS or regex patterns - became a success. 99% of the time, what you need is a good lib, with a well designed API. For the 0.9% of the time you do need multi-language communication, you may implement RPC. Then, only for the 0.01% case should you really consider a DSL.

But we geek love to create DSL. They are fun to write! They are so elegant in tutorials!

Is Pyinfra doing better? I don't know, but I'm sure to give it a try. I really, really want to leave ansible behind, but fabric 2 is not high level or declarative enough.


Well said! This is largely the motivation for frameworks that give you only what you need to write your own automation:

https://github.com/eradman/rset

https://github.com/rollcat/judo


> Each request is pretty much independent of the others, and each one can independently crash.

Not the case anymore with phpfpm.


php-fpm uses a worker pool. How is this true unless you corrupt the shared memory segment?


I haven't checked it, but I think the worker stays up, and deal with several requests during its life time, not just one then die. Hence, there is pesistence.


As long as there is nothing broken in internals (a very big if, to be fair), user code crashing will not affect subsequent requests.


Because technologies don't win by being the best, or even by being good.

They just need to provide a killer feature and an easy path to adoption.

After that, inertia does the rest.


> "man, why I have to type this silly whitespace?"

I assume it's a joke, but I often have people in my classroom that have been doing python for some times and that keep typing the whitespaces themselves instead of using an editor that does it for them.

But again, I've seen some coding without any syntax highlighting.

Now I never assume people know even the most obvious things.


The problem with make, is that it's yet another DSL to learn.

Every single tool in your toolbox could introduce a new one, and it leads to fatigue.

Task runner? New DSL (make)

Test runner? New DSL (robot)

Deployement? New DSL (Ansible)

Batch spawning? New DSL (tox)

Etc

Of course, dev in half of those DSL is a total pain, because, like with most DSL, the tooling sucks: terrible completion, linting, debugging or composing experience.

So people write/leverage tools they can use with their favorite language. And why not? You have to install it anyway (make isn't default on windows, it's not even installed on vanilla Ubuntu!).

When I need a make-like tool, I use doit (https://pydoit.org/).

Why?

It's in Python, the language of my projects. So I can use the same tooling, the same libs, the same install and testing procedures. And so can people contributing: no need to train them. Most devs don't know how to use make (most of them are on Windows after all).

Using make adds zero benefit for me: doit just does what make does (ok, that sentence is hard to parse :)). But make adds an extra step of asking to install it while I can just slip doit among my other python project dependancies. I have to google the syntax. I can't use tab to complete names, of right click to get documentation. And if (actually when) I need to debug my make file, God have mercy.

It's not against make. It just doesn't provide enough value to justify the cost of it.


> You have to install it anyway (make isn't default on windows, it's not even installed on vanilla Ubuntu!).

What are the odds that you're compiling software on Ubuntu and haven't installed base-devel? I mean, it could happen, but it feels contrived.


You assume make is only for compiling, but it's not.

It's just a task runner.


Make is an extremely simple syntax for declaring file dependencies and then shell agnostic for all of the build rule scripting.

If you want to use python, put this in your makefile:

  SHELL=python
  .ONESHELL:


I've never seen a simple make file that was not a toy exemple.

Besides, the opposite is preferable: define the running conditions in $FAMILIAR_LANGUAGE, but then run system shell commands.


I agree with this, personally I use gradle with kotlin script which is just the normal programming language but behaving as a REPL


Except if cloudflare is part of a PRISM like program, associated with a gag order. In which case they have pwn half the planet security.


Are you aware "PRISM-like programs" apply to every single US based webserving entity? Why are you calling Cloudflare out when there's thousands of companies who are subject to the very same risk? Is it possible that PRISM programs bear no relevance at all to this conversation?


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: