Mobileread
PyCharm setup and py3?
#1  Boilerplate4U 07-11-2020, 04:31 PM
Hi all!

I'm able use the PyCharm remote debugger (using pydevd_pycharm) and "calibre-debug" but now I'd like to run everything within the IDE. Dev env = macOS Catalina.
  1. Anyone that managed to setup pycharm (2020) for Calibre (4.20) in regards to env-vars, search paths and so forth?
  2. I noticed some references to py3 (ispy3) etc. Will Calibre 4.20 work with python v3.8?

Thanks in advance!
Reply 

#2  JSWolf 07-11-2020, 05:36 PM
Quote Boilerplate4U
Hi all!

I'm able use the PyCharm remote debugger (using pydevd_pycharm) and "calibre-debug" but now I'd like to run everything within the IDE. Dev env = macOS Catalina.
  1. Anyone that managed to setup pycharm (2020) for Calibre (4.20) in regards to env-vars, search paths and so forth?
  2. I noticed some references to py3 (ispy3) etc. Will Calibre 4.20 work with python v3.8?

Thanks in advance!
Calibre 4.20 will not work with Python 3. But there is a Python 3 beta version.

https://www.mobileread.com/forums/sh...d.php?t=325721
Reply 

#3  Boilerplate4U 07-12-2020, 12:00 PM
Ok, thanks!

I've tried to decode the launcher app (the binary) "calibre-debug" to find out the Calibre entry point in debug-mode and other arguments but in vain. dtrace does give you only a limited view of the program arguments.

I've also tried to find out how it works by looking in the source for the luncher apps but there are no docs how they are constructed and as I don't have a complete dev-env I can't use the build process.

Can anyone please give me a hint how calibre-debug is starting up things? A qualified guess is that "start_gui" ("srs/gui2/main.py") might be the entry point...


PHP Code
pwd
~/src/calibre/bypy/macos
ls -l
total 128
-rw-r--r--  1 calibre  staff  31460 Jul  6 16:17 __main__.py
-rw-r--r--  1 calibre  staff   1642 Jul  6 16:17 launcher.c
-rw-r--r--  1 calibre  staff   1072 Jul  6 16:17 placeholder.c
-rw-r--r--  1 calibre  staff   3304 Jul  6 16:17 sign.py
-rw-r--r--  1 calibre  staff   5293 Jul  6 16:17 site.py
-rw-r--r--  1 calibre  staff   6427 Jul  6 16:17 util.c
-rw-r--r--  1 calibre  staff    246 Jul  6 16:17 util.
Btw, whats the reason why the launcher apps are created as binaries instead of regular scripts?
Reply 

#4  kovidgoyal 07-12-2020, 12:07 PM
calibre-debug executes main() from debug.py
Reply 

#5  Boilerplate4U 07-12-2020, 12:19 PM
Quote kovidgoyal
calibre-debug executes main() from debug.py
Ok, thank you!

1. Are there any other settings, env-vars or arguments needed before calling main()?

2. Btw, where is the src for v4.99 (py3 beta) located? Couldn't find any branch or tag at github "https://github.com/kovidgoyal/calibre" for 4.99...

Thanks, Lars.
Reply 

#6  kovidgoyal 07-12-2020, 01:00 PM
The py3 branch. And if you want to run calibre from source using a binary read https://manual.calibre-ebook.com/develop.html
Reply 

#7  Boilerplate4U 07-12-2020, 04:01 PM
Quote kovidgoyal
The py3 branch. And if you want to run calibre from source using a binary read https://manual.calibre-ebook.com/develop.html
Thanks!

Fyi, the following settings are required by PyCharm to work on macOS (ie set by launcher "caliber-debug"). In the example below Calibre is cloned to "/Users/lars/src/calibre"

Code
CloneRoot = /Users/lars/src/calibre
CALIBRE_DEVELOP_FROM = CloneRoot/src <======
PHP Code
sys.path
=========
/
Users/bob/lars/calibre/src         (env "CALIBRE_DEVELOP_FROM")
/
Applications/calibre.app/Contents/Resources/Python/lib/python2.7
/Applications/calibre.app/Contents/Resources/Python/lib/python2.7/lib-dynload
/Applications/calibre.app/Contents/Resources/Python/site-packages
/Applications/calibre.app/Contents/Resources/Python

os
.environ
==========
CALIBRE_DEVELOP_FROM=/Users/lars/src/calibre/src
FONTCONFIG_PATH
=/Applications/calibre.app/Contents/Resources/fonts
FONTCONFIG_FILE
=/Applications/calibre.app/Contents/Resources/fonts/fonts.conf
PYTHONIOENCODING
=UTF-8
IPYTHONDIR
=/Users/lars/Library/Caches/calibre/ipython
SSL_CERT_FILE
=/Applications/calibre.app/Contents/Resources/resources/mozilla-ca-certs.pem

sys
.exec_prefix
===============
/
Applications/calibre.app/Contents/Resources/Python 
Reply 

Today's Posts | Search this Thread | Login | Register