Skip to content

P/init install cleanup#444

Open
peterhollender wants to merge 3 commits intomainfrom
p/init_install_cleanup
Open

P/init install cleanup#444
peterhollender wants to merge 3 commits intomainfrom
p/init_install_cleanup

Conversation

@peterhollender
Copy link
Copy Markdown
Contributor

This is a fairly major change to the project, designed to address issues #8 and #10

  • Trims unnecessary parts of the project, including
    • legacy scripts
    • the io module (now covered in openlifu-sdk)
    • unused parts of Database (gridweights)
  • Reorganizes virtual_fit module into seg
  • Eliminates "eager" imports in openlifu.__init__, to prevent the many-seconds-long importing when accessing any submodule.
  • Moves importing of heavier-weight packages (which are being made optional by this branch) into the methods that call them, so that the objects can be partially-used without having those dependencies imported.
  • Introduces sets of optional-dependencies to pyproject.toml that allow for reduced dependency installation. The openlifu-test-app project, for example, can package only the hardware-communication required dependencies by using the [io] option. The base application as used in Slicer should now be installed with the [app] option.

Code that touches openlifu.virtual_fit needs to be refactored to use openlifu.seg.virtualfit, and code that used things like openlifu.Transducer will need to be changed to use openlifu.xdc.Transducer

This introduces sets of optional-dependencies to `pyproject.toml` that allow for reduced dependency installation. The `openlifu-test-app` project, for example, can package only the hardware-communication required dependencies by using the `[io]` option. The base application as used in Slicer should now be installed with the `[app]` option.
- Trims unnecessary parts of the project, including
  - legacy scripts
  - the io module (now covered in `openlifu-sdk`)
  - unused parts of Database (gridweights)
- Reorganizes `virtual_fit` module into `seg`
- Eliminates "eager" imports in `openlifu.__init__`, to prevent the many-seconds-long importing when accessing any submodule.
- Moves importing of heavier-weight packages (which are being made optional by this branch) into the methods that call them, so that the objects can be partially-used without having those dependencies imported.

Code that touches `openlifu.virtual_fit` needs to be refactored to use `openlifu.seg.virtualfit`, and code that used things like `openlifu.Transducer` will need to be changed to use `openlifu.xdc.Transducer`

reorganize virtual fit and geo

remove gridweights

Unused enhancement

Update transducer.py

remove legacy scripts,
@peterhollender
Copy link
Copy Markdown
Contributor Author

peterhollender commented Apr 7, 2026

Interesting - the CI virtual environment isn't picking up the right dependencies (because the "no-option" version grabs a super-minimal set that won't have full functionality). Not sure how to address this? I'd really like pip install openlifu to get the primary dependencies with the [app] option, but I'm not sure how to make pyproject.toml do that

@peterhollender peterhollender force-pushed the p/init_install_cleanup branch from faba8a3 to c1e3ae3 Compare April 7, 2026 15:05
@ebrahimebrahim
Copy link
Copy Markdown
Collaborator

Interesting - the CI virtual environment isn't picking up the right dependencies (because the "no-option" version grabs a super-minimal set that won't have full functionality). Not sure how to address this? I'd really like pip install openlifu to get the primary dependencies with the [app] option, but I'm not sure how to make pyproject.toml do that

I think this is not possible, to make pip install openlifu default to pip install openlifu[app]. It will always be the minimal thing.

But that is completely fine, in my opinion. It is very reasonable to make the CI ofr example install pip install openlifu[app] or whatever we want, and to make the primary instructions be pip install openlifu[app] or wahtever. This is common and reasonable.

One way to achieve something like what you are saying is to rename this package to openlifu-core and make a new package called openlifu that thinly wraps it and that depends on openlifu-core[app]. But... eh.

"matplotlib",
"pandas",
"scipy",
"watchdog"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this one should go to the cloud group rather being a core dependency

"nvidia-ml-py"
]
cloud = [
"requests",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think requests should be in the core depndencies group because of its use in misc things like assets.py

It is a very light dependency I think so no issue with that

Comment on lines +118 to +119
[tool.hatch.metadata]
allow-direct-references = true
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no direct references so we should remvoe this. I think for anything merged to main there should not be direct references anyway, because PyPI will reject openlifu if there are

description = "Openwater Focused Ultrasound Toolkit"
readme = "README.rst"
license.file = "LICENSE"
requires-python = ">=3.10"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem:
openlifu supports python 3.10+
However openlifu-sdk was set to support 3.12+

This means there will be no dependency version resolution for openlifu on python 3.10 and 3.11!

We need to either bump this up to 3.12 here, giving up on 3.10 and 3.11 forever,
or openlifu-sdk needs to back up and support 3.10, 3.11.

Comment on lines 82 to 99
@@ -74,6 +97,12 @@
"sphinx_autodoc_typehints",
"furo>=2023.08.17",
]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test group now needs to be expanded to include the groups that are covered by test. Because the CI installs .[test] and so right now it wouldn't have what it needs to run the tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants