Skip to content

Commit a67e2f9

Browse files
authored
Merge pull request #303 from softwarepub/feature/302-minor-arch-fixes
Minor architectural fixes
2 parents 58846b0 + 4557374 commit a67e2f9

File tree

8 files changed

+411
-408
lines changed

8 files changed

+411
-408
lines changed

poetry.lock

Lines changed: 392 additions & 390 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/hermes/commands/base.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from pydantic_settings import BaseSettings, SettingsConfigDict
1717

1818

19-
class HermesSettings(BaseSettings):
19+
class _HermesSettings(BaseSettings):
2020
"""Root class for HERMES configuration model."""
2121

2222
model_config = SettingsConfigDict(env_file_encoding='utf-8')
@@ -31,7 +31,7 @@ class HermesCommand(abc.ABC):
3131
"""
3232

3333
command_name: str = ""
34-
settings_class: Type = HermesSettings
34+
settings_class: Type = _HermesSettings
3535

3636
def __init__(self, parser: argparse.ArgumentParser):
3737
"""Initialize a new instance of any HERMES command.
@@ -45,18 +45,19 @@ def __init__(self, parser: argparse.ArgumentParser):
4545
self.log = logging.getLogger(f"hermes.{self.command_name}")
4646
self.errors = []
4747

48-
def init_plugins(self):
48+
@classmethod
49+
def init_plugins(cls):
4950
"""Collect and initialize the plugins available for the HERMES command."""
5051

5152
# Collect all entry points for this group (i.e., all valid plug-ins for the step)
52-
entry_point_group = f"hermes.{self.command_name}"
53+
entry_point_group = f"hermes.{cls.command_name}"
5354
group_plugins = {
5455
entry_point.name: entry_point.load()
5556
for entry_point in metadata.entry_points(group=entry_point_group)
5657
}
5758

5859
# Collect the plug-in specific configurations
59-
self.derive_settings_class({
60+
cls.derive_settings_class({
6061
plugin_name: plugin_class.settings_class
6162
for plugin_name, plugin_class in group_plugins.items()
6263
if hasattr(plugin_class, "settings_class") and plugin_class.settings_class is not None

src/hermes/commands/clean/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from hermes.commands.base import HermesCommand
1313

1414

15-
class HermesCleanSettings(BaseModel):
15+
class _HermesCleanSettings(BaseModel):
1616
"""Configuration of the ``clean`` command."""
1717
pass
1818

@@ -21,7 +21,7 @@ class HermesCleanCommand(HermesCommand):
2121
""" Clean up caches from previous HERMES runs. """
2222

2323
command_name = "clean"
24-
settings_class = HermesCleanSettings
24+
settings_class = _HermesCleanSettings
2525

2626
def __call__(self, args: argparse.Namespace) -> None:
2727
self.log.info("Removing HERMES caches...")

src/hermes/commands/curate/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from hermes.model.context import CodeMetaContext
1616

1717

18-
class CurateSettings(BaseModel):
18+
class _CurateSettings(BaseModel):
1919
"""Generic deposition settings."""
2020

2121
pass
@@ -25,7 +25,7 @@ class HermesCurateCommand(HermesCommand):
2525
""" Curate the unified metadata before deposition. """
2626

2727
command_name = "curate"
28-
settings_class = CurateSettings
28+
settings_class = _CurateSettings
2929

3030
def init_command_parser(self, command_parser: argparse.ArgumentParser) -> None:
3131
pass

src/hermes/commands/deposit/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def publish(self) -> None:
106106
pass
107107

108108

109-
class DepositSettings(BaseModel):
109+
class _DepositSettings(BaseModel):
110110
"""Generic deposition settings."""
111111

112112
target: str = ""
@@ -116,7 +116,7 @@ class HermesDepositCommand(HermesCommand):
116116
""" Deposit the curated metadata to repositories. """
117117

118118
command_name = "deposit"
119-
settings_class = DepositSettings
119+
settings_class = _DepositSettings
120120

121121
def init_command_parser(self, command_parser: argparse.ArgumentParser) -> None:
122122
command_parser.add_argument('--file', '-f', nargs=1, action='append',

src/hermes/commands/harvest/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __call__(self, command: HermesCommand) -> t.Tuple[t.Dict, t.Dict]:
2525
pass
2626

2727

28-
class HarvestSettings(BaseModel):
28+
class _HarvestSettings(BaseModel):
2929
"""Generic harvesting settings."""
3030

3131
sources: list[str] = []
@@ -35,7 +35,7 @@ class HermesHarvestCommand(HermesCommand):
3535
""" Harvest metadata from configured sources. """
3636

3737
command_name = "harvest"
38-
settings_class = HarvestSettings
38+
settings_class = _HarvestSettings
3939

4040
def __call__(self, args: argparse.Namespace) -> None:
4141
self.args = args

src/hermes/commands/init/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,15 @@ def convert_remote_url(url: str) -> str:
139139
return url
140140

141141

142-
class HermesInitSettings(BaseModel):
142+
class _HermesInitSettings(BaseModel):
143143
"""Configuration of the ``init`` command."""
144144
pass
145145

146146

147147
class HermesInitCommand(HermesCommand):
148148
""" Install HERMES onto a project. """
149149
command_name = "init"
150-
settings_class = HermesInitSettings
150+
settings_class = _HermesInitSettings
151151

152152
def __init__(self, parser: argparse.ArgumentParser):
153153
super().__init__(parser)
@@ -554,7 +554,7 @@ def choose_push_branch(self):
554554
"When should the automated HERMES process start?",
555555
[
556556
f"When I push the current branch {self.folder_info.current_branch}",
557-
"When I push an other branch",
557+
"When I push another branch",
558558
"When a push a specific tag (not implemented)",
559559
]
560560
)

src/hermes/commands/postprocess/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class HermesPostprocessPlugin(HermesPlugin):
1515
pass
1616

1717

18-
class PostprocessSettings(BaseModel):
18+
class _PostprocessSettings(BaseModel):
1919
"""Generic post-processing settings."""
2020

2121
execute: list = []
@@ -25,7 +25,7 @@ class HermesPostprocessCommand(HermesCommand):
2525
"""Post-process the published metadata after deposition."""
2626

2727
command_name = "postprocess"
28-
settings_class = PostprocessSettings
28+
settings_class = _PostprocessSettings
2929

3030
def __call__(self, args: argparse.Namespace) -> None:
3131
pass

0 commit comments

Comments
 (0)