How to test python library used by integration - install from local checkout?

I’m trying to test the changes I introduced in python library used by core integration.

I can see that in the container I’m running 3.2.1 with pip freeze | grep solax

I attempted to install from local checkout simply with pip install . .
This worked, and pip freeze shown my checkout to be installed.

I reloaded the integration from lovelace, and yet my changes don’t seem to be picked up.

What am I doing wrong?

You need to use

pip install -e .

I think you’ll need to restart HA Core in order for an integration to pickup code changes.

I thought so to, and I have restarted - after the restart the installed version shown by pip freeze went back to 3.2.1 from locally installed one…

Hmm, I know about editable install (run from checkout instead of installing to default location, if I recall it just links) as the problem abstract is not to have an editable version of code (I don’t mind remote changes, pull, reinstall) but the fact that:

  1. without restart, just reloaded integration from GUI, the changes aren’t picked up
  2. restarting ha, after restart, pip freeze version resets back to 3.2.1 (nonlocal install)

I don’t think that will help, will give it a try though!

homeassistant:/home/dev/solax# pip install -e .
Looking in indexes: https://pypi.org/simple, https://wheels.home-assistant.io/musllinux-index/
Obtaining file:///home/dev/solax
  Preparing metadata (setup.py) ... done
Requirement already satisfied: aiohttp<4,>=3.5.4 in /usr/local/lib/python3.13/site-packages (from solax==3.1.2.dev9+g2cccfca) (3.11.9)
Requirement already satisfied: voluptuous>=0.11.5 in /usr/local/lib/python3.13/site-packages (from solax==3.1.2.dev9+g2cccfca) (0.15.2)
Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /usr/local/lib/python3.13/site-packages (from aiohttp<4,>=3.5.4->solax==3.1.2.dev9+g2cccfca) (2.4.4)
Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.13/site-packages (from aiohttp<4,>=3.5.4->solax==3.1.2.dev9+g2cccfca) (1.3.1)
Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.13/site-packages (from aiohttp<4,>=3.5.4->solax==3.1.2.dev9+g2cccfca) (24.2.0)
Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.13/site-packages (from aiohttp<4,>=3.5.4->solax==3.1.2.dev9+g2cccfca) (1.5.0)
Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.13/site-packages (from aiohttp<4,>=3.5.4->solax==3.1.2.dev9+g2cccfca) (6.1.0)
Requirement already satisfied: propcache>=0.2.0 in /usr/local/lib/python3.13/site-packages (from aiohttp<4,>=3.5.4->solax==3.1.2.dev9+g2cccfca) (0.2.1)
Requirement already satisfied: yarl<2.0,>=1.17.0 in /usr/local/lib/python3.13/site-packages (from aiohttp<4,>=3.5.4->solax==3.1.2.dev9+g2cccfca) (1.18.3)
Requirement already satisfied: idna>=2.0 in /usr/local/lib/python3.13/site-packages (from yarl<2.0,>=1.17.0->aiohttp<4,>=3.5.4->solax==3.1.2.dev9+g2cccfca) (3.10)
Installing collected packages: solax
  Attempting uninstall: solax
    Found existing installation: solax 3.2.1
    Uninstalling solax-3.2.1:
      Successfully uninstalled solax-3.2.1
  DEPRECATION: Legacy editable install of solax==3.1.2.dev9+g2cccfca from file:///home/dev/solax (setup.py develop) is deprecated. pip 25.0 will enforce this behaviour change. A possible replacement is to add a pyproject.toml or enable --use-pep517, and use setuptools >= 64. If the resulting installation is not behaving as expected, try using --config-settings editable_mode=compat. Please consult the setuptools documentation for more information. Discussion can be found at https://github.com/pypa/pip/issues/11457
  Running setup.py develop for solax
Successfully installed solax-3.1.2.dev9+g2cccfca
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.

Yep, after reload - no change in the sensor I checked, after the restart of homeassistant:

homeassistant:/home/dev/solax#
exit
# docker exec -it homeassistant bash
homeassistant:/config# pip freeze | grep solax
solax==3.2.1
homeassistant:/config#

An editable install, yes, will link it such that when you amend the code, you do not have to install it again, but yes, you always have to reatart HA to pick up modified code.

I presume you are not changing the required version in requirements_all.txt to reflect the version of your modified library, which is why it is installing the one specified in the requirements file on every restart.