Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@ jobs:
tests:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-latest]
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
exclude:
# Python 3.6 is not available in GitHub Actions Ubuntu 22.04
- os: ubuntu-latest
python-version: '3.6'
os: [ubuntu-22.04, ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

### Unreleased

# v14.0.0
- Support Docker compose v2
- Drop Python 3.7 support

# v13.14.2
- Collect additional parameters provided to kubetools cronjob spec and attach to k8s cronjob spec

Expand Down
4 changes: 2 additions & 2 deletions kubetools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from pkg_resources import get_distribution
from importlib import metadata

__version__ = get_distribution('kubetools').version
__version__ = metadata.version("kubetools")
2 changes: 1 addition & 1 deletion kubetools/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import yaml

from pkg_resources import parse_version
from packaging.version import parse as parse_version
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Where is packaging coming from? It's not in setup.py so I guess it's a dep of one of our other deps which over time might not be a safe assumption.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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


from . import __version__
from .exceptions import KubeConfigError
Expand Down
5 changes: 2 additions & 3 deletions kubetools/dev/backends/docker_compose/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,8 @@ def create_compose_config(kubetools_config):
if dev_network:
compose_config['networks'] = {
'default': {
'external': {
'name': 'dev',
},
'name': 'dev',
'external': True,
},
}

Expand Down
9 changes: 3 additions & 6 deletions kubetools/dev/backends/docker_compose/docker_util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import sys

from functools import lru_cache

import docker
Expand Down Expand Up @@ -138,8 +136,8 @@ def get_containers_status(
if not env:
env = compose_project.replace(docker_name, '')

# Where the name is compose-name_container_N, get container
name = container.name.split('_')[1]
# Get the service name from the Docker Compose label (works with both v1 and v2)
name = container.labels['com.docker.compose.service']

status = container.status == 'running'
ports = []
Expand Down Expand Up @@ -204,8 +202,7 @@ def run_compose_process(kubetools_config, command_args, **kwargs):
create_compose_config(kubetools_config)

compose_command = [
# Use current interpreter to run the docker-compose module installed in the same venv
sys.executable, '-m', 'compose',
'docker', 'compose',
# Force us to look at the current directory, not relative to the compose
# filename (ie .kubetools/compose-name.yml).
'--project-directory', '.',
Expand Down
3 changes: 0 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,9 @@ def get_readme_content():
'pyyaml>=3,<6',
'requests>=2,<2.29.0', # https://github.com/docker/docker-py/issues/3113
'pyretry',
'setuptools',
# To support CronJob api versions 'batch/v1beta1' & 'batch/v1'
'kubernetes>=21.7.0,<25.0.0',
'tabulate<1',
# compose v2 has broken container naming
'docker-compose<2',
),
extras_require={
'dev': (
Expand Down