• S sverchok
  • Информация о проекте
    • Информация о проекте
    • Активность
    • Метки
    • Участники
  • Репозиторий
    • Репозиторий
    • Файлы
    • Коммиты
    • Ветки
    • Теги
    • Участники
    • Диаграмма
    • Сравнение
  • Задачи 148
    • Задачи 148
    • Список
    • Доски
    • Спринты
  • Запросы на слияние 21
    • Запросы на слияние 21
  • CI/CD
    • CI/CD
    • Конвейеры
    • Задания
    • Расписания
  • Развертывания
    • Развертывания
    • Окружения
    • Релизы
  • Пакеты и реестры
    • Пакеты и реестры
    • Реестр пакетов
    • Реестр контейнеров
  • Мониторинг
    • Мониторинг
    • Инциденты
  • Аналитика
    • Аналитика
    • Поток ценности
    • CI/CD
    • Репозиторий
  • Wiki
    • Wiki
  • Сниппеты
    • Сниппеты
  • Активность
  • Диаграмма
  • Создать новую задачу
  • Задания
  • Коммиты
  • Доски с задачами
Свернуть панель
  • nikitronn
  • sverchok
  • Запросы на слияние
  • !4823

Sverchok imports refactoring

  • Ревью изменений

  • Скачать
  • Почтовые патчи
  • Простое отличие
Слиты nikitronn запросил слияние sverchok_imports в master Дек 16, 2022
  • Обзор 1
  • Коммиты 5
  • Конвейеры 0
  • Изменения 36

Created by: Durman

Addressed problem description

Modules in the utils folder are not imported unless their imported from other modules (from core, ui, nodes). It also means that their register and unregister functions won't be called unless their are not imported. So it's possible to put operators into utils folder and register them there but in this case they should be explicitly imported to a module where they are used. This is done for performance of add-on startup though on this stage it might be barely measurable.

Also it fix import settings module. It was imported under add-on folder name. For example if the folder was sverchok-master the modules was imported with sverchok-master.settings path. Also modules imported in the settings modules could have the same root in path. In the same time all other modules are imported with sverchok root, independent to add-on folder name. This caused problems like that #4281 (closed).

Also it includes some small optimization, removes some code duplications and unused code.

Next step is to consider to use normal import statements. Now we use importlib.import_module function to import modules dynamically. This probably was implemented in this way to get import modules explicitly and call their register functions. But we also can easily get modules from sys.modules dictionary to call their registration functions. This is actually how it's done for imported utils modules now. Also current import approach is not friendly to use such tool as pydeps. On other hand using dynamic imports in a function is more convenient for startup profiling.

🚀 Startup performance is about 10% faster #4752

Ответственный
Назначить
Проверяющие
Запросить ревью
Оценка трудозатрат
Исходная ветка: sverchok_imports