diff mbox series

[bug#42465,10/10] gnu: Add python-mypy.

Message ID 20200721115633.6088-10-tanguy@bioneland.org
State Accepted
Headers show
Series gnu: Add python-mypy. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job

Commit Message

Tanguy LE CARROUR July 21, 2020, 11:56 a.m. UTC
* gnu/packages/python-check.scm (python-mypy): New variable.
---
 gnu/packages/python-check.scm | 51 +++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

Comments

Marius Bakke July 25, 2020, 4:18 p.m. UTC | #1
Tanguy Le Carrour <tanguy@bioneland.org> writes:

> * gnu/packages/python-check.scm (python-mypy): New variable.

Neat!  I only recently learned about MyPy, good to have it in Guix.

> +(define-public python-mypy
> +  (package
> +    (name "python-mypy")
> +    (version "0.782")
> +    (source
> +      (origin
> +        (method url-fetch)
> +        (uri (pypi-uri "mypy" version))
> +        (sha256
> +         (base32
> +          "030kn709515452n6gy2i1d9fg6fyrkmdz228lfpmbslybsld9xzg"))))
> +    (build-system python-build-system)
> +    (arguments
> +     `(#:phases
> +       (modify-phases %standard-phases
> +         (replace 'check
> +           (lambda _
> +             (invoke "./runtests.py")
> +             #t)))))
> +    (native-inputs
> +     `(("python-attrs" ,python-attrs)
> +       ("python-flake8" ,python-flake8)
> +       ("python-flake8-bugbear" ,python-flake8-bugbear)
> +       ("python-flake8-pyi" ,python-flake8-pyi)
> +       ("python-importlib-metadata" ,python-importlib-metadata)
> +       ("python-lxml" ,python-lxml)
> +       ("python-psutil" ,python-psutil)
> +       ("python-py" ,python-py)
> +       ("python-pytest" ,python-pytest)
> +       ("python-pytest-cov" ,python-pytest-cov)
> +       ("python-pytest-forked" ,python-pytest-forked)
> +       ("python-pytest-xdist" ,python-pytest-xdist)
> +       ("python-setuptools" ,python-setuptools)
> +       ("python-virtualenv" ,python-virtualenv)))
> +    (propagated-inputs
> +     `(("python-mypy-extensions" ,python-mypy-extensions)
> +       ("python-typing-extensions" ,python-typing-extensions)
> +       ("python-typed-ast" ,python-typed-ast)))
> +    (home-page "http://www.mypy-lang.org/")
> +    (synopsis "Optional static type checker for Python")

Perhaps s/Optional//?  I mean, if it was mandatory, wouldn't it be part
of cpython?  :-P  Probably I'm missing something, I see upstream uses
optional too.

Anyway, LGTM, nice work!
Tanguy LE CARROUR July 27, 2020, 7:57 a.m. UTC | #2
Hi Marius,

The emails that will follow contain the updated patch set.
I think I've addressed all the problems you reported. Thanks again!
There are two things that I'll changed:

- `python-flake8-bugbear`: I've disabled a test that fails on slow
  computers like mine. Was it the proper thing to do?!
- `python-hypothesmith` now uses `python-hypothesis-5.23` even though
  `python-flake8-bugbear` still uses `python-hypothesis`.

Just to make sure, I'll sum up your comments below.

* [PATCH 02/10] gnu: python-hypothesis: Update to 5.20.0.
> This can not be applied on 'master' because Hypothesis has 6261
> dependent packages. […] you can add a different variable with the new
> hypothesis.

Done! I've updated it to 5.23.0.

* [PATCH 03/10] gnu: Add python-mypy-extensions.
* [PATCH 04/10] gnu: Add python-typing-inspect.
* [PATCH 05/10] gnu: Add python-libcst.
* [PATCH 06/10] gnu: Add python-lark-parser.
* [PATCH 07/10] gnu: Add python-hypothesmith.

Thanks for all your helpful comments regarding synopsis and description.
I'd have accepted a global "run the f@#*!g linter", though! :-)
To be honest, I'm not yet comfortable with editing the info I get from
a project's page, so I mostly copy/paste… which, I know, is bad! I'll
work on that!

* [PATCH 08/10] gnu: Add python-flake8-bugbear.
> I realize now that hypothesmith is probably a hypothesis plugin?
> In that case it should not propagate hypothesis IMO.

Unfortunately, it does not build if I drop it.

* [PATCH 09/10] gnu: Add python-flake8-pyi.
> No punctuation or article (you probably got that by now). :-)

Yeah, I think I'm starting to see where you're going with this! :-D

* [PATCH 10/10] gnu: Add python-mypy.
> Perhaps s/Optional//?  I mean, if it was mandatory, wouldn't it be part
> of cpython?

Removed!

I've built, installed and tested MyPy successfully! Thanks again for
your help!
Marius Bakke July 29, 2020, 10:20 p.m. UTC | #3
Tanguy Le Carrour <tanguy@bioneland.org> writes:

> Hi Marius,
>
> The emails that will follow contain the updated patch set.
> I think I've addressed all the problems you reported. Thanks again!
> There are two things that I'll changed:
>
> - `python-flake8-bugbear`: I've disabled a test that fails on slow
>   computers like mine. Was it the proper thing to do?!
> - `python-hypothesmith` now uses `python-hypothesis-5.23` even though
>   `python-flake8-bugbear` still uses `python-hypothesis`.
>
> Just to make sure, I'll sum up your comments below.
>
> * [PATCH 02/10] gnu: python-hypothesis: Update to 5.20.0.
>> This can not be applied on 'master' because Hypothesis has 6261
>> dependent packages. […] you can add a different variable with the new
>> hypothesis.
>
> Done! I've updated it to 5.23.0.

Great.  :-)

> * [PATCH 03/10] gnu: Add python-mypy-extensions.
> * [PATCH 04/10] gnu: Add python-typing-inspect.
> * [PATCH 05/10] gnu: Add python-libcst.
> * [PATCH 06/10] gnu: Add python-lark-parser.
> * [PATCH 07/10] gnu: Add python-hypothesmith.
>
> Thanks for all your helpful comments regarding synopsis and description.
> I'd have accepted a global "run the f@#*!g linter", though! :-)

Heheh.  I have become linter.  

> To be honest, I'm not yet comfortable with editing the info I get from
> a project's page, so I mostly copy/paste… which, I know, is bad! I'll
> work on that!

I find it is often the most difficult part of packaging.  How to convey
[upstream description] in [neutral language for noob].  Occasionally
I'll peek at Debians description which are typically pretty good (but
don't tell anyone!).

> * [PATCH 08/10] gnu: Add python-flake8-bugbear.
>> I realize now that hypothesmith is probably a hypothesis plugin?
>> In that case it should not propagate hypothesis IMO.
>
> Unfortunately, it does not build if I drop it.

Ah right, I was not entirely clear.  I meant the Hypothesis input should
probably be native (for tests), but not propagated so that other
packages could use it with other Hypothesis versions.  Making plugin
packages not propagate the package they "plug in to" is a favorite
nit-pick of mine, often causing great confusion...

This case is complicated since Hypothesmith depends on a newer version
of Hypothesis, maybe the plugin only works with that newer version?  In
which case propagating makes a lot of sense.  Anyway it's not a big deal
either way, so let's not go there.  :-)

> * [PATCH 09/10] gnu: Add python-flake8-pyi.
>> No punctuation or article (you probably got that by now). :-)
>
> Yeah, I think I'm starting to see where you're going with this! :-D
>
> * [PATCH 10/10] gnu: Add python-mypy.
>> Perhaps s/Optional//?  I mean, if it was mandatory, wouldn't it be part
>> of cpython?
>
> Removed!
>
> I've built, installed and tested MyPy successfully! Thanks again for
> your help!

Awesome, I applied the series as-is.  Thanks for your work!
Tanguy LE CARROUR July 30, 2020, 6:36 a.m. UTC | #4
Le 07/30, Marius Bakke a écrit :
> Tanguy Le Carrour <tanguy@bioneland.org> writes:
> > […]
> > To be honest, I'm not yet comfortable with editing the info I get from
> > a project's page, so I mostly copy/paste… which, I know, is bad! I'll
> > work on that!
> 
> I find it is often the most difficult part of packaging.  How to convey
> [upstream description] in [neutral language for noob].  Occasionally
> I'll peek at Debians description which are typically pretty good (but
> don't tell anyone!).

I promise I won't tell anyone! This will stay between you, me and the internet! ;-)


> > * [PATCH 08/10] gnu: Add python-flake8-bugbear.
> >> I realize now that hypothesmith is probably a hypothesis plugin?
> >> In that case it should not propagate hypothesis IMO.
> >
> > Unfortunately, it does not build if I drop it.
> 
> Ah right, I was not entirely clear.  I meant the Hypothesis input should
> probably be native (for tests), but not propagated so that other
> packages could use it with other Hypothesis versions.  Making plugin
> packages not propagate the package they "plug in to" is a favorite
> nit-pick of mine, often causing great confusion...
> 
> This case is complicated since Hypothesmith depends on a newer version
> of Hypothesis, maybe the plugin only works with that newer version?  In
> which case propagating makes a lot of sense.  Anyway it's not a big deal
> either way, so let's not go there.  :-)

I'll keep that for later! I think I have to sleep on the idea… several
nights! ^_^'


> > I've built, installed and tested MyPy successfully! Thanks again for
> > your help!
> 
> Awesome, I applied the series as-is.  Thanks for your work!

Thanks!!
diff mbox series

Patch

diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm
index 89137b515d..ea26282074 100644
--- a/gnu/packages/python-check.scm
+++ b/gnu/packages/python-check.scm
@@ -30,6 +30,7 @@ 
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages web)
+  #:use-module (gnu packages xml)
   #:use-module (guix utils)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
@@ -474,3 +475,53 @@  Python software under test, when they make an HTTP query.")
     (description "The @code{python-mypy-extensions} module defines experimental
 extensions to the standard 'typing' module that are supported by the mypy typechecker.")
     (license license:expat)))
+
+(define-public python-mypy
+  (package
+    (name "python-mypy")
+    (version "0.782")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "mypy" version))
+        (sha256
+         (base32
+          "030kn709515452n6gy2i1d9fg6fyrkmdz228lfpmbslybsld9xzg"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             (invoke "./runtests.py")
+             #t)))))
+    (native-inputs
+     `(("python-attrs" ,python-attrs)
+       ("python-flake8" ,python-flake8)
+       ("python-flake8-bugbear" ,python-flake8-bugbear)
+       ("python-flake8-pyi" ,python-flake8-pyi)
+       ("python-importlib-metadata" ,python-importlib-metadata)
+       ("python-lxml" ,python-lxml)
+       ("python-psutil" ,python-psutil)
+       ("python-py" ,python-py)
+       ("python-pytest" ,python-pytest)
+       ("python-pytest-cov" ,python-pytest-cov)
+       ("python-pytest-forked" ,python-pytest-forked)
+       ("python-pytest-xdist" ,python-pytest-xdist)
+       ("python-setuptools" ,python-setuptools)
+       ("python-virtualenv" ,python-virtualenv)))
+    (propagated-inputs
+     `(("python-mypy-extensions" ,python-mypy-extensions)
+       ("python-typing-extensions" ,python-typing-extensions)
+       ("python-typed-ast" ,python-typed-ast)))
+    (home-page "http://www.mypy-lang.org/")
+    (synopsis "Optional static type checker for Python")
+    (description "Mypy is an optional static type checker for Python that aims
+to combine the benefits of dynamic (or 'duck') typing and static typing.  Mypy combines
+the expressive power and convenience of Python with a powerful type system and
+compile-time type checking.  Mypy type checks standard Python programs; run them using
+any Python VM with basically no runtime overhead.")
+    ;; Most of the code is under MIT license; Some files are under Python Software
+    ;; Foundation License version 2: stdlib-samples/*, mypyc/lib-rt/pythonsupport.h and
+    ;; mypyc/lib-rt/getargs.c
+    (license (list license:expat license:psfl))))