unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#41366] [PATCH 0/4] Add Importmagic
@ 2020-05-17 18:32 Ryan Prior via Guix-patches via
  2020-05-17 18:41 ` [bug#41366] [PATCH 1/4] gnu: Add python-importmagic Ryan Prior via Guix-patches via
  0 siblings, 1 reply; 11+ messages in thread
From: Ryan Prior via Guix-patches via @ 2020-05-17 18:32 UTC (permalink / raw)
  To: 41366

Importmagic fixes Python imports automatically. It has a few dependencies
(sexpdata, epc) not yet packaged in Guix, and a corresponding Emacs mode.

Ryan Prior (4):
  gnu: Add python-importmagic.
  gnu: Add python-sexpdata.
  gnu: Add python-epc.
  gnu: Add emacs-importmagic.

 gnu/packages/emacs-xyz.scm  | 23 ++++++++++++++
 gnu/packages/python-xyz.scm | 62 +++++++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+)

-- 
2.17.1






^ permalink raw reply	[flat|nested] 11+ messages in thread

* [bug#41366] [PATCH 1/4] gnu: Add python-importmagic.
  2020-05-17 18:32 [bug#41366] [PATCH 0/4] Add Importmagic Ryan Prior via Guix-patches via
@ 2020-05-17 18:41 ` Ryan Prior via Guix-patches via
  2020-05-17 18:41   ` [bug#41366] [PATCH 2/4] gnu: Add python-sexpdata Ryan Prior via Guix-patches via
                     ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Ryan Prior via Guix-patches via @ 2020-05-17 18:41 UTC (permalink / raw)
  To: 41366

* gnu/packages/python-xyz.el (python-importmagic): New variable.
---
 gnu/packages/python-xyz.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index c26a766d64..131d8c6d35 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -77,6 +77,7 @@
 ;;; Copyright © 2020 Lars-Dominik Braun <ldb@leibniz-psychology.org>
 ;;; Copyright © 2020 Alex ter Weele <alex.ter.weele@gmail.com>
 ;;; Copyright © 2020 Matthew Kraai <kraai@ftbfs.org>
+;;; Copyright © 2020 Ryan Prior <rprior@protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -5897,6 +5898,25 @@ need to use the older and less efficient @code{pkg_resources} package.")
        ("python-contextlib2" ,python2-contextlib2-bootstrap)
        ("python-importlib-resources" ,python2-importlib-resources-bootstrap))))))
 
+(define-public python-importmagic
+  (package
+    (name "python-importmagic")
+    (version "0.1.7")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "importmagic" version))
+       (sha256
+        (base32
+         "1n7qxa1snj06aw45mcfz7bxc46zp7fxj687140g2k6jcnyjmfxrz"))))
+    (build-system python-build-system)
+    (home-page "https://github.com/alecthomas/importmagic")
+    (synopsis "Library for adding, removing and managing Python imports")
+    (description
+     "Importmagic is a Python library for automatically managing imports by
+finding unresolved symbols in Python code and their corresponding imports.")
+    (license license:bsd-3)))
+
 (define-public python-jaraco-packaging
   (package
     (name "python-jaraco-packaging")
-- 
2.17.1






^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [bug#41366] [PATCH 2/4] gnu: Add python-sexpdata.
  2020-05-17 18:41 ` [bug#41366] [PATCH 1/4] gnu: Add python-importmagic Ryan Prior via Guix-patches via
@ 2020-05-17 18:41   ` Ryan Prior via Guix-patches via
  2020-05-17 18:41   ` [bug#41366] [PATCH 3/4] gnu: Add python-epc Ryan Prior via Guix-patches via
  2020-05-17 18:42   ` [bug#41366] [PATCH 4/4] gnu: Add emacs-importmagic Ryan Prior via Guix-patches via
  2 siblings, 0 replies; 11+ messages in thread
From: Ryan Prior via Guix-patches via @ 2020-05-17 18:41 UTC (permalink / raw)
  To: 41366

* gnu/packages/python-xyz.scm (python-sexpdata): New variable.
---
 gnu/packages/python-xyz.scm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 131d8c6d35..58de95b21a 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -5769,6 +5769,25 @@ them as the version argument or in a SCM managed file.")
 (define-public python2-setuptools-scm
   (package-with-python2 python-setuptools-scm))
 
+(define-public python-sexpdata
+  (package
+    (name "python-sexpdata")
+    (version "0.0.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "sexpdata" version))
+       (sha256
+        (base32
+         "1q4lsjyzzqrdv64l0pv4ij9nd8gqhvxqcrpxc2xpxs652sk2gj0s"))))
+    (build-system python-build-system)
+    (home-page "https://github.com/jd-boyd/sexpdata")
+    (synopsis "S-expression parser for Python")
+    (description
+     "Sexpdata is an S-expression parser/serializer.  It has load and dump
+functions like pickle, json or PyYAML module.")
+    (license license:bsd-3)))
+
 (define-public python-pathlib2
   (package
     (name "python-pathlib2")
-- 
2.17.1






^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [bug#41366] [PATCH 3/4] gnu: Add python-epc.
  2020-05-17 18:41 ` [bug#41366] [PATCH 1/4] gnu: Add python-importmagic Ryan Prior via Guix-patches via
  2020-05-17 18:41   ` [bug#41366] [PATCH 2/4] gnu: Add python-sexpdata Ryan Prior via Guix-patches via
@ 2020-05-17 18:41   ` Ryan Prior via Guix-patches via
  2020-05-17 18:42   ` [bug#41366] [PATCH 4/4] gnu: Add emacs-importmagic Ryan Prior via Guix-patches via
  2 siblings, 0 replies; 11+ messages in thread
From: Ryan Prior via Guix-patches via @ 2020-05-17 18:41 UTC (permalink / raw)
  To: 41366

* gnu/packages/python-xyz.py (python-epc): New variable.
---
 gnu/packages/python-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 58de95b21a..0ec672259b 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -8826,6 +8826,29 @@ functions to find and load entry points.")
 (define-public python2-entrypoints
   (package-with-python2 python-entrypoints))
 
+(define-public python-epc
+  (package
+    (name "python-epc")
+    (version "0.0.5")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "epc" version))
+       (sha256
+        (base32
+         "09bx1ln1bwa00917dndlgs4k589h8qx2x080xch5m58p92kjwkd1"))))
+    (build-system python-build-system)
+    (propagated-inputs
+     `(("python-sexpdata" ,python-sexpdata)))
+    (native-inputs
+     `(("python-nose" ,python-nose)))
+    (home-page "https://github.com/tkf/python-epc")
+    (synopsis "Remote procedure call (RPC) stack for Emacs Lisp and Python")
+    (description
+     "Python-EPC can call elisp functions from Python and Python functions
+from elisp.")
+    (license license:gpl3)))
+
 (define-public python-nbconvert
   (package
     (name "python-nbconvert")
-- 
2.17.1






^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [bug#41366] [PATCH 4/4] gnu: Add emacs-importmagic.
  2020-05-17 18:41 ` [bug#41366] [PATCH 1/4] gnu: Add python-importmagic Ryan Prior via Guix-patches via
  2020-05-17 18:41   ` [bug#41366] [PATCH 2/4] gnu: Add python-sexpdata Ryan Prior via Guix-patches via
  2020-05-17 18:41   ` [bug#41366] [PATCH 3/4] gnu: Add python-epc Ryan Prior via Guix-patches via
@ 2020-05-17 18:42   ` Ryan Prior via Guix-patches via
  2020-05-23 19:02     ` Marius Bakke
  2 siblings, 1 reply; 11+ messages in thread
From: Ryan Prior via Guix-patches via @ 2020-05-17 18:42 UTC (permalink / raw)
  To: 41366

* gnu/packages/emacs-xyz.py (emacs-importmagic): New variable.
---
 gnu/packages/emacs-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 4bbd482409..859417dc62 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -70,6 +70,7 @@
 ;;; Copyright © 2020 Alberto Eleuterio Flores Guerrero <barbanegra+guix@posteo.mx>
 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2020 pinoaffe <pinoaffe@airmail.cc>
+;;; Copyright © 2020 Ryan Prior <rprior@protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -16625,6 +16626,28 @@ provided by other Emacs packages dealing with pass:
 image, rotate it, save modified images, and more.")
       (license license:gpl3+))))
 
+(define-public emacs-importmagic
+  (package
+    (name "emacs-importmagic")
+    (version "20180520.303")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://melpa.org/packages/importmagic-" version ".tar"))
+       (sha256
+        (base32 "0xk4i4x4836ksv2pr3aarpbkq6b5sz8c3y6f39fwf698v8zirhs9"))))
+    (build-system emacs-build-system)
+    (propagated-inputs
+     `(("emacs-epc" ,emacs-epc)
+       ("emacs-f" ,emacs-f)
+       ("python-epc" ,python-epc)
+       ("python-importmagic" ,python-importmagic)))
+    (home-page "https://github.com/anachronic/importmagic.el")
+    (synopsis "Fix Python imports")
+    (description "Importmagic.el fixes unresolved imports in Python buffers.")
+    (license license:gpl3)))
+
 (define-public emacs-package-lint
   (let ((commit "69bb89d00ba212b734c676ad056aa793c450b288"))
     (package
-- 
2.17.1






^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [bug#41366] [PATCH 4/4] gnu: Add emacs-importmagic.
  2020-05-17 18:42   ` [bug#41366] [PATCH 4/4] gnu: Add emacs-importmagic Ryan Prior via Guix-patches via
@ 2020-05-23 19:02     ` Marius Bakke
  2020-05-23 19:27       ` Ryan Prior via Guix-patches via
  0 siblings, 1 reply; 11+ messages in thread
From: Marius Bakke @ 2020-05-23 19:02 UTC (permalink / raw)
  To: rprior, 41366

[-- Attachment #1: Type: text/plain, Size: 263 bytes --]

Ryan Prior via Guix-patches via <guix-patches@gnu.org> writes:

> * gnu/packages/emacs-xyz.py (emacs-importmagic): New variable.

Thanks!  This patch did not apply for me somehow, can you rebase on the
current master branch?

I applied the other three, all LGTM.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [bug#41366] [PATCH 4/4] gnu: Add emacs-importmagic.
  2020-05-23 19:02     ` Marius Bakke
@ 2020-05-23 19:27       ` Ryan Prior via Guix-patches via
  2020-05-23 20:00         ` Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: Ryan Prior via Guix-patches via @ 2020-05-23 19:27 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 41366

[-- Attachment #1: Type: text/plain, Size: 350 bytes --]

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, May 23, 2020 7:02 PM, Marius Bakke <mbakke@fastmail.com> wrote:

> This patch did not apply for me somehow

Looks like a conflict in the copyright line. (Something something lawyers.) New patch attached!

> I applied the other three, all LGTM.

Thank you!


Ryan

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-emacs-importmagic.patch --]
[-- Type: text/x-patch; name="0001-gnu-Add-emacs-importmagic.patch", Size: 1884 bytes --]

From fdb49b29a29c2955a7efe39a0d20f0a8a0752bb4 Mon Sep 17 00:00:00 2001
From: Ryan Prior <rprior@protonmail.com>
Date: Sun, 17 May 2020 12:56:00 -0500
Subject: [PATCH] gnu: Add emacs-importmagic.

* gnu/packages/emacs-xyz.py (emacs-importmagic): New variable.
---
 gnu/packages/emacs-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index fe68a56fd6..94f5fdbb4e 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -71,6 +71,7 @@
 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2020 pinoaffe <pinoaffe@airmail.cc>
 ;;; Copyright © 2020 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2020 Ryan Prior <rprior@protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -16672,6 +16673,28 @@ provided by other Emacs packages dealing with pass:
 image, rotate it, save modified images, and more.")
       (license license:gpl3+))))
 
+(define-public emacs-importmagic
+  (package
+    (name "emacs-importmagic")
+    (version "20180520.303")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://melpa.org/packages/importmagic-" version ".tar"))
+       (sha256
+        (base32 "0xk4i4x4836ksv2pr3aarpbkq6b5sz8c3y6f39fwf698v8zirhs9"))))
+    (build-system emacs-build-system)
+    (propagated-inputs
+     `(("emacs-epc" ,emacs-epc)
+       ("emacs-f" ,emacs-f)
+       ("python-epc" ,python-epc)
+       ("python-importmagic" ,python-importmagic)))
+    (home-page "https://github.com/anachronic/importmagic.el")
+    (synopsis "Fix Python imports")
+    (description "Importmagic.el fixes unresolved imports in Python buffers.")
+    (license license:gpl3)))
+
 (define-public emacs-package-lint
   (let ((commit "69bb89d00ba212b734c676ad056aa793c450b288"))
     (package
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [bug#41366] [PATCH 4/4] gnu: Add emacs-importmagic.
  2020-05-23 19:27       ` Ryan Prior via Guix-patches via
@ 2020-05-23 20:00         ` Nicolas Goaziou
  2020-05-23 20:41           ` Ryan Prior via Guix-patches via
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Goaziou @ 2020-05-23 20:00 UTC (permalink / raw)
  To: 41366; +Cc: mbakke, rprior

Hello,

Ryan Prior via Guix-patches via <guix-patches@gnu.org> writes:

> +    (propagated-inputs
> +     `(("emacs-epc" ,emacs-epc)
> +       ("emacs-f" ,emacs-f)
> +       ("python-epc" ,python-epc)
> +       ("python-importmagic" ,python-importmagic)))

OOC, are you sure Python packages need to be propagated in this case?

Regards,

-- 
Nicolas Goaziou




^ permalink raw reply	[flat|nested] 11+ messages in thread

* [bug#41366] [PATCH 4/4] gnu: Add emacs-importmagic.
  2020-05-23 20:00         ` Nicolas Goaziou
@ 2020-05-23 20:41           ` Ryan Prior via Guix-patches via
  2020-05-23 21:12             ` Marius Bakke
  0 siblings, 1 reply; 11+ messages in thread
From: Ryan Prior via Guix-patches via @ 2020-05-23 20:41 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: mbakke, 41366

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, May 23, 2020 8:00 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:

> OOC, are you sure Python packages need to be propagated in this case?

Hi Nicholas! I tried it with the python packages in "inputs" and impotmagic.el complained about not being able to find them. I'm going to be helping with maintenance of importmagic.el so maybe that's something I can fix on the package side?

At present this seems to work better. I don't know yet what the difference is between inputs and propagated-inputs when it comes to Python packages so maybe somebody else might have a better answer.

Ryan




^ permalink raw reply	[flat|nested] 11+ messages in thread

* [bug#41366] [PATCH 4/4] gnu: Add emacs-importmagic.
  2020-05-23 20:41           ` Ryan Prior via Guix-patches via
@ 2020-05-23 21:12             ` Marius Bakke
  2020-05-23 21:18               ` Ryan Prior via Guix-patches via
  0 siblings, 1 reply; 11+ messages in thread
From: Marius Bakke @ 2020-05-23 21:12 UTC (permalink / raw)
  To: Ryan Prior, Nicolas Goaziou; +Cc: 41366

[-- Attachment #1: Type: text/plain, Size: 1513 bytes --]

Ryan Prior <rprior@protonmail.com> writes:

> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Saturday, May 23, 2020 8:00 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>
>> OOC, are you sure Python packages need to be propagated in this case?
>
> Hi Nicholas! I tried it with the python packages in "inputs" and impotmagic.el complained about not being able to find them. I'm going to be helping with maintenance of importmagic.el so maybe that's something I can fix on the package side?
>
> At present this seems to work better. I don't know yet what the difference is between inputs and propagated-inputs when it comes to Python packages so maybe somebody else might have a better answer.

The difference is that propagated-inputs will be installed to the
profile when you 'guix install emacs-importmagic'.

Propagating these will only work if the user already has 'python' in the
profile, which sets up PYTHONPATH.

For regular executables, we solve this by "wrapping" the executable with
PYTHONPATH to avoid the need for propagation.

Ideally we'd patch importmagic.el so that it automatically sets
PYTHONPATH referring to these two packages (prepending to any existing
PYTHONPATH).  I think python-shell-interpreter also should use the
absolute file name of the "python" executable so it does not have to be
installed separately.

Do you think that can work?

Thanks for chiming in Nicolas, I had completely missed those propagated
Python packages.  :-)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [bug#41366] [PATCH 4/4] gnu: Add emacs-importmagic.
  2020-05-23 21:12             ` Marius Bakke
@ 2020-05-23 21:18               ` Ryan Prior via Guix-patches via
  0 siblings, 0 replies; 11+ messages in thread
From: Ryan Prior via Guix-patches via @ 2020-05-23 21:18 UTC (permalink / raw)
  To: Marius Bakke; +Cc: Nicolas Goaziou, 41366

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, May 23, 2020 9:12 PM, Marius Bakke <mbakke@fastmail.com> wrote:

> Do you think that can work?

I'm going to look into it. Prepending the PYTHONPATH and manipulating the python-shell-interpreter doesn't sound like it should be tricky.

Do you by chance know of other Emacs packages in Guix which do this kind of patching so I can look at an example? I'll do some grepping around and see what I can find, or just try something and iterate from there.


Ryan




^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-05-23 21:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-17 18:32 [bug#41366] [PATCH 0/4] Add Importmagic Ryan Prior via Guix-patches via
2020-05-17 18:41 ` [bug#41366] [PATCH 1/4] gnu: Add python-importmagic Ryan Prior via Guix-patches via
2020-05-17 18:41   ` [bug#41366] [PATCH 2/4] gnu: Add python-sexpdata Ryan Prior via Guix-patches via
2020-05-17 18:41   ` [bug#41366] [PATCH 3/4] gnu: Add python-epc Ryan Prior via Guix-patches via
2020-05-17 18:42   ` [bug#41366] [PATCH 4/4] gnu: Add emacs-importmagic Ryan Prior via Guix-patches via
2020-05-23 19:02     ` Marius Bakke
2020-05-23 19:27       ` Ryan Prior via Guix-patches via
2020-05-23 20:00         ` Nicolas Goaziou
2020-05-23 20:41           ` Ryan Prior via Guix-patches via
2020-05-23 21:12             ` Marius Bakke
2020-05-23 21:18               ` Ryan Prior via Guix-patches via

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