orgua / shepherd-datalib

Programming- and CLI-Interface for the h5-dataformat of the Shepherd-Testbed
MIT License
2 stars 0 forks source link

ValueError / ImportError after fresh Install (emitted by pydantic) #48

Closed orgua closed 6 months ago

orgua commented 7 months ago

Shell Output with triggered bug

Traceback (most recent call last):
  File "/usr/local/bin/shepherd-sheep", line 5, in <module>
    from shepherd_sheep.cli import cli
  File "/usr/local/lib/python3.10/dist-packages/shepherd_sheep/__init__.py", line 16, in <module>
    from shepherd_core.data_models import FirmwareDType
  File "/usr/local/lib/python3.10/dist-packages/shepherd_core/__init__.py", line 8, in <module>
    from .data_models.base.calibration import Calc_t
  File "/usr/local/lib/python3.10/dist-packages/shepherd_core/data_models/__init__.py", line 10, in <module>
    from .content.energy_environment import EnergyDType
  File "/usr/local/lib/python3.10/dist-packages/shepherd_core/data_models/content/__init__.py", line 6, in <module>
    from .virtual_source import VirtualSourceConfig
  File "/usr/local/lib/python3.10/dist-packages/shepherd_core/data_models/content/virtual_source.py", line 23, in <module>
    class VirtualSourceConfig(ContentModel, title="Config for the virtual Source"):
  File "/usr/local/lib/python3.10/dist-packages/shepherd_core/data_models/content/virtual_source.py", line 44, in VirtualSourceConfig
    harvester: VirtualHarvesterConfig = VirtualHarvesterConfig(name="mppt_opt")
  File "/usr/local/lib/python3.10/dist-packages/pydantic/main.py", line 175, in __init__
    self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for Config for the Harvester
  Value error, Component 'virtualharvesterconfig' not found! [type=value_error, input_value={'name': 'mppt_opt'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.7/v/value_error

Workaround

sudo rm /root/.cache/shepherd_datalib/fixtures.pickle
rm ~/.cache/shepherd_datalib/fixtures.pickle

cd ~
git clone https://github.com/orgua/shepherd-datalib.git
cd ./shepherd-datalib/shepherd_core/
pip install .[test]
pytest
orgua commented 6 months ago

switch to pyproject.toml had difficulties to include yaml in release despite using the official procedure. fixed it and added checks in code. Will be fixed with 2024.4.2