Giter Club home page Giter Club logo

Comments (2)

gabrieldemarmiesse avatar gabrieldemarmiesse commented on August 23, 2024

Hi @derfl0 sorry for the delay, I've been busy with other things.

Currently python-on-whales doesn't support this. I would be happy to support it in the future. Though reading from stdin in python doesn't make much sense (it makes sense in a CLI).

What I would propose is that we find a good name for a new argument to this function: https://gabrieldemarmiesse.github.io/python-on-whales/sub-commands/stack/#python_on_whales.components.stack.cli_wrapper.StackCLI.deploy and this argument would take a string as input. Inside the string would be the yaml of your stack. Would that work for you?

from python-on-whales.

derfl0 avatar derfl0 commented on August 23, 2024

Hey @gabrieldemarmiesse , no need to apologise as you work free of charge ;)

the proposed solution is exactly what I would need.

Talking about Stdin: Having a communication interface with the subprocess below would be awesome. Currently, in my native approach, I use the communicate method ( https://docs.python.org/3/library/subprocess.html#subprocess.Popen.communicate )
Background: I use a mysql server and create databases on demand via a separate mysql client container. This involves a lot of very ugly escaping if it must be a one-line start parameter. It is way easier, if you just start the container and then use "communicate" to execute your commands one by one. Of course this does only work for local containers as swarm does not support exec on service/task. I can also open a different issue for this, if it is feature material.

# pseudo example
with docker.run("mysql", detach=True) as mysql_container:
    print(mysql_container.communicate("show databases;"))

from python-on-whales.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.