-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: support yml and json * refactor: EasierDocker and log * docs: update readme * fix: setup version and license * fix: add container ip address log * docs: update README.md * docs: update README.md
- Loading branch information
Showing
6 changed files
with
62 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
import json | ||
import yaml | ||
|
||
from easierdocker.log_re import log | ||
|
||
|
||
class Config: | ||
def __init__(self, file_path: str): | ||
self.file_path = file_path | ||
|
||
def load_file(self) -> dict: | ||
config = {} | ||
if self.file_path.endswith('.yaml'): | ||
config: dict = yaml.load(open(self.file_path, encoding='utf8'), yaml.FullLoader) | ||
with open(self.file_path, encoding='utf8') as file: | ||
if self.file_path.endswith(('.yaml', '.yml')): | ||
config: dict = yaml.safe_load(file) | ||
elif self.file_path.endswith('.json'): | ||
config: dict = json.load(file) | ||
else: | ||
log(f'Currently unsupported file types: {self.file_path}') | ||
return config | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class DockerConnectionError(Exception): | ||
def __init__(self, message="Unable to connect to Docker server, please make sure dockers is running."): | ||
self.message = message | ||
super().__init__(self.message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
setup( | ||
name='easier-docker', | ||
version='2.0.0', | ||
version='2.1.0', | ||
author='weiensong', | ||
author_email='[email protected]', | ||
description='It can create a container based on the local image. If the image does not exist, the image will be ' | ||
|
@@ -23,8 +23,12 @@ | |
], | ||
}, | ||
classifiers=[ | ||
'License :: OSI Approved :: MIT License', | ||
'License :: OSI Approved :: Apache Software License', | ||
'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', | ||
], | ||
keywords='easy, docker, docker sdk, python docker', | ||
project_urls={ | ||
|