Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into ruff-i
Browse files Browse the repository at this point in the history
  • Loading branch information
milas committed Mar 29, 2024
2 parents 1818712 + 0fd79c8 commit 310d70e
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 101 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ jobs:
- name: Run ruff
run: ruff docker tests

build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- run: pip3 install build && python -m build .
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist

unit-tests:
runs-on: ubuntu-latest
strategy:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ jobs:
with:
python-version: '3.x'

- name: Generate Pacakge
- name: Generate Package
run: |
pip3 install setuptools wheel
python setup.py sdist bdist_wheel
pip3 install build
python -m build .
env:
# This is also supported by Hatch; see
# https://github.com/ofek/hatch-vcs#version-source-environment-variables
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_DOCKER: ${{ inputs.tag }}

- name: Publish to PyPI
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TEST_API_VERSION ?= 1.43
TEST_ENGINE_VERSION ?= 24.0
TEST_API_VERSION ?= 1.44
TEST_ENGINE_VERSION ?= 25.0

ifeq ($(OS),Windows_NT)
PLATFORM := Windows
Expand Down
4 changes: 2 additions & 2 deletions docker/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from .version import __version__

DEFAULT_DOCKER_API_VERSION = '1.43'
MINIMUM_DOCKER_API_VERSION = '1.21'
DEFAULT_DOCKER_API_VERSION = '1.44'
MINIMUM_DOCKER_API_VERSION = '1.24'
DEFAULT_TIMEOUT_SECONDS = 60
STREAM_HEADER_SIZE_BYTES = 8
CONTAINER_LIMITS_KEYS = [
Expand Down
64 changes: 61 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,66 @@
[build-system]
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[tool.setuptools_scm]
write_to = 'docker/_version.py'
[project]
name = "docker"
dynamic = ["version"]
description = "A Python library for the Docker Engine API."
readme = "README.md"
license = "Apache-2.0"
requires-python = ">=3.8"
maintainers = [
{ name = "Docker Inc.", email = "[email protected]" },
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Other Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Software Development",
"Topic :: Utilities",
]

dependencies = [
"requests >= 2.26.0",
"urllib3 >= 1.26.0",
"pywin32>=304; sys_platform == \"win32\"",
]

[project.optional-dependencies]
ssh = [
"paramiko>=2.4.3",
]
tls = [] # kept for backwards compatibility
websockets = [
"websocket-client >= 1.3.0",
]

[project.urls]
Changelog = "https://docker-py.readthedocs.io/en/stable/change-log.html"
Documentation = "https://docker-py.readthedocs.io"
Homepage = "https://github.com/docker/docker-py"
Source = "https://github.com/docker/docker-py"
Tracker = "https://github.com/docker/docker-py/issues"

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "docker/_version.py"

[tool.hatch.build.targets.sdist]
include = [
"/docker",
]

[tool.ruff]
target-version = "py38"
Expand Down
3 changes: 0 additions & 3 deletions setup.cfg

This file was deleted.

81 changes: 0 additions & 81 deletions setup.py

This file was deleted.

4 changes: 2 additions & 2 deletions tests/Dockerfile-ssh-dind
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1

ARG API_VERSION=1.43
ARG ENGINE_VERSION=24.0
ARG API_VERSION=1.44
ARG ENGINE_VERSION=25.0

FROM docker:${ENGINE_VERSION}-dind

Expand Down
14 changes: 9 additions & 5 deletions tests/integration/models_containers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ def test_run_with_networking_config(self):
client.networks.create(net_name)
self.tmp_networks.append(net_name)

test_aliases = ['hello']
test_alias = 'hello'
test_driver_opt = {'key1': 'a'}

networking_config = {
net_name: client.api.create_endpoint_config(
aliases=test_aliases,
aliases=[test_alias],
driver_opt=test_driver_opt
)
}
Expand All @@ -131,8 +131,10 @@ def test_run_with_networking_config(self):
assert 'NetworkSettings' in attrs
assert 'Networks' in attrs['NetworkSettings']
assert list(attrs['NetworkSettings']['Networks'].keys()) == [net_name]
assert attrs['NetworkSettings']['Networks'][net_name]['Aliases'] == \
test_aliases
# Expect Aliases to list 'test_alias' and the container's short-id.
# In API version 1.45, the short-id will be removed.
assert attrs['NetworkSettings']['Networks'][net_name]['Aliases'] \
== [test_alias, attrs['Id'][:12]]
assert attrs['NetworkSettings']['Networks'][net_name]['DriverOpts'] \
== test_driver_opt

Expand Down Expand Up @@ -189,7 +191,9 @@ def test_run_with_networking_config_only_undeclared_network(self):
assert 'NetworkSettings' in attrs
assert 'Networks' in attrs['NetworkSettings']
assert list(attrs['NetworkSettings']['Networks'].keys()) == [net_name]
assert attrs['NetworkSettings']['Networks'][net_name]['Aliases'] is None
# Aliases should include the container's short-id (but it will be removed
# in API v1.45).
assert attrs['NetworkSettings']['Networks'][net_name]['Aliases'] == [attrs["Id"][:12]]
assert (attrs['NetworkSettings']['Networks'][net_name]['DriverOpts']
is None)

Expand Down

0 comments on commit 310d70e

Please sign in to comment.