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

*.pyi files not installed #3558

Closed
thewtex opened this issue Aug 18, 2022 · 4 comments · Fixed by #3560
Closed

*.pyi files not installed #3558

thewtex opened this issue Aug 18, 2022 · 4 comments · Fixed by #3560
Assignees
Labels
type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances

Comments

@thewtex
Copy link
Member

thewtex commented Aug 18, 2022

Description

The Python interface files (*.pyi) are not installed into the install tree. As a result, they are missing from the 5.3rc4.post2 wheels.

Steps to Reproduce

  1. Enable ITK_WRAP_PYTHON
  2. ninja
  3. DESTDIR=/tmp/itk-install ninja install
  4. find /tmp/itk-install -name '*.pyi'

Expected behavior

The .pyi files are installed alongside the .py files.

Actual behavior

.pyi files are not installed.

Reproducibility

Always

Versions

ITK Git master, i.e.58ce6e84f2

Environment

Tested on Linux.

@thewtex thewtex added the type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances label Aug 18, 2022
@thewtex thewtex assigned hjmjohnson and tbirdso and unassigned hjmjohnson Aug 18, 2022
@thewtex thewtex changed the title *.pyi files not install *.pyi files not installed Aug 18, 2022
@hjmjohnson
Copy link
Member

This is necessary to start getting the python system to be more consistent with remote modules: InsightSoftwareConsortium/ITKSphinxExamples#394

@hjmjohnson hjmjohnson linked a pull request Aug 19, 2022 that will close this issue
2 tasks
@hjmjohnson
Copy link
Member

@thewtex I think I know how to manipulate the itk-stub files for installing, but I am not sure what is supposed to be done.

There is a variable called "PY_SITE_PACKAGES_PATH". That is sometimes set to CMAKE_INSTALL_PREFIX, and other times to the site-packages directory of the python interpreter.

Currently, the python stuff is installed to the python interpreter site-packages in the "itk" and "itk-stubs" directories, and I have confirmed that the type hints work in the PyCharm interpreter (after waiting for the indexing to complete).

I am not sure if this will allow for the stub files to be included in wheel packages, or if each wheel package will include duplicate copies of the itk-stub directories.

Please review the PR #3560 for the starting effort to make typehints more universally available.

Hans

@thewtex
Copy link
Member Author

thewtex commented Aug 22, 2022

@hjmjohnson to be included in the wheels, the *.pyi files need to be installed into PY_SITE_PACKAGES_PATH -- I would think the PY_SITE_PACKAGES_PATH/itk path. How does the interpreter understand that it needs to look into PY_SITE_PACKAGES_PATH/itk-stubs?

@hjmjohnson
Copy link
Member

@thewtex I followed the convention that would allow for making a separate type-hint package: https://peps.python.org/pep-0561/#stub-only-packages by putting the .pyi files in a separate directory.

This was "doing it the hardest way" initially, knowing that if we wanted to collapse it later, it would be relatively easy to identify and change "itk-stubs" -> "itk"

I'll make a PR to review tonight. It should be pretty easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants