Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for docker-compose V2 #71

Closed
n1ngu opened this issue Jan 21, 2022 · 4 comments
Closed

Support for docker-compose V2 #71

n1ngu opened this issue Jan 21, 2022 · 4 comments

Comments

@n1ngu
Copy link
Contributor

n1ngu commented Jan 21, 2022

I guess the maintainers are already aware of all the context but I'll try to summarize it and still not bore anyone.

docker-compose V2 has been rewritten not in Python language and isn't distributed anymore as a python package.

In the V1 deprecation notice there is a commitment to fix security issues but no bugs or new features will ever be released https://github.com/docker/compose/tree/master#v1-vs-v2-transition-hourglass_flowing_sand

The V1 branch is effectively stale since V2 was first released 4 months ago.

The first signs of erosion are already showing up #70

Hopefully, the command line interface is still the only supported interface to docker-compose, and there is an explicit commitment to keep it stable and compatible, and by virtue of #19 we should have little to no trouble with the switch.

Effectively, after dropping the requirement on the docker-compose V1 python package, my first attempt to run pytest-docker test suite with my system's docker-compose 2.2.2 is a total success.

The main issue so far would be that: in common setups using a virtualenv the current hard dependency on docker-compose V1 will usually shadow any other version provided by the user. Or at least cause a confusion about what is actually being used (see #69 ?)

Therefore, aside from any future issue that could show up, the main challenges can be reduced to:

  • A breaking change in pytest-docker installation instructions
  • Convoluting the tox.ini matrix so that tests can be run for both docker-compose V1 and V2
  • Making docker-compose V2 available in the CI workflows.
@n1ngu
Copy link
Contributor Author

n1ngu commented Jan 21, 2022

For the installation process, an extra dependency could be contributed so that docker-compose V1 was optionally required. Only requiring

pip install pytest-docker[composeV1]

or whatnot would actually pull the python package for docker-compose.

Obviously this should go along with some new documentation and a proper version bump.

@n1ngu
Copy link
Contributor Author

n1ngu commented Jan 21, 2022

For the tox test matrix, I think it'd be as easy as something like

[tox]
envlist = {py37,py38,py39,py310}-{V1,V2}

[testenv]
deps =
    {py37,py38,py39,py310}-V1: docker-compose
commands =
    pytest -c setup.cfg

I think I am missing to pull the extra pytest-docker[tests] requirements somehow, but it should neither be hard to figure out.

@otetard
Copy link
Contributor

otetard commented Jan 29, 2022

A first attempt to provide Docker Compose v2 support is available in this PR: #72.

@n1ngu
Copy link
Contributor Author

n1ngu commented Jul 28, 2022

Fixed by #72 , thanks @otetard !

@n1ngu n1ngu closed this as completed Jul 28, 2022
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

No branches or pull requests

2 participants