[PATCH 0/3] Add python-mypy and required packages

  • Done
  • quality assurance status badge
Details
4 participants
  • JesseJohnGildersleve
  • wednesday
  • Maxim Cournoyer
  • swedebugia
Owner
unassigned
Submitted by
JesseJohnGildersleve
Severity
normal
J
J
JesseJohnGildersleve wrote on 8 Apr 2019 15:44
(name . guix-patches@gnu.org)(address . guix-patches@gnu.org)
clcw9plVchj9b2Re4ypNFSB9-744wR__yl_rGITHVjSpti_knLYaKGtf94hTTll1Ss-hgoQY96M27EVB8iQuLfihg11ddVFLTBNbRGWXKIE=@protonmail.com
The next 3 patches will add python-mypy, and its dependencies python-typed-ast and python-mypy-extension/python2-mypy-extension. This is a program for type checking python code.
J
J
JesseJohnGildersleve wrote on 8 Apr 2019 16:20
[PATCH 1/3] Add python-typed-ast
(name . 35193@debbugs.gnu.org)(address . 35193@debbugs.gnu.org)
hL9Eqz5ZF52qkUkWX3OiX156-pQOztKX1Oq5cZuhJsYQvSm6FBiDf4_MWuLutrYQjxAasR9wcgQUF6s0y-LM-ucT5ICeGdi2cFYy1DRLbZM=@protonmail.com
From ad2b363f11805002bee96d1471bff8471c0a1711 Mon Sep 17 00:00:00 2001
From: frozenpigs <purpjuice@protonmail.com>
Date: Mon, 8 Apr 2019 14:34:19 +0100
Subject: [PATCH 1/3] gnu: add python-typed-ast

---
gnu/packages/python-xyz.scm | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

Toggle diff (38 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 014026d06e..b5bfd6a261 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -59,6 +59,7 @@
;;; Copyright © 2018 Vagrant Cascadian <vagrant@debian.org>
;;; Copyright © 2019 Brett Gilio <brettg@posteo.net>
;;; Copyright © 2019 Sam <smbaines8@gmail.com>
+;;; Copyright © 2019 Jesse Gildersleve <jessejohngildersleve@protonmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -15319,3 +15320,25 @@ processes may share the same data.")
(description "A Sphinx extension to convert SVG images to PDF in case the builder does not support
SVG images natively (e.g. LaTeX).")
(license license:bsd-3)))
+
+(define-public python-typed-ast
+ (package
+ (name "python-typed-ast")
+ (version "1.3.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "typed-ast" version))
+ (sha256
+ (base32
+ "095l1jfxk1k2z5sijbirg2s5a01r4ig3715zqa075xzf0zx8lvb0"))))
+ (build-system python-build-system)
+ (home-page "https://github.com/python/typed_ast")
+ (synopsis "Fork of Python 2 and 3 ast modules with type comment support")
+ (description "Typed_ast is a Python 3 package that provides a Python 2.7 and
+Python 3 parser similar to the standard ast library. Unlike ast, the parsers in
+typed_ast include PEP 484 type comments and are independent of the version of Python
+under which they are run. The typed_ast parsers produce the standard Python AST
+(plus type comments), and are both fast and correct, as they are based on the
+CPython 2.7 and 3.6 parsers.")
+ (license license:asl2.0)))
--
2.21.0
J
J
JesseJohnGildersleve wrote on 8 Apr 2019 16:21
[PATCH 2/3] Add python-mypy-extensions
(name . 35193@debbugs.gnu.org)(address . 35193@debbugs.gnu.org)
EIbrlUgbttK_CglbGins40wf0ibxASDV0yECWDwGQ0SJdFStFknwrtWqBQYEPCYJ2bLN8uv6-w_1OZ83OFEhvnxCZARt6oBWH1L5CIHuucI=@protonmail.com
From e968e9787457781552fa229f6d1c5f15e473de1c Mon Sep 17 00:00:00 2001
From: frozenpigs <purpjuice@protonmail.com>
Date: Mon, 8 Apr 2019 14:35:01 +0100
Subject: [PATCH 2/3] gnu: add python-mypy-extensions and
python2-mypy-extensions

---
gnu/packages/python-xyz.scm | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

Toggle diff (31 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index b5bfd6a261..27f1e1de08 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -15342,3 +15342,26 @@ under which they are run. The typed_ast parsers produce the standard Python AST
(plus type comments), and are both fast and correct, as they are based on the
CPython 2.7 and 3.6 parsers.")
(license license:asl2.0)))
+
+(define-public python-mypy-extensions
+ (package
+ (name "python-mypy-extensions")
+ (version "0.4.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "mypy_extensions" version))
+ (sha256
+ (base32
+ "04h8brrbbx151dfa2cvvlnxgmb5wa00mhd2z7nd20s8kyibfkq1p"))))
+ (build-system python-build-system)
+ (propagated-inputs
+ `(("python-typing" ,python-typing)))
+ (home-page "http://www.mypy-lang.org/")
+ (synopsis "Experimental type system extensions for programs checked with mypy")
+ (description "The “mypy_extensions” module defines experimental extensions to the
+standard “typing” module that are supported by the mypy typechecker.")
+ (license license:expat)))
+
+(define-public python2-mypy-extensions
+ (package-with-python2 python-mypy-extensions))
--
2.21.0
J
J
JesseJohnGildersleve wrote on 8 Apr 2019 16:23
[PATCH 3/3] Add python-mypy
(name . 35193@debbugs.gnu.org)(address . 35193@debbugs.gnu.org)
3IVQb1J6z9j9U5yWdRLpzad564-kbH6bJWXMh054ojASWO6UgyWmKmls20D3yhjKr7zc97ZT-Ts5emS4RsmMuRU9X2zIquw8pivqiq_wLNs=@protonmail.com
From e3d67303de7f73c6af6eab6360ee3a414e175488 Mon Sep 17 00:00:00 2001
From: frozenpigs <purpjuice@protonmail.com>
Date: Mon, 8 Apr 2019 14:35:50 +0100
Subject: [PATCH 3/3] gnu: add python-mypy

---
gnu/packages/python-xyz.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

Toggle diff (35 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 27f1e1de08..1cb5cfaade 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -15365,3 +15365,30 @@ standard “typing” module that are supported by the mypy typechecker.")

(define-public python2-mypy-extensions
(package-with-python2 python-mypy-extensions))
+
+(define-public python-mypy
+ (package
+ (name "python-mypy")
+ (version "0.700")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "mypy" version))
+ (sha256
+ (base32
+ "1zxfi5s9hxrz0hbaj4n513az17l44pxl80r62ipjc0bsmbcic2xi"))))
+ (build-system python-build-system)
+ ;; FIXME: mypy issue #5562, requires pytest
+ (arguments '(#:tests? #f))
+ (propagated-inputs
+ `(("python-mypy-extensions" ,python-mypy-extensions)
+ ("python-typed-ast" ,python-typed-ast)
+ ("python-psutil" ,python-psutil)))
+ (home-page "http://www.mypy-lang.org/")
+ (synopsis "Optional static typing for Python (mypyc-compiled version)")
+ (description "Add type annotations to your Python programs, and use mypy to type check
+them. Mypy is essentially a Python linter on steroids, and it can catch many programming
+errors by analyzing your program, without actually having to run it. Mypy has a powerful
+type system with features such as type inference, gradual typing, generics and union
+types.")
+ (license license:expat)))
--
2.21.0
W
W
wednesday wrote on 30 Apr 2019 17:29
[PATCH v2 1/3] gnu: Add python-typed-ast
(address . 35193@debbugs.gnu.org)(name . wednesday)(address . jessejohngildersleve@zohomail.eu)
20190430152914.13616-2-jessejohngildersleve@zohomail.eu
* gnu/packages/python-xyz.scm (python-typed-ast): New public variable.
---
gnu/packages/python-xyz.scm | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

Toggle diff (40 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 35147ebfa7..79271f0e41 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -59,6 +59,7 @@
;;; Copyright © 2018 Vagrant Cascadian <vagrant@debian.org>
;;; Copyright © 2019 Brett Gilio <brettg@posteo.net>
;;; Copyright © 2019 Sam <smbaines8@gmail.com>
+;;; Copyright © 2019 Jesse John Gildersleve <jessejohngildersleve@zohomail.eu>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -15630,3 +15631,25 @@ processes may share the same data.")
(description "A Sphinx extension to convert SVG images to PDF in case the builder does not support
SVG images natively (e.g. LaTeX).")
(license license:bsd-3)))
+
+(define-public python-typed-ast
+ (package
+ (name "python-typed-ast")
+ (version "1.3.5")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "typed-ast" version))
+ (sha256
+ (base32
+ "1m7pr6qpana3cvqwiw7mlvrgvmw27ch5mx1592572xhlki8g85ak"))))
+ (build-system python-build-system)
+ (home-page "https://github.com/python/typed_ast")
+ (synopsis "Fork of Python 2 and 3 ast modules with type comment support")
+ (description "Typed_ast is a Python 3 package that provides a Python 2.7 and
+Python 3 parser similar to the standard ast library. Unlike ast, the parsers in
+typed_ast include PEP 484 type comments and are independent of the version of Python
+under which they are run. The typed_ast parsers produce the standard Python AST
+(plus type comments), and are both fast and correct, as they are based on the
+CPython 2.7 and 3.6 parsers.")
+ (license license:asl2.0)))
--
2.21.0
W
W
wednesday wrote on 30 Apr 2019 17:29
[PATCH v2 0/3] Updating and fixing mypy packages
(address . 35193@debbugs.gnu.org)(name . wednesday)(address . jessejohngildersleve@zohomail.eu)
20190430152914.13616-1-jessejohngildersleve@zohomail.eu
In these patches I updated the packages related to mypy, as well as mypy.
In addition to that I fixed an issue with python-mypy-extensions that was
causing mypy to fail when checking python3.

Also these patches were formatted and sent with git send-email, unlike
the other ones, so hopefully you'll have an easier time applying them.

wednesday (3):
gnu: Add python-typed-ast
gnu: Add python-mypy-extensions
gnu: Add python-mypy

gnu/packages/python-xyz.scm | 76 +++++++++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)

--
2.21.0
W
W
wednesday wrote on 30 Apr 2019 17:29
[PATCH v2 2/3] gnu: Add python-mypy-extensions
(address . 35193@debbugs.gnu.org)(name . wednesday)(address . jessejohngildersleve@zohomail.eu)
20190430152914.13616-3-jessejohngildersleve@zohomail.eu
* gnu/packages/python-xyz.scm (python-mypy-extensions,
python2-mypy-extensions): New public variables.
---
gnu/packages/python-xyz.scm | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)

Toggle diff (36 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 79271f0e41..01c065fc83 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -15653,3 +15653,29 @@ under which they are run. The typed_ast parsers produce the standard Python AST
(plus type comments), and are both fast and correct, as they are based on the
CPython 2.7 and 3.6 parsers.")
(license license:asl2.0)))
+
+(define-public python-mypy-extensions
+ (package
+ (name "python-mypy-extensions")
+ (version "0.4.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "mypy_extensions" version))
+ (sha256
+ (base32
+ "04h8brrbbx151dfa2cvvlnxgmb5wa00mhd2z7nd20s8kyibfkq1p"))))
+ (build-system python-build-system)
+ (home-page "http://www.mypy-lang.org/")
+ (synopsis "Experimental type system extensions for programs checked with mypy")
+ (description "The @code{mypy_extensions} module defines experimental extensions to the
+standard @code{typing} module that are supported by the mypy typechecker.")
+ (license license:expat)))
+
+(define-public python2-mypy-extensions
+ (let ((mypy (package-with-python2
+ (strip-python2-variant python-mypy-extensions))))
+ (package (inherit mypy)
+ (propagated-inputs
+ `(("python2-typing" ,python2-typing)
+ ,@(package-propagated-inputs mypy))))))
--
2.21.0
W
W
wednesday wrote on 30 Apr 2019 17:29
[PATCH v2 3/3] gnu: Add python-mypy
(address . 35193@debbugs.gnu.org)(name . wednesday)(address . jessejohngildersleve@zohomail.eu)
20190430152914.13616-4-jessejohngildersleve@zohomail.eu
* gnu/packages/python-xyz.scm (python-mypy): New public variable.
---
gnu/packages/python-xyz.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

Toggle diff (37 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 01c065fc83..c528d2849d 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -15679,3 +15679,30 @@ standard @code{typing} module that are supported by the mypy typechecker.")
(propagated-inputs
`(("python2-typing" ,python2-typing)
,@(package-propagated-inputs mypy))))))
+
+(define-public python-mypy
+ (package
+ (name "python-mypy")
+ (version "0.701")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "mypy" version))
+ (sha256
+ (base32
+ "05479r3gbq17r22hyhxjg49smx5q864pgx8ayy23rsdj4w6z2r2p"))))
+ (build-system python-build-system)
+ ;; FIXME: tests freeze at 80%
+ (arguments '(#:tests? #f))
+ (propagated-inputs
+ `(("python-mypy-extensions" ,python-mypy-extensions)
+ ("python-typed-ast" ,python-typed-ast)
+ ("python-psutil" ,python-psutil)))
+ (home-page "http://www.mypy-lang.org/")
+ (synopsis "Optional static typing for Python 3 and 2 (PEP 484)")
+ (description "Add type annotations to your Python programs, and use mypy to type check
+them. Mypy is essentially a Python linter on steroids, and it can catch many programming
+errors by analyzing your program, without actually having to run it. Mypy has a powerful
+type system with features such as type inference, gradual typing, generics and union
+types.")
+ (license license:expat)))
--
2.21.0
S
S
swedebugia wrote on 27 Jun 2019 16:11
(address . guix-patches@gnu.org)
74772c08-9903-6e23-357c-5928517ca53f@riseup.net
On 2019-04-30 17:29, wednesday wrote:
Toggle quote (28 lines)
> * gnu/packages/python-xyz.scm (python-mypy): New public variable.
> ---
> gnu/packages/python-xyz.scm | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
> index 01c065fc83..c528d2849d 100644
> --- a/gnu/packages/python-xyz.scm
> +++ b/gnu/packages/python-xyz.scm
> @@ -15679,3 +15679,30 @@ standard @code{typing} module that are supported by the mypy typechecker.")
> (propagated-inputs
> `(("python2-typing" ,python2-typing)
> ,@(package-propagated-inputs mypy))))))
> +
> +(define-public python-mypy
> + (package
> + (name "python-mypy")
> + (version "0.701")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (pypi-uri "mypy" version))
> + (sha256
> + (base32
> + "05479r3gbq17r22hyhxjg49smx5q864pgx8ayy23rsdj4w6z2r2p"))))
> + (build-system python-build-system)
> + ;; FIXME: tests freeze at 80%

We really would like to understand why these fail and mitigate if possible.

Have you reported this upstream?

Toggle quote (10 lines)
> + (arguments '(#:tests? #f))
> + (propagated-inputs
> + `(("python-mypy-extensions" ,python-mypy-extensions)
> + ("python-typed-ast" ,python-typed-ast)
> + ("python-psutil" ,python-psutil)))
> + (home-page "http://www.mypy-lang.org/")
> + (synopsis "Optional static typing for Python 3 and 2 (PEP 484)")
> + (description "Add type annotations to your Python programs, and use mypy to type check
> +them.

This phrase is a little eh weird. Could you rephrase to something like
"Mypy checks type annotations..." or "Mypy is a ..."?

Toggle quote (7 lines)
> Mypy is essentially a Python linter on steroids, and it can catch many programming
> +errors by analyzing your program, without actually having to run it. Mypy has a powerful
> +type system with features such as type inference, gradual typing, generics and union
> +types.")
> + (license license:expat)))


The LICENSE file contains this: "Portions of mypy are licensed under
different licenses. The files under stdlib-samples are licensed under
the PSF 2 License, reproduced below."

Could you update the patch when you get an answer from upstream?

Thanks for the patch. :)

--
Cheers Swedebugia
M
M
Maxim Cournoyer wrote on 3 Apr 2021 05:20
Re: bug#35193: [PATCH 0/3] Add python-mypy and required packages
(name . wednesday)(address . jessejohngildersleve@zohomail.eu)
87o8ewqcju.fsf_-_@gmail.com
Hi!

swedebugia <swedebugia@riseup.net> writes:

Toggle quote (61 lines)
> On 2019-04-30 17:29, wednesday wrote:
>> * gnu/packages/python-xyz.scm (python-mypy): New public variable.
>> ---
>> gnu/packages/python-xyz.scm | 27 +++++++++++++++++++++++++++
>> 1 file changed, 27 insertions(+)
>> diff --git a/gnu/packages/python-xyz.scm
>> b/gnu/packages/python-xyz.scm
>> index 01c065fc83..c528d2849d 100644
>> --- a/gnu/packages/python-xyz.scm
>> +++ b/gnu/packages/python-xyz.scm
>> @@ -15679,3 +15679,30 @@ standard @code{typing} module that are supported by the mypy typechecker.")
>> (propagated-inputs
>> `(("python2-typing" ,python2-typing)
>> ,@(package-propagated-inputs mypy))))))
>> +
>> +(define-public python-mypy
>> + (package
>> + (name "python-mypy")
>> + (version "0.701")
>> + (source
>> + (origin
>> + (method url-fetch)
>> + (uri (pypi-uri "mypy" version))
>> + (sha256
>> + (base32
>> + "05479r3gbq17r22hyhxjg49smx5q864pgx8ayy23rsdj4w6z2r2p"))))
>> + (build-system python-build-system)
>> + ;; FIXME: tests freeze at 80%
>
> We really would like to understand why these fail and mitigate if possible.
>
> Have you reported this upstream?
>
>> + (arguments '(#:tests? #f))
>> + (propagated-inputs
>> + `(("python-mypy-extensions" ,python-mypy-extensions)
>> + ("python-typed-ast" ,python-typed-ast)
>> + ("python-psutil" ,python-psutil)))
>> + (home-page "http://www.mypy-lang.org/")
>> + (synopsis "Optional static typing for Python 3 and 2 (PEP 484)")
>> + (description "Add type annotations to your Python programs, and use mypy to type check
>> +them.
>
> This phrase is a little eh weird. Could you rephrase to something like
> "Mypy checks type annotations..." or "Mypy is a ..."?
>
>> Mypy is essentially a Python linter on steroids, and it can catch many programming
>> +errors by analyzing your program, without actually having to run it. Mypy has a powerful
>> +type system with features such as type inference, gradual typing, generics and union
>> +types.")
>> + (license license:expat)))
>
>
> The LICENSE file contains this: "Portions of mypy are licensed under
> different licenses. The files under stdlib-samples are licensed under
> the PSF 2 License, reproduced below."
>
> Could you update the patch when you get an answer from upstream?
>
> Thanks for the patch. :)

It seems python-mypy and the required dependencies were merged (last
year) from another contributor that probably had failed to notice about
them here. Thank you nonetheless, and thanks to swedebugia for the
review!

Closing.

Maxim
Closed
?