Skip to content

feat(compose): Add support for docker compose up SERVICE --no-deps#708

Merged
gabrieldemarmiesse merged 1 commit intogabrieldemarmiesse:masterfrom
romeroyonatan:romeroyonatan/add-up-dependencies
Mar 3, 2026
Merged

feat(compose): Add support for docker compose up SERVICE --no-deps#708
gabrieldemarmiesse merged 1 commit intogabrieldemarmiesse:masterfrom
romeroyonatan:romeroyonatan/add-up-dependencies

Conversation

@romeroyonatan
Copy link
Contributor

@romeroyonatan romeroyonatan commented Feb 27, 2026

Description

This PR adds support for the --no-deps flag in the docker compose up command.

--no-deps
	Don't start linked services

In the Python API, this is exposed via a new dependencies boolean parameter (defaulting to True) in the docker.compose.up() method. When set to False, the underlying CLI call includes the --no-deps flag, preventing Docker Compose from starting linked services.

This maintains compatibility with the docker.compose.run method.

Type of change

  • New feature (non-breaking change which adds functionality)

Key Changes

python_on_whales/components/compose/cli_wrapper.py

  • Updated the up method signature and its overloads to include dependencies: bool = True.
  • Added documentation for the new parameter.
  • Added logic to append the --no-deps flag to the command when dependencies is set to False.

tests/python_on_whales/components/test_compose.py

  • Added a new test case test_docker_compose_up_dependencies that verifies:
    • When dependencies=True, both the target service and its dependencies are started.
    • When dependencies=False, only the target service is started.

How to use

from python_on_whales import DockerClient

# Start a service without starting its dependencies
docker = DockerClient()
docker.compose.up(["my-service"], dependencies=False)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

This PR adds support for the `--no-deps` flag in the `docker compose up` command.

```
--no-deps
	Don't start linked services
```

In the Python API, this is exposed via a new `dependencies` boolean parameter (defaulting to `True`) in the `docker.compose.up()` method. When set to `False`, the underlying CLI call includes the `--no-deps` flag, preventing Docker Compose from starting linked services.

This maintains compatibility with the `docker.compose.run` method.
Copy link
Owner

@gabrieldemarmiesse gabrieldemarmiesse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR, many thanks!

@gabrieldemarmiesse gabrieldemarmiesse merged commit f0b529e into gabrieldemarmiesse:master Mar 3, 2026
21 checks passed
@romeroyonatan
Copy link
Contributor Author

@gabrieldemarmiesse Thanks for maintaining this! Just checking in to see if a new release might be on the horizon. No rush, just curious so I can plan my next update. Cheers!

@gabrieldemarmiesse
Copy link
Owner

Sure thing, I'll do one now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants