* Provide python:debug with --with-pydebug switch
@ 2018-03-24 8:12 Pjotr Prins
2018-03-26 13:13 ` Ludovic Courtès
0 siblings, 1 reply; 5+ messages in thread
From: Pjotr Prins @ 2018-03-24 8:12 UTC (permalink / raw)
To: Hartmut Goebel; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 352 bytes --]
Attached a quick hack I did to get a Python interpreter with full
debug facilities. It includes the built-in debugging/tracing
facilities. I think this is a valuable thing to have as a package
https://pythonextensionpatterns.readthedocs.io/en/latest/debugging/debug_python.html
especially when writing native extensions (shared libs)
wdyt?
Pj.
[-- Attachment #2: python-debug.patch --]
[-- Type: text/x-diff, Size: 1598 bytes --]
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 4baef4391..79788520a 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -387,7 +387,6 @@ data types.")
(package (inherit python)
(name "python-minimal")
(outputs '("out"))
-
;; Build fails due to missing ctypes without libffi.
;; OpenSSL is a mandatory dependency of Python 3.x, for urllib;
;; zlib is required by 'zipimport', used by pip.
@@ -395,6 +394,28 @@ data types.")
("openssl" ,openssl)
("zlib" ,zlib)))))
+(define-public python-debug
+ (package (inherit python)
+ (name "python-debug")
+ (outputs '("out" "debug"))
+ ;; Build fails due to missing ctypes without libffi.
+ ;; OpenSSL is a mandatory dependency of Python 3.x, for urllib;
+ ;; zlib is required by 'zipimport', used by pip.
+ (inputs `(("libffi" ,libffi)
+ ("openssl" ,openssl)
+ ("zlib" ,zlib)))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:tests? #f
+ #:configure-flags
+ (list "--enable-shared" ;allow embedding
+ "--with-system-ffi" ;build ctypes
+ "--with-ensurepip=install" ;install pip and setuptools
+ "--enable-unicode=ucs4"
+ "--with-pydebug"
+ (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib"))
+ ))))
+
(define* (wrap-python3 python
#:optional
(name (string-append (package-name python) "-wrapper")))
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: Provide python:debug with --with-pydebug switch
2018-03-24 8:12 Provide python:debug with --with-pydebug switch Pjotr Prins
@ 2018-03-26 13:13 ` Ludovic Courtès
2018-03-26 19:12 ` Hartmut Goebel
0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2018-03-26 13:13 UTC (permalink / raw)
To: Pjotr Prins; +Cc: guix-devel
Hi Pjotr,
Pjotr Prins <pjotr.public12@thebird.nl> skribis:
> Attached a quick hack I did to get a Python interpreter with full
> debug facilities. It includes the built-in debugging/tracing
> facilities. I think this is a valuable thing to have as a package
>
> https://pythonextensionpatterns.readthedocs.io/en/latest/debugging/debug_python.html
>
> especially when writing native extensions (shared libs)
IIUC --with-pydebug instruments the bytecode interpreter, whereas the
“debug” output allows us to get debugging symbols for libpython.so,
which may be useful but is a separate issue, right? (I agree both are
useful, though.)
I suppose --with-pydebug incurs some run-time overhead, so I think it
makes sense to make it a separate “python-debug” package.
What do Pythonistas think?
If there are no objections, I’ll push your patch minus “#:tests? #f”.
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Provide python:debug with --with-pydebug switch
2018-03-26 13:13 ` Ludovic Courtès
@ 2018-03-26 19:12 ` Hartmut Goebel
2018-03-27 5:48 ` Pjotr Prins
0 siblings, 1 reply; 5+ messages in thread
From: Hartmut Goebel @ 2018-03-26 19:12 UTC (permalink / raw)
To: Ludovic Courtès, Pjotr Prins; +Cc: guix-devel
Hi,
apparently I missed Pjotr's original message.
> I suppose --with-pydebug incurs some run-time overhead, so I think it
> makes sense to make it a separate “python-debug” package.
I'm not a hard-code extension developer, so I can't tell how useful it is.
Since it is a separate package, it does not harm. So go ahead!
I suggest adding/extending the description like this:
This python interpreter is build with '--with-pydebug' to help
debugging. See
https://pythonextensionpatterns.readthedocs.io/en/latest/debugging/debug.html
for for information.
--
Regards
Hartmut Goebel
| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Provide python:debug with --with-pydebug switch
2018-03-26 19:12 ` Hartmut Goebel
@ 2018-03-27 5:48 ` Pjotr Prins
2018-03-29 13:20 ` Ludovic Courtès
0 siblings, 1 reply; 5+ messages in thread
From: Pjotr Prins @ 2018-03-27 5:48 UTC (permalink / raw)
To: Hartmut Goebel; +Cc: guix-devel
On Mon, Mar 26, 2018 at 09:12:20PM +0200, Hartmut Goebel wrote:
> Hi,
>
> apparently I missed Pjotr's original message.
>
> > I suppose --with-pydebug incurs some run-time overhead, so I think it
> > makes sense to make it a separate “python-debug” package.
>
> I'm not a hard-code extension developer, so I can't tell how useful it is.
> Since it is a separate package, it does not harm. So go ahead!
Bit more than that, it finds memory leaks which can exist in current
extensions. It is very useful Guix provides it as most other
distributions do not and developers have to compile python from
scratch with all hurdles. I'll write down how you can make use of this
out of the box with Guix.
> I suggest adding/extending the description like this:
>
> This python interpreter is build with '--with-pydebug' to help
> debugging. See
> https://pythonextensionpatterns.readthedocs.io/en/latest/debugging/debug.html
> for for information.
I would add 'develop and debug extensions'.
Pj.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Provide python:debug with --with-pydebug switch
2018-03-27 5:48 ` Pjotr Prins
@ 2018-03-29 13:20 ` Ludovic Courtès
0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2018-03-29 13:20 UTC (permalink / raw)
To: Pjotr Prins; +Cc: guix-devel
Hello,
I adjusted the patch and added the “python-debug” package:
https://git.savannah.gnu.org/cgit/guix.git/commit/?id=9c3f2c2e83e0970173fbbf77f699e2c325046daa
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-03-29 13:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-24 8:12 Provide python:debug with --with-pydebug switch Pjotr Prins
2018-03-26 13:13 ` Ludovic Courtès
2018-03-26 19:12 ` Hartmut Goebel
2018-03-27 5:48 ` Pjotr Prins
2018-03-29 13:20 ` Ludovic Courtès
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).