Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch from bundled lazy loading code to the public lazy_loader package #575

Merged

Conversation

grlee77
Copy link
Contributor

@grlee77 grlee77 commented Jun 19, 2023

This PR switch from using the internally bundled _shared/lazy.py to the public lazy_loader package.

Also switches to use .pyi stub files in cases where submodules or attributes were being dynamically loaded.

closes #489 (probably, but have not yet verified from VS Code)

@grlee77 grlee77 added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Jun 19, 2023
@grlee77 grlee77 added this to the v23.08.00 milestone Jun 19, 2023
@grlee77 grlee77 requested review from a team as code owners June 19, 2023 12:32
@grlee77 grlee77 force-pushed the use-lazy_loader-and-type-stubs branch from 42a7c3b to 9b3362c Compare June 19, 2023 18:04
@grlee77
Copy link
Contributor Author

grlee77 commented Jun 19, 2023

rebased on top of #574 which fixes some test failures with the most recent NumPy/CuPy

@jakirkham
Copy link
Member

Thanks Greg! 🙏

Can you please update dependencies.yaml as well?

Copy link
Contributor

@gigony gigony left a comment

Choose a reason for hiding this comment

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

Thanks @grlee77 ! Looks good to me!

python/cucim/src/cucim/skimage/filters/_fft_based.py Outdated Show resolved Hide resolved
@jakirkham
Copy link
Member

Looks like there are some conflicts here that need to be resolved

@jakirkham
Copy link
Member

Thanks Greg! 🙏

Could you please add lazy_loader >=0.1 to this package list?

cucim/dependencies.yaml

Lines 158 to 171 in 0a6bf42

run:
common:
- output_types: conda
packages:
- click
- cupy >=12.0.0
- jbig
- libwebp-base
- numpy >=1.21.3
- scikit-image >=0.19.0,<0.22.0a0
- scipy
- xz
- zlib
- zstd

@jakirkham
Copy link
Member

The CI failure is due to the fact this change needs to be propagated

Please run (in some environment where this dependency can be installed):

python -m pip install rapids-dependency-file-generator
rapids-dependency-file-generator

Then commit & push the changes

Copy link
Member

@jakirkham jakirkham left a comment

Choose a reason for hiding this comment

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

Thanks Greg! 🙏

This is a nice simplification

Had a couple questions about files now included in distributions

python/cucim/MANIFEST.in Outdated Show resolved Hide resolved
@@ -39,6 +39,7 @@ def read(*names, **kwargs):
url='https://developer.nvidia.com/multidimensional-image-processing',
packages=find_packages('src'),
package_dir={'cucim': 'src/cucim'},
package_data={"": ["*.pyi"]}, # distribute
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to (somewhat?) align this with the MANIFEST.in?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure under what conditions it matters (e.g. python setup.py sdist seems to have the .npy files etc that are listed in the MANIFEST.in without listing them again here). I went ahead and added it for consistency, though.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah the rule of thumb I try to use is...

  • If we want to ship them, but not install them, use MANIFEST.in
  • If we want to ship and install them, use package_data

Copy link
Member

Choose a reason for hiding this comment

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

Think the suggestion in comment ( #575 (comment) ) is revises this to the list we want to install. Though please let me know if we are still missing things

python/cucim/setup.py Outdated Show resolved Hide resolved
Co-authored-by: jakirkham <jakirkham@gmail.com>
python/cucim/MANIFEST.in Outdated Show resolved Hide resolved
Co-authored-by: jakirkham <jakirkham@gmail.com>
Copy link
Member

@jakirkham jakirkham left a comment

Choose a reason for hiding this comment

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

Thanks Greg! 🙏

@jakirkham
Copy link
Member

(asking offline for OPS to review)

@jakirkham
Copy link
Member

/merge

@rapids-bot rapids-bot bot merged commit f8e9b38 into rapidsai:branch-23.08 Jul 26, 2023
21 checks passed
wyli pushed a commit to Project-MONAI/MONAI that referenced this pull request Sep 7, 2023
Fixes #6956 .

### Description

Looks like an error which introduced by this
[PR](rapidsai/cucim#575).
The submodule in cucim.skimage can import correctly, so change to
directly import cucim.skimage.

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

Signed-off-by: KumoLiu <yunl@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improves an existing functionality non-breaking Introduces a non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEA] Missing IntelliSense capability in VSCode
4 participants