diff mbox series

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

Message ID 20200721115633.6088-5-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 success View Laminar job

Commit Message

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

Comments

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

> * gnu/packages/python-xyz.scm (python-libcst): New variable.

[...]
  
> +(define-public python-libcst
> +  (package
> +    (name "python-libcst")
> +    (version "0.3.7")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (pypi-uri "libcst" version))
> +              (sha256
> +               (base32
> +                "1wfd5m9jhk5x2qpz29pjhm9ypp5h3nlbk6xv4vzn4f45xdf5bv9x"))))
> +    (build-system python-build-system)
> +    (arguments
> +     `(#:phases
> +       (modify-phases %standard-phases
> +         (add-after 'unpack 'remove-failing-tests
> +           (lambda _
> +             ;; Reported upstream: <https://github.com/Instagram/LibCST/issues/346>.
> +             (delete-file "libcst/tests/test_fuzz.py")
> +             ;; Reported upstream: <https://github.com/Instagram/LibCST/issues/347>.
> +             (delete-file "libcst/tests/test_pyre_integration.py")
> +             (delete-file "libcst/codemod/tests/test_codemod_cli.py")
> +             (delete-file "libcst/metadata/tests/test_full_repo_manager.py")
> +             (delete-file "libcst/metadata/tests/test_type_inference_provider.py")
> +             #t))
> +         (replace 'check
> +           (lambda _
> +             (setenv "PYTHONPATH" (string-append (getcwd) ":" (getenv "PYTHONPATH")))
> +             (invoke "python" "-m" "libcst.codegen.generate" "visitors")
> +             (invoke "python" "-m" "libcst.codegen.generate" "return_types")
> +             (invoke "python" "-m" "unittest")
> +             #t)))))

Nice.  :-)

> +    (native-inputs
> +     `(("python-black" ,python-black)
> +       ("python-hypothesis" ,python-hypothesis)
> +       ("python-isort" ,python-isort)))
> +    (propagated-inputs
> +     `(("python-typing-extensions" ,python-typing-extensions)
> +       ("python-typing-inspect" ,python-typing-inspect)
> +       ("python-pyyaml" ,python-pyyaml)))
> +    (home-page "https://github.com/Instagram/LibCST")
> +    (synopsis "A Concrete Syntax Tree (CST) parser and serializer library for Python")

No article in the start of synopsis (guix lint will warn about this).
So this becomes: "Concrete Syntax Tree (CST) parser and serializer
library for Python".

> +    (description
> +     "LibCST parses Python 3.0, 3.1, 3.3, 3.5, 3.6, 3.7 or 3.8 source code as a CST tree
> +that keeps all formatting details (comments, whitespaces, parentheses, etc).  It's useful
> +for building automated refactoring (codemod) applications and linters.  LibCST creates
> +a compromise between an Abstract Syntax Tree (AST) and a traditional Concrete Syntax
> +Tree (CST).  By carefully reorganizing and naming node types and fields, we've created
> +a lossless CST that looks and feels like an AST.")

Maybe the versions can be omitted so we don't have to update the
description for every update.  Also, the "we've created" sentence feels
weird, maybe s/we've created/LibCST creates/ ?

> +    (license (list license:expat
> +                   ;; Some files unde libcst/_parser/ are under Python Software
> +                   ;; Foundation license (see LICENSE file for details)
> +                   license:psfl
> +                   ;; libcst/_add_slots.py
> +                   license:asl2.0))))

Great!  :-)
diff mbox series

Patch

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 2293a16ecc..6b462a42f0 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -12274,6 +12274,61 @@  in Python.  It allows you to declare the libraries your project depends on and
 it will manage (install/update) them for you.")
     (license license:expat)))
 
+(define-public python-libcst
+  (package
+    (name "python-libcst")
+    (version "0.3.7")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "libcst" version))
+              (sha256
+               (base32
+                "1wfd5m9jhk5x2qpz29pjhm9ypp5h3nlbk6xv4vzn4f45xdf5bv9x"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'remove-failing-tests
+           (lambda _
+             ;; Reported upstream: <https://github.com/Instagram/LibCST/issues/346>.
+             (delete-file "libcst/tests/test_fuzz.py")
+             ;; Reported upstream: <https://github.com/Instagram/LibCST/issues/347>.
+             (delete-file "libcst/tests/test_pyre_integration.py")
+             (delete-file "libcst/codemod/tests/test_codemod_cli.py")
+             (delete-file "libcst/metadata/tests/test_full_repo_manager.py")
+             (delete-file "libcst/metadata/tests/test_type_inference_provider.py")
+             #t))
+         (replace 'check
+           (lambda _
+             (setenv "PYTHONPATH" (string-append (getcwd) ":" (getenv "PYTHONPATH")))
+             (invoke "python" "-m" "libcst.codegen.generate" "visitors")
+             (invoke "python" "-m" "libcst.codegen.generate" "return_types")
+             (invoke "python" "-m" "unittest")
+             #t)))))
+    (native-inputs
+     `(("python-black" ,python-black)
+       ("python-hypothesis" ,python-hypothesis)
+       ("python-isort" ,python-isort)))
+    (propagated-inputs
+     `(("python-typing-extensions" ,python-typing-extensions)
+       ("python-typing-inspect" ,python-typing-inspect)
+       ("python-pyyaml" ,python-pyyaml)))
+    (home-page "https://github.com/Instagram/LibCST")
+    (synopsis "A Concrete Syntax Tree (CST) parser and serializer library for Python")
+    (description
+     "LibCST parses Python 3.0, 3.1, 3.3, 3.5, 3.6, 3.7 or 3.8 source code as a CST tree
+that keeps all formatting details (comments, whitespaces, parentheses, etc).  It's useful
+for building automated refactoring (codemod) applications and linters.  LibCST creates
+a compromise between an Abstract Syntax Tree (AST) and a traditional Concrete Syntax
+Tree (CST).  By carefully reorganizing and naming node types and fields, we've created
+a lossless CST that looks and feels like an AST.")
+    (license (list license:expat
+                   ;; Some files unde libcst/_parser/ are under Python Software
+                   ;; Foundation license (see LICENSE file for details)
+                   license:psfl
+                   ;; libcst/_add_slots.py
+                   license:asl2.0))))
+
 (define-public python-typing-inspect
   (package
     (name "python-typing-inspect")