py-capellambse icon indicating copy to clipboard operation
py-capellambse copied to clipboard

`DeprecationWarning` when importing `MelodyModel`

Open MoritzWeber0 opened this issue 2 years ago • 2 comments

When importing MelodyModel from capellambse, I get a DeprecationWarning:

Traceback (most recent call last):
  File "./test.py", line 1, in <module>
    from capellambse import MelodyModel
  File ".venv/lib/python3.9/site-packages/capellambse/__init__.py", line 58, in <module>
    from .model import MelodyModel
  File ".venv/lib/python3.9/site-packages/capellambse/model/__init__.py", line 26, in <module>
    from .layers import oa, ctx, la, pa  # isort:skip
  File ".venv/lib/python3.9/site-packages/capellambse/model/layers/oa.py", line 13, in <module>
    from .. import crosslayer, diagram
  File ".venv/lib/python3.9/site-packages/capellambse/model/crosslayer/__init__.py", line 9, in <module>
    from . import cs, information
  File ".venv/lib/python3.9/site-packages/capellambse/model/crosslayer/cs.py", line 20, in <module>
    from . import capellacommon, fa, information
  File ".venv/lib/python3.9/site-packages/capellambse/model/crosslayer/capellacommon.py", line 90, in <module>
    class StateTransition(c.GenericElement):
  File ".venv/lib/python3.9/site-packages/capellambse/model/crosslayer/capellacommon.py", line 100, in StateTransition
    guard = c.AttrProxyAccessor(capellacore.Constraint, "guard")
  File ".venv/lib/python3.9/site-packages/capellambse/model/common/accessors.py", line 557, in __init__
    warnings.warn(
DeprecationWarning: Class argument to AttrProxyAccessor is deprecated.

How to reproduce

Run:

python -W error -c "import capellambse"

I'm using the latest version 0.4.19 of capellambse with Python 3.9.

MoritzWeber0 avatar Sep 26 '22 16:09 MoritzWeber0

Also of note is that this isn't the only warning that occurs currently, and there's a lot of work to be done to resolve all of them. Warning-less import of capellambse is still a ways off.

Wuestengecko avatar Sep 28 '22 09:09 Wuestengecko

For reference, here's the current list of generated warnings at import time. They're all related to missing XML tag information on LinkAccessor instances.

/home/martinlehmann/git/capellambse/capellambse/model/crosslayer/capellacommon.py:132: DeprecationWarning: Unspecified XML tag is deprecated
  c.LinkAccessor(
/home/martinlehmann/git/capellambse/capellambse/model/crosslayer/fa.py:164: DeprecationWarning: Unspecified XML tag is deprecated
  involved_functions = c.LinkAccessor[AbstractFunction](
/home/martinlehmann/git/capellambse/capellambse/model/crosslayer/fa.py:170: DeprecationWarning: Unspecified XML tag is deprecated
  involved_links = c.LinkAccessor[AbstractExchange](
/home/martinlehmann/git/capellambse/capellambse/model/crosslayer/fa.py:201: DeprecationWarning: Unspecified XML tag is deprecated
  allocated_functional_exchanges = c.LinkAccessor[FunctionalExchange](
/home/martinlehmann/git/capellambse/capellambse/model/crosslayer/cs.py:72: DeprecationWarning: Unspecified XML tag is deprecated
  exchanges = c.LinkAccessor[fa.ComponentExchange](
/home/martinlehmann/git/capellambse/capellambse/model/crosslayer/cs.py:85: DeprecationWarning: Unspecified XML tag is deprecated
  involved_items = c.LinkAccessor[c.GenericElement](  # FIXME fill in tag
/home/martinlehmann/git/capellambse/capellambse/model/crosslayer/cs.py:88: DeprecationWarning: Unspecified XML tag is deprecated
  exchanges = c.LinkAccessor[fa.ComponentExchange](  # FIXME fill in tag
/home/martinlehmann/git/capellambse/capellambse/model/crosslayer/cs.py:148: DeprecationWarning: Unspecified XML tag is deprecated
  c.LinkAccessor(  # FIXME fill in tag
/home/martinlehmann/git/capellambse/capellambse/model/layers/oa.py:100: DeprecationWarning: Unspecified XML tag is deprecated
  involved_activities = c.LinkAccessor[OperationalActivity](
/home/martinlehmann/git/capellambse/capellambse/model/layers/oa.py:106: DeprecationWarning: Unspecified XML tag is deprecated
  involved_entities = c.LinkAccessor[c.GenericElement](
/home/martinlehmann/git/capellambse/capellambse/model/layers/oa.py:115: DeprecationWarning: Unspecified XML tag is deprecated
  involved_processes = c.LinkAccessor[OperationalProcess](
/home/martinlehmann/git/capellambse/capellambse/model/layers/oa.py:205: DeprecationWarning: Unspecified XML tag is deprecated
  allocated_interactions = c.LinkAccessor[fa.FunctionalExchange](
/home/martinlehmann/git/capellambse/capellambse/model/layers/ctx.py:27: DeprecationWarning: Unspecified XML tag is deprecated
  realized_operational_activities = c.LinkAccessor[oa.OperationalActivity](
/home/martinlehmann/git/capellambse/capellambse/model/layers/ctx.py:59: DeprecationWarning: Unspecified XML tag is deprecated
  realized_operational_entities = c.LinkAccessor[oa.Entity](
/home/martinlehmann/git/capellambse/capellambse/model/layers/ctx.py:115: DeprecationWarning: Unspecified XML tag is deprecated
  involved_functions = c.LinkAccessor[SystemFunction](
/home/martinlehmann/git/capellambse/capellambse/model/layers/ctx.py:121: DeprecationWarning: Unspecified XML tag is deprecated
  involved_chains = c.LinkAccessor[fa.FunctionalChain](
/home/martinlehmann/git/capellambse/capellambse/model/layers/ctx.py:127: DeprecationWarning: Unspecified XML tag is deprecated
  involved_components = c.LinkAccessor[SystemComponent](
/home/martinlehmann/git/capellambse/capellambse/model/layers/ctx.py:136: DeprecationWarning: Unspecified XML tag is deprecated
  realized_capabilities = c.LinkAccessor[oa.OperationalCapability](
/home/martinlehmann/git/capellambse/capellambse/model/layers/ctx.py:189: DeprecationWarning: Unspecified XML tag is deprecated
  exploits = c.LinkAccessor[Capability](
/home/martinlehmann/git/capellambse/capellambse/model/layers/la.py:26: DeprecationWarning: Unspecified XML tag is deprecated
  realized_system_functions = c.LinkAccessor[ctx.SystemFunction](
/home/martinlehmann/git/capellambse/capellambse/model/layers/la.py:68: DeprecationWarning: Unspecified XML tag is deprecated
  realized_components = c.LinkAccessor[ctx.SystemComponent](
/home/martinlehmann/git/capellambse/capellambse/model/layers/la.py:105: DeprecationWarning: Unspecified XML tag is deprecated
  involved_functions = c.LinkAccessor[LogicalFunction](
/home/martinlehmann/git/capellambse/capellambse/model/layers/la.py:111: DeprecationWarning: Unspecified XML tag is deprecated
  involved_chains = c.LinkAccessor[fa.FunctionalChain](
/home/martinlehmann/git/capellambse/capellambse/model/layers/la.py:117: DeprecationWarning: Unspecified XML tag is deprecated
  involved_components = c.LinkAccessor[LogicalComponent](
/home/martinlehmann/git/capellambse/capellambse/model/layers/la.py:123: DeprecationWarning: Unspecified XML tag is deprecated
  realized_capabilities = c.LinkAccessor[ctx.Capability](
/home/martinlehmann/git/capellambse/capellambse/model/layers/pa.py:37: DeprecationWarning: Unspecified XML tag is deprecated
  realized_logical_functions = c.LinkAccessor[la.LogicalFunction](
/home/martinlehmann/git/capellambse/capellambse/model/layers/pa.py:75: DeprecationWarning: Unspecified XML tag is deprecated
  realized_logical_components = c.LinkAccessor[la.LogicalComponent](

Wuestengecko avatar Nov 18 '22 14:11 Wuestengecko