nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 attrs,
6 coverage,
7 furo,
8 ipython,
9 msgpack,
10 mypy,
11 pre-commit,
12 pyright,
13 pytest,
14 pyyaml,
15 setuptools,
16 setuptools-scm,
17 sphinx,
18 sphinx-copybutton,
19 sphinx-design,
20 tomli-w,
21}:
22
23buildPythonPackage rec {
24 pname = "msgspec";
25 version = "0.20.0";
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "jcrist";
30 repo = "msgspec";
31 tag = version;
32 # Note that this hash changes after some time after release because they
33 # use `$Format:%d$` in msgspec/_version.py, and GitHub produces different
34 # tarballs depending on whether tagged commit is the last commit, see
35 # https://github.com/NixOS/nixpkgs/issues/84312
36 hash = "sha256-DWDmnSuo12oXl9NVfNhIOtWrQeJ9DMmHxOyHY33Datk=";
37 };
38
39 build-system = [
40 setuptools
41 setuptools-scm
42 ];
43
44 optional-dependencies = {
45 dev = [
46 coverage
47 mypy
48 pre-commit
49 pyright
50 ]
51 ++ optional-dependencies.doc
52 ++ optional-dependencies.test;
53 doc = [
54 furo
55 ipython
56 sphinx
57 sphinx-copybutton
58 sphinx-design
59 ];
60 test = [
61 attrs
62 msgpack
63 pytest
64 ]
65 ++ optional-dependencies.yaml
66 ++ optional-dependencies.toml;
67 toml = [ tomli-w ];
68 yaml = [ pyyaml ];
69 };
70
71 # Requires libasan to be accessible
72 doCheck = false;
73
74 pythonImportsCheck = [ "msgspec" ];
75
76 meta = {
77 description = "Module to handle JSON/MessagePack";
78 homepage = "https://github.com/jcrist/msgspec";
79 changelog = "https://github.com/jcrist/msgspec/releases/tag/${src.tag}";
80 license = lib.licenses.bsd3;
81 maintainers = with lib.maintainers; [ fab ];
82 };
83}