Skip to content

Commit

Permalink
DynamicEntryPointCommandGroup: Temporarily silence deprecation warn…
Browse files Browse the repository at this point in the history
…ing (#6232)

The `AbstractCode` and its subclasses have not yet migrated to using
`pydantic` instead of `_get_cli_options()` and therefore running the
`verdi code create` command would emit the deprecation warning. The
warning is temporarily silenced until the code has also been migrated.
  • Loading branch information
sphuber authored Dec 20, 2023
1 parent b168f2e commit 397a714
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions aiida/cmdline/groups/dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,14 @@ def list_options(self, entry_point: str) -> list:
cls = self.factory(entry_point)

if not hasattr(cls, 'Configuration'):
from aiida.common.warnings import warn_deprecation
warn_deprecation(
'Relying on `_get_cli_options` is deprecated. The options should be defined through a '
'`pydantic.BaseModel` that should be assigned to the `Config` class attribute.',
version=3
)
# This should be enabled once the ``Code`` classes are migrated to using pydantic to define their model.
# See https://github.com/aiidateam/aiida-core/pull/6190
# from aiida.common.warnings import warn_deprecation
# warn_deprecation(
# 'Relying on `_get_cli_options` is deprecated. The options should be defined through a '
# '`pydantic.BaseModel` that should be assigned to the `Config` class attribute.',
# version=3
# )
options_spec = self.factory(entry_point).get_cli_options() # type: ignore[union-attr]
else:

Expand Down

0 comments on commit 397a714

Please sign in to comment.