0

Working on a python application which consists of multiple packages which are supposed to be decoupled from each other and installed as dependencies if necessary. Each package is installable and can be accessed through a namespace. However, this means that every time I change anything in any of the dependency, I need to rebuild that package and re-run the application.

Is it possible to setup such an application to link the local packages directly and not from the External Libraries?

Example application structure

- myapp
    - package1
        - src
            - package1 (this becomes package1 namespace)
                - package 1 sub-packages and modules 
        - setup.py
        - requirements.txt
        - pyproject.toml
    - package2
        - src
            - package2 (this becomes package2 namespace)
                - (python code which imports package1.*)
        - setup.py
        - requirements.txt (
        - pyproject.toml

In the source code of the package2, the modules import package 1 as follows

from package1.module1 import Class1

To be able to test any code that I'm writing in package1, I need to build that package, install it, and then re-run the application.

Is it possible to avoid having to rebuild and re-install the package in the development environment?

I'm new to Python and came into this project from JS, wondering if python can do something like Webpack live reload and hot module swapping?

Tried linking the packages via the file path, but that didn't fly for production. Researched Python module linking and structure, but didn't find a good approach to this particular issue. Expecting that when I run the application locally, changes to the modules within the application reflect in the running code. If that's not possible, at least expecting to only reload the application and not rebuild all the packages.

0 Answers0