mdk
Advanced tools
+21
| MIT License | ||
| Copyright (c) [year] [fullname] | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
| [console_scripts] | ||
| mdk = mdk.main:mdk | ||
+31
-31
| Metadata-Version: 2.1 | ||
| Name: mdk | ||
| Version: 5.7 | ||
| Version: 5.7.1 | ||
| Summary: a docker-compose helper | ||
@@ -9,32 +9,2 @@ Home-page: https://matician.com/ | ||
| License: MIT | ||
| Description: # mdk | ||
| `mdk` is a cli helper for docker built at [Matician](https://matician.com/). | ||
| ## Prerequisites | ||
| * Python (3) | ||
| * pip (3) | ||
| * Docker(ce) | ||
| ### About Docker versions | ||
| Though `mdk` itself does not require a specific Docker version, it is often used in conjection with Docker features from the 1.40 Docker API. This is only supported by Docker releases >= 19. | ||
| ## Installation | ||
| ```sh | ||
| $ pip3 install --user mdk | ||
| ``` | ||
| Note: you must have the `mdk` executable in your `$PATH`. If you used the installation instructions above, the executable is in `~/.local/bin`. | ||
| ## Usage | ||
| Run the `mdk` command after installation for a full list of commands. For help on individual commands, use `mdk COMMAND --help`. | ||
| ## FAQ | ||
| ### How do I add custom configuration to containers created by `mdk`? | ||
| `mdk` automatically loads additional options from two files: | ||
| * `ext.mdk.json` located in the same directory as `mdk.json` | ||
| * `~/.config/mdk/mdk.json` | ||
| Platform: UNKNOWN | ||
| Classifier: Environment :: Console | ||
@@ -47,1 +17,31 @@ Classifier: Intended Audience :: Developers | ||
| Description-Content-Type: text/markdown | ||
| License-File: LICENSE | ||
| # mdk | ||
| `mdk` is a cli helper for docker built at [Matician](https://matician.com/). | ||
| ## Prerequisites | ||
| * Python (3) | ||
| * pip (3) | ||
| * Docker(ce) | ||
| ### About Docker versions | ||
| Though `mdk` itself does not require a specific Docker version, it is often used in conjection with Docker features from the 1.40 Docker API. This is only supported by Docker releases >= 19. | ||
| ## Installation | ||
| ```sh | ||
| $ pip3 install --user mdk | ||
| ``` | ||
| Note: you must have the `mdk` executable in your `$PATH`. If you used the installation instructions above, the executable is in `~/.local/bin`. | ||
| ## Usage | ||
| Run the `mdk` command after installation for a full list of commands. For help on individual commands, use `mdk COMMAND --help`. | ||
| ## FAQ | ||
| ### How do I add custom configuration to containers created by `mdk`? | ||
| `mdk` automatically loads additional options from two files: | ||
| * `ext.mdk.json` located in the same directory as `mdk.json` | ||
| * `~/.config/mdk/mdk.json` |
@@ -0,1 +1,2 @@ | ||
| LICENSE | ||
| README.md | ||
@@ -2,0 +3,0 @@ setup.cfg |
+41
-3
@@ -137,3 +137,3 @@ """mdk utility functions & classes""" | ||
| def opts_hash(self) -> str: | ||
| data_to_hash = '\0'.join(self.build_docker_opts(include_nfs=False)).encode() | ||
| data_to_hash = '\0'.join(self.build_docker_opts(log_info=False, include_nfs=False)).encode() | ||
| return hashlib.sha1(data_to_hash).hexdigest() | ||
@@ -144,3 +144,10 @@ | ||
| def build_docker_opts(self, include_nfs=True) -> List[str]: | ||
| def build_docker_opts(self, log_info=True, include_nfs=True) -> List[str]: | ||
| """ | ||
| Constructs a list of docker options to run the container with. | ||
| Args: | ||
| log_info: If True, add logging. Mainly set to False for non-user facing functions. | ||
| include_nfs: If True, include NFS in the options. | ||
| """ | ||
| opt_builder: List[str] = [] | ||
@@ -198,2 +205,24 @@ | ||
| if self.conf("shareVulkan", bool): | ||
| icds = [] | ||
| if "VK_ICD_FILENAMES" in os.environ: | ||
| if log_info: | ||
| Log.log("VK_ICD_FILENAMES is set, using Vulkan ICD files from environment") | ||
| # we do not set VK_ICD_FILENAMES in the container but rather put the files in the default location | ||
| icds = os.environ["VK_ICD_FILENAMES"].split(':') | ||
| icds = [pathlib.Path(icd) for icd in icds] | ||
| else: | ||
| path = pathlib.Path("/usr/share/vulkan/icd.d/") | ||
| icds = os.listdir(path) | ||
| icds = [path / icd for icd in icds] | ||
| if len(icds) == 0: | ||
| Log.warning("No Vulkan ICD files found. Is Vulkan setup to run on the host?") | ||
| else: | ||
| for icd in icds: | ||
| if icd.name.startswith("lvp_icd"): | ||
| if log_info: | ||
| Log.log(f"Found LavaPipe ICD file at {icd}. Ignoring as presumably you do not want to use a CPU Vulkan driver.") | ||
| continue | ||
| opt_builder += ["-v", f"{str(icd)}:/usr/share/vulkan/icd.d/{icd.name}:ro"] | ||
| if self.conf("saveVSCode", bool): | ||
@@ -245,2 +274,8 @@ # persists VSCode extensions and settings | ||
| # mount git to not having to explain yourself on every commit. Note that this is not the right | ||
| # location but later when we start the container, we will symlink ~/.gitconfig to /.gitconfig | ||
| gitconfig_path = os.path.expanduser("~/.gitconfig") | ||
| if os.path.exists(gitconfig_path): | ||
| opt_builder += ["-v", f"{gitconfig_path}:/.gitconfig"] | ||
| return opt_builder | ||
@@ -322,3 +357,6 @@ | ||
| Log.log("Setting up VSCode files...") | ||
| self.cmd('exec', '@CONTAINER@', 'bash', '-c', 'ln -s /.vscode-server/ ~/.vscode-server') | ||
| # Checks if ~/.vscode-server exists. If it does, we assume the symlink has already been set up and do nothing. | ||
| self.cmd('exec', '@CONTAINER@', 'bash', '-c', '[ -e ~/.vscode-server ] || ln -s /.vscode-server/ ~/.vscode-server') | ||
| # Set up ~/.gitconfig if it has not already been done | ||
| self.cmd('exec', '@CONTAINER@', 'bash', '-c', '[ -e ~/.gitconfig ] || ln -s /.gitconfig ~/.gitconfig') | ||
| elif not implicit: | ||
@@ -325,0 +363,0 @@ Log.success(f'Container {self.container_name()} already started.') |
+31
-31
| Metadata-Version: 2.1 | ||
| Name: mdk | ||
| Version: 5.7 | ||
| Version: 5.7.1 | ||
| Summary: a docker-compose helper | ||
@@ -9,32 +9,2 @@ Home-page: https://matician.com/ | ||
| License: MIT | ||
| Description: # mdk | ||
| `mdk` is a cli helper for docker built at [Matician](https://matician.com/). | ||
| ## Prerequisites | ||
| * Python (3) | ||
| * pip (3) | ||
| * Docker(ce) | ||
| ### About Docker versions | ||
| Though `mdk` itself does not require a specific Docker version, it is often used in conjection with Docker features from the 1.40 Docker API. This is only supported by Docker releases >= 19. | ||
| ## Installation | ||
| ```sh | ||
| $ pip3 install --user mdk | ||
| ``` | ||
| Note: you must have the `mdk` executable in your `$PATH`. If you used the installation instructions above, the executable is in `~/.local/bin`. | ||
| ## Usage | ||
| Run the `mdk` command after installation for a full list of commands. For help on individual commands, use `mdk COMMAND --help`. | ||
| ## FAQ | ||
| ### How do I add custom configuration to containers created by `mdk`? | ||
| `mdk` automatically loads additional options from two files: | ||
| * `ext.mdk.json` located in the same directory as `mdk.json` | ||
| * `~/.config/mdk/mdk.json` | ||
| Platform: UNKNOWN | ||
| Classifier: Environment :: Console | ||
@@ -47,1 +17,31 @@ Classifier: Intended Audience :: Developers | ||
| Description-Content-Type: text/markdown | ||
| License-File: LICENSE | ||
| # mdk | ||
| `mdk` is a cli helper for docker built at [Matician](https://matician.com/). | ||
| ## Prerequisites | ||
| * Python (3) | ||
| * pip (3) | ||
| * Docker(ce) | ||
| ### About Docker versions | ||
| Though `mdk` itself does not require a specific Docker version, it is often used in conjection with Docker features from the 1.40 Docker API. This is only supported by Docker releases >= 19. | ||
| ## Installation | ||
| ```sh | ||
| $ pip3 install --user mdk | ||
| ``` | ||
| Note: you must have the `mdk` executable in your `$PATH`. If you used the installation instructions above, the executable is in `~/.local/bin`. | ||
| ## Usage | ||
| Run the `mdk` command after installation for a full list of commands. For help on individual commands, use `mdk COMMAND --help`. | ||
| ## FAQ | ||
| ### How do I add custom configuration to containers created by `mdk`? | ||
| `mdk` automatically loads additional options from two files: | ||
| * `ext.mdk.json` located in the same directory as `mdk.json` | ||
| * `~/.config/mdk/mdk.json` |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
26316
11.96%14
7.69%479
7.88%