diff options
author | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2022-06-25 00:21:00 -0400 |
---|---|---|
committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2022-06-26 22:10:40 -0400 |
commit | ddb8635e5af4a44887e032d7df3c8914709e7a8b (patch) | |
tree | 3178d31f807edb0afe8c7ea8b0794e21bfe664b1 /gnu | |
parent | 76de731b4ba89884d7792e87f9feb63474c9a260 (diff) | |
download | guix-ddb8635e5af4a44887e032d7df3c8914709e7a8b.tar.gz |
gnu: Add python-cattrs.
* gnu/packages/python-xyz.scm (python-cattrs): New variable.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/packages/python-xyz.scm | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 8cb9cb4c6a..1d43049776 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -16545,6 +16545,73 @@ smaller. Small integers are encoded into a single byte, and typical short strings require only one extra byte in addition to the strings themselves.") (license license:asl2.0))) +(define-public python-cattrs + (package + (name "python-cattrs") + (version "22.1.0") + (source (origin + (method git-fetch) ;for tests + (uri (git-reference + (url "https://github.com/python-attrs/cattrs") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1n0h25gj6zd02kqyl040xpdvg4hpy1j92716sz0rg019xjqqijqb")))) + (build-system python-build-system) + (arguments + (list + #:phases + #~(modify-phases %standard-phases + ;; XXX: PEP 517 manual build copied from python-isort. + (add-after 'unpack 'adjust-for-older-attrs + ;; Our older attrs package is using the 'attr' rather than 'attrs' + ;; namespace. + ;; TODO: Remove after python-attrs is updated to >= 21.4.0. + (lambda _ + (substitute* (find-files "." "\\.py$") + (("from attrs\\b") + "from attr")))) + (replace 'build + (lambda _ + (invoke "python" "-m" "build" "--wheel" "--no-isolation" "."))) + (replace 'install + (lambda _ + (let ((whl (car (find-files "dist" "\\.whl$")))) + (invoke "pip" "--no-cache-dir" "--no-input" + "install" "--no-deps" "--prefix" #$output whl)))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + ;; Do not use the 'pytest' binary as it hard-codes an older + ;; python-hypothesis version near the beginning of its + ;; GUIX_PYTHONPATH. + (invoke "python" "-m" "pytest" "-vv" "-c" "/dev/null" "tests" + "-n" (number->string (parallel-job-count)) + ;; This test requires orjson, which needs the maturin + ;; build system and new Rust dependencies. + "--ignore" "tests/test_preconf.py"))))))) + (native-inputs + (list python-hypothesis-next + python-immutables + python-msgpack + python-poetry-core + python-pymongo ;for the bson module + python-pypa-build + python-pytest + python-pytest-xdist)) + (propagated-inputs + (list python-attrs + python-exceptiongroup + python-typing-extensions)) + (home-page "https://github.com/python-attrs/cattrs") + (synopsis "Python library for structuring and unstructuring data") + (description "@code{cattrs} is an Python library for structuring and +unstructuring data. @code{cattrs} works best with @code{attrs} classes, +@code{dataclasses} and the usual Python collections, but other kinds of +classes can also be supported by manually registering converters.") + (license license:expat))) + (define-public python-cachy (package (name "python-cachy") |