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

add stub file for autocomplete #313

Closed
wants to merge 2 commits into from
Closed

add stub file for autocomplete #313

wants to merge 2 commits into from

Conversation

zdenop
Copy link
Contributor

@zdenop zdenop commented Dec 9, 2022

fixes #312

@sirfz
Copy link
Owner

sirfz commented Dec 13, 2022

Since we now have an src/ dir we might as well move the pyx and pxd files into it I suppose?

@@ -260,7 +260,7 @@ def make_extension():
build_args = get_build_args()
_CYTHON_COMPILE_TIME_ENV = build_args.pop('compile_time_env')
return Extension(
'tesserocr', sources=['tesserocr.pyx'], language='c++', **build_args
'tesserocr.tesserocr', sources=['tesserocr.pyx'], language='c++', **build_args
Copy link
Owner

Choose a reason for hiding this comment

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

This looks confusing to me, why the name change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason is packing (I still fight to create a windows wheel). The actual code will produce wheel like this:

>unzip -l dist\tesserocr-2.5.2-cp39-cp39-win_amd64.whl
Archive:  dist\tesserocr-2.5.2-cp39-cp39-win_amd64.whl
  Length      Date    Time    Name
---------  ---------- -----   ----
   314368  2022-12-13 17:27   tesserocr.cp39-win_amd64.pyd
     1082  2022-12-13 17:27   tesserocr-2.5.2.dist-info/LICENSE
    10257  2022-12-13 17:27   tesserocr-2.5.2.dist-info/METADATA
      100  2022-12-13 17:27   tesserocr-2.5.2.dist-info/WHEEL
       10  2022-12-13 17:27   tesserocr-2.5.2.dist-info/top_level.txt
      485  2022-12-13 17:27   tesserocr-2.5.2.dist-info/RECORD
  3405824  2022-12-08 18:31   leptonica-1.82.0.dll
  2502656  2022-12-08 18:37   tesseract52.dll
---------                     -------
  6234782                     8 files

So pyd and dlls will be installed to 'c:\Python\Python39\Lib\site-packages'. My proposed change will produce it like this:

>unzip -l dist\tesserocr-2.5.2-cp39-cp39-win_amd64.whl
Archive:  dist\tesserocr-2.5.2-cp39-cp39-win_amd64.whl
  Length      Date    Time    Name
---------  ---------- -----   ----
      216  2022-12-13 17:30   tesserocr/__init__.py
    63204  2022-12-13 17:30   tesserocr/__init__.pyi
  3405824  2022-12-08 18:31   tesserocr/leptonica-1.82.0.dll
  2502656  2022-12-08 18:37   tesserocr/tesseract52.dll
   316416  2022-12-13 17:30   tesserocr/tesserocr.cp39-win_amd64.pyd
     1082  2022-12-13 17:30   tesserocr-2.5.2.dist-info/LICENSE
    10257  2022-12-13 17:30   tesserocr-2.5.2.dist-info/METADATA
      100  2022-12-13 17:30   tesserocr-2.5.2.dist-info/WHEEL
       10  2022-12-13 17:30   tesserocr-2.5.2.dist-info/top_level.txt
      827  2022-12-13 17:30   tesserocr-2.5.2.dist-info/RECORD
---------                     -------
  6300592                     10 files

e.g. dlls will be "hidden" in tesserocr directory after installation + installing __init__.pyi in 'c:\Python\Python39\Lib\site-packages' is IMO bad idea. I try to follow example for cython packaing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

regarding moving pyx and pxd to src - I tried it but the build/creating wheel fails and I could not find a way how to fix it. We need some python packing expert help.
The current proposed changes work for me and I hope we can soon create windows builds (commit will follow later) with Github actions automatically.

@NewUserHa
Copy link

any update to this PR?

@sirfz sirfz mentioned this pull request Apr 21, 2024
@sirfz
Copy link
Owner

sirfz commented Apr 21, 2024

closing in favor of #350

@sirfz sirfz closed this Apr 21, 2024
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.

No docstrings or autocomplete in vscode, windows install
3 participants