Skip to content

Commit ea90b91

Browse files
committed
Add a little doc
1 parent 7db1802 commit ea90b91

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

docs/source/api.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ User Classes
3131
proj.conda_package.CondaRecipe
3232
proj.conda_package.RattlerRecipe
3333
proj.conda_project.CondaProject
34+
artifact.container.Docker
3435
proj.documentation.MDBook
3536
proj.documentation.RTD
3637
proj.git.GitRepo
@@ -48,6 +49,7 @@ User Classes
4849
.. autoclass:: projspec.proj.conda_package.CondaRecipe
4950
.. autoclass:: projspec.proj.conda_package.RattlerRecipe
5051
.. autoclass:: projspec.proj.conda_project.CondaProject
52+
.. autoclass:: projspec.artifact.container.Docker
5153
.. autoclass:: projspec.proj.documentation.MDBook
5254
.. autoclass:: projspec.proj.documentation.RTD
5355
.. autoclass:: projspec.proj.git.GitRepo

src/projspec/artifact/container.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66

77
class DockerImage(BaseArtifact):
8+
"""Filesystem snapshot as created by bocker-build, which can be instantiated into a container."""
9+
810
def __init__(self, proj: Project, cmd=None, tag=None):
911
if tag:
1012
cmd = ["docker", "build", ".", "-t", tag]
@@ -15,6 +17,8 @@ def __init__(self, proj: Project, cmd=None, tag=None):
1517

1618

1719
class DockerRuntime(DockerImage):
20+
"""Running container in Docker, tied to a certain image and command."""
21+
1822
# Note: there are many optional arguments to docker; we could surface the most common
1923
# ones (-it, -d, -p). This does the simplest thing.
2024

@@ -38,6 +42,8 @@ def _make(self, *args, **kwargs) -> None:
3842

3943

4044
class Docker(ProjectExtra):
45+
"""A Dockerfile in a project directory, which defines how to build an image."""
46+
4147
def match(self):
4248
return "Dockerfile" in self.proj.basenames
4349

src/projspec/html.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,17 @@ def dict_to_html(data: dict, title="Data", open_level=2) -> str:
2020
open = "open" if open_level > 0 else "closed"
2121

2222
html = [
23-
f'<details {open} style="margin-left: 20px; margin-bottom: 10px;"><summary style="cursor: pointer; color: #2c5aa0; padding: 5px;"><strong>{title}</strong></summary>'
23+
f'<details {open} style="margin-left: 20px; margin-bottom: 10px;"><summary style="cursor: pointer;'
24+
f' color: #2c5aa0; padding: 5px;"><strong>{title}</strong></summary>'
2425
]
2526

2627
for key, value in data.items():
2728
if isinstance(value, dict):
2829
html.append(dict_to_html(value, key, open_level - 1))
2930
elif isinstance(value, (list, tuple)):
3031
html.append(
31-
f'<details style="margin-left: 20px; margin-bottom: 10px;"><summary style="cursor: pointer; color: #2c5aa0; padding: 5px;"><strong>{key}</strong></summary>'
32+
f'<details style="margin-left: 20px; margin-bottom: 10px;"><summary style="cursor: pointer;'
33+
f' color: #2c5aa0; padding: 5px;"><strong>{key}</strong></summary>'
3234
)
3335
for i, item in enumerate(value):
3436
if isinstance(item, dict):

0 commit comments

Comments
 (0)