Skip to content

Commit

Permalink
Update docker-py 1.8 to docker 2.2 (#602)
Browse files Browse the repository at this point in the history
* MAINT: update docker-py 1.8 to docker 2.2

* MAINT: update dependencies that were pinned due to docker version

* MAINT: fix oauthenticator version to 0.11.0 (for now)

* FIX: pass reference to low level APIClient in remoteappdb CLI (for now)

* DOC: remove comment on request version
  • Loading branch information
flongford committed May 29, 2022
1 parent c0acbfb commit 9081860
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 15 deletions.
4 changes: 2 additions & 2 deletions remoteappmanager/cli/remoteappdb/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def print_error(error):


def get_docker_client():
""" Returns docker.client object using the local environment variables
""" Returns docker.APIClient object using the local environment variables
"""
# dependencies of docker-py is optional for this script
try:
Expand All @@ -93,7 +93,7 @@ def get_docker_client():
print_error('docker client fails to connect.')
raise exception

return client
return client.api


def is_sqlitedb_url(db_url):
Expand Down
2 changes: 1 addition & 1 deletion remoteappmanager/docker/async_docker_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self, *args, **kwargs):
Note that the executor is a ThreadPoolExecutor with a single thread.
"""
self._sync_client = docker.Client(*args, **kwargs)
self._sync_client = docker.APIClient(*args, **kwargs)

def __getattr__(self, attr):
"""Returns the docker client method, wrapped in an async execution
Expand Down
6 changes: 3 additions & 3 deletions remoteappmanager/docker/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ def __repr__(self):
@classmethod
def from_docker_dict(cls, docker_dict):
"""Returns a Container object with the info given by a
docker Client.
docker APIClient.
Parameters
----------
docker_dict : dict
One item from the result of docker.Client.containers
One item from the result of docker.APIClient.containers
Returns
-------
Expand All @@ -89,7 +89,7 @@ def from_docker_dict(cls, docker_dict):
Examples
--------
>>> # containers is a list of dict
>>> containers = docker.Client().containers()
>>> containers = docker.APIClient().containers()
>>> Container.from_docker_dict(containers[0])
Expand Down
2 changes: 1 addition & 1 deletion remoteappmanager/tests/test_file_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,5 +186,5 @@ def test_if_docker_config_result_is_acceptable_for_dockerpy(self):
config = FileConfig()
docker_config = config.docker_config()

with contextlib.closing(docker.Client(**docker_config)) as client:
with contextlib.closing(docker.APIClient(**docker_config)) as client:
self.assertIsNotNone(client.info())
10 changes: 4 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
setuptools==21.0
traitlets>=4.1
tornado==5.1.1
# Fix to 2.10.0 due to docker-py needs (fails with 2.11.1)
requests==2.10.0
# We want 1.8 because 1.10 uses API version 1.24 and the docker server
# on ubuntu uses 1.23, so they don't like each other.
docker-py==1.8
# Fix to 2.11.1 due to docker-py needs
requests==2.11.1
docker==2.2
escapism==0.0.1
jupyterhub==0.8.1
jupyter_client>=4.3.0
click==6.6
tabulate==0.7.5
tornadowebapi @ git+http://github.com/simphony/tornado-webapi.git@8b6846faae23657a04cf97ca5229ce8ea083d000#egg=tornadowebapi
oauthenticator>=0.10.0
oauthenticator==0.11.0
jinja2>=2.8
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def write_version_py():
# Unfortunately RTD cannot install jupyterhub because jupyterhub needs bower,
# and that is not available. We prevent the request for the unreleased jhub
# by skipping it if we are on RTD
# We also have problems with requests as docker-py wants <2.11 and RTD
# provides 2.11.1

on_rtd = os.environ.get('READTHEDOCS') == 'True'
if on_rtd:
Expand Down

0 comments on commit 9081860

Please sign in to comment.