1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 tree-sitter,
7 pytestCheckHook,
8 nix-update-script,
9}:
10
11buildPythonPackage rec {
12 pname = "tree-sitter-markdown";
13 # only update to the latest version on PyPI
14 version = "0.5.0";
15 pyproject = true;
16
17 src = fetchFromGitHub {
18 owner = "tree-sitter-grammars";
19 repo = "tree-sitter-markdown";
20 tag = "v${version}";
21 hash = "sha256-I9KDE1yZce8KIGPLG5tmv5r/NCWwN95R6fIyvGdx+So=";
22 };
23
24 build-system = [
25 setuptools
26 ];
27
28 optional-dependencies = {
29 core = [
30 tree-sitter
31 ];
32 };
33
34 pythonImportsCheck = [ "tree_sitter_markdown" ];
35
36 nativeCheckInputs = [
37 pytestCheckHook
38 tree-sitter
39 ];
40
41 passthru.updateScript = nix-update-script {
42 extraArgs = [
43 # later versions have incompatible changes, pin it to the latest on PyPI
44 # reverse-dependencies also pull packages from PyPI, see:
45 # https://github.com/Textualize/textual/issues/5868
46 "--version=0.3.2"
47 ];
48 };
49
50 meta = {
51 description = "Markdown grammar for tree-sitter";
52 homepage = "https://github.com/tree-sitter-grammars/tree-sitter-markdown";
53 changelog = "https://github.com/tree-sitter-grammars/tree-sitter-markdown/releases/tag/${src.tag}";
54 license = lib.licenses.mit;
55 maintainers = with lib.maintainers; [
56 GaetanLepage
57 gepbird
58 ];
59 };
60}