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.
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")))