heatmap_cli 0.22.36__tar.gz → 0.22.37__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. {heatmap_cli-0.22.36/src/heatmap_cli.egg-info → heatmap_cli-0.22.37}/PKG-INFO +1 -1
  2. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/pyproject.toml +1 -1
  3. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37/src/heatmap_cli.egg-info}/PKG-INFO +1 -1
  4. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/src/heatmap_cli.egg-info/SOURCES.txt +5 -0
  5. heatmap_cli-0.22.37/tests/test_animate_no_frames.py +63 -0
  6. heatmap_cli-0.22.37/tests/test_animate_open.py +64 -0
  7. heatmap_cli-0.22.37/tests/test_heatmap_open.py +46 -0
  8. heatmap_cli-0.22.37/tests/test_no_annotate.py +67 -0
  9. heatmap_cli-0.22.37/tests/test_refresh_output_dir.py +45 -0
  10. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/LICENSE.md +0 -0
  11. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/README.md +0 -0
  12. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/setup.cfg +0 -0
  13. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/src/heatmap_cli/__init__.py +0 -0
  14. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/src/heatmap_cli/__main__.py +0 -0
  15. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/src/heatmap_cli/cli.py +0 -0
  16. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/src/heatmap_cli/heatmap.py +0 -0
  17. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/src/heatmap_cli.egg-info/dependency_links.txt +0 -0
  18. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/src/heatmap_cli.egg-info/entry_points.txt +0 -0
  19. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/src/heatmap_cli.egg-info/requires.txt +0 -0
  20. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/src/heatmap_cli.egg-info/top_level.txt +0 -0
  21. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_animate_by_week.py +0 -0
  22. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_annotate_flag.py +0 -0
  23. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_annotation_truncation.py +0 -0
  24. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_cbar_flag.py +0 -0
  25. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_cmap_option.py +0 -0
  26. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_cmax_option.py +0 -0
  27. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_cmin_option.py +0 -0
  28. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_configure_cbar.py +0 -0
  29. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_debug_flag.py +0 -0
  30. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_demo_option.py +0 -0
  31. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_end_date_option.py +0 -0
  32. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_env_flag.py +0 -0
  33. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_heatmap_direct.py +0 -0
  34. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_heatmap_errors.py +0 -0
  35. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_heatmap_utils.py +0 -0
  36. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_heatmap_wrapper.py +0 -0
  37. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_help_flag.py +0 -0
  38. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_open_heatmap.py +0 -0
  39. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_output_dir_option.py +0 -0
  40. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_purge_flag.py +0 -0
  41. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_quiet_flag.py +0 -0
  42. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_start_date_option.py +0 -0
  43. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_title_option.py +0 -0
  44. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_verbose_flag.py +0 -0
  45. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_version_flag.py +0 -0
  46. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_week_option.py +0 -0
  47. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_year_option.py +0 -0
  48. {heatmap_cli-0.22.36 → heatmap_cli-0.22.37}/tests/test_yes_flag.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: heatmap_cli
3
- Version: 0.22.36
3
+ Version: 0.22.37
4
4
  Summary: A console program that generates a yearly calendar heatmap.
5
5
  Author-email: Kian-Meng Ang <kianmeng@cpan.org>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -25,7 +25,7 @@ classifiers = [
25
25
  "Programming Language :: Python",
26
26
  "Topic :: Scientific/Engineering :: Visualization",
27
27
  ]
28
- version = "0.22.36"
28
+ version = "0.22.37"
29
29
  keywords = ["heatmap", "cli", "visualization", "calendar", "data-viz"]
30
30
  dependencies = [
31
31
  "matplotlib",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: heatmap_cli
3
- Version: 0.22.36
3
+ Version: 0.22.37
4
4
  Summary: A console program that generates a yearly calendar heatmap.
5
5
  Author-email: Kian-Meng Ang <kianmeng@cpan.org>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -12,6 +12,8 @@ src/heatmap_cli.egg-info/entry_points.txt
12
12
  src/heatmap_cli.egg-info/requires.txt
13
13
  src/heatmap_cli.egg-info/top_level.txt
14
14
  tests/test_animate_by_week.py
15
+ tests/test_animate_no_frames.py
16
+ tests/test_animate_open.py
15
17
  tests/test_annotate_flag.py
16
18
  tests/test_annotation_truncation.py
17
19
  tests/test_cbar_flag.py
@@ -25,13 +27,16 @@ tests/test_end_date_option.py
25
27
  tests/test_env_flag.py
26
28
  tests/test_heatmap_direct.py
27
29
  tests/test_heatmap_errors.py
30
+ tests/test_heatmap_open.py
28
31
  tests/test_heatmap_utils.py
29
32
  tests/test_heatmap_wrapper.py
30
33
  tests/test_help_flag.py
34
+ tests/test_no_annotate.py
31
35
  tests/test_open_heatmap.py
32
36
  tests/test_output_dir_option.py
33
37
  tests/test_purge_flag.py
34
38
  tests/test_quiet_flag.py
39
+ tests/test_refresh_output_dir.py
35
40
  tests/test_start_date_option.py
36
41
  tests/test_title_option.py
37
42
  tests/test_verbose_flag.py
@@ -0,0 +1,63 @@
1
+ # Copyright (C) 2026 Kian-Meng Ang
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Affero General Public License as published
5
+ # by the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Affero General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Affero General Public License
14
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
+
16
+ import argparse
17
+ from pathlib import Path
18
+ from unittest.mock import patch
19
+
20
+ import pandas as pd
21
+
22
+ from heatmap_cli.heatmap import _generate_animated_heatmap
23
+
24
+
25
+ def test_animated_heatmap_no_frames(tmpdir):
26
+ csv_path = Path(str(tmpdir)) / "test.csv"
27
+ csv_path.write_text(
28
+ "2023-01-01,100\n2023-01-02,200\n2023-01-03,150\n"
29
+ "2023-01-04,300\n2023-01-05,250\n2023-01-06,400\n"
30
+ "2023-01-07,350\n"
31
+ )
32
+
33
+ base_df = pd.read_csv(csv_path, header=None, names=["date", "count"])
34
+ base_df["date"] = pd.to_datetime(base_df["date"])
35
+ base_df["weekday"] = base_df["date"].dt.weekday + 1
36
+ base_df["year"] = base_df["date"].dt.isocalendar().year
37
+ base_df["week"] = (
38
+ base_df["date"].dt.isocalendar().week.astype(str).str.zfill(2)
39
+ )
40
+
41
+ config = argparse.Namespace(
42
+ annotate=False,
43
+ cbar=False,
44
+ cmap_min=None,
45
+ cmap_max=None,
46
+ author="Test Author",
47
+ title=None,
48
+ output_dir=str(tmpdir),
49
+ format="png",
50
+ open=False,
51
+ year=2023,
52
+ week=1,
53
+ start_date=None,
54
+ end_date=None,
55
+ cmap=["vlag"],
56
+ animate_by_week=True,
57
+ )
58
+
59
+ with patch("heatmap_cli.heatmap._generate_heatmap", return_value=None):
60
+ _generate_animated_heatmap(base_df, config)
61
+
62
+ output_files = list(Path(str(tmpdir)).glob("*.gif"))
63
+ assert len(output_files) == 0
@@ -0,0 +1,64 @@
1
+ # Copyright (C) 2026 Kian-Meng Ang
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Affero General Public License as published
5
+ # by the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Affero General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Affero General Public License
14
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
+
16
+ import argparse
17
+ from pathlib import Path
18
+ from unittest.mock import patch
19
+
20
+ import pandas as pd
21
+
22
+ from heatmap_cli.heatmap import _generate_animated_heatmap
23
+
24
+
25
+ def test_animated_heatmap_with_open(tmpdir):
26
+ csv_path = Path(str(tmpdir)) / "test.csv"
27
+ csv_path.write_text(
28
+ "2023-01-01,100\n2023-01-02,200\n2023-01-03,150\n"
29
+ "2023-01-04,300\n2023-01-05,250\n2023-01-06,400\n"
30
+ "2023-01-07,350\n"
31
+ )
32
+
33
+ base_df = pd.read_csv(csv_path, header=None, names=["date", "count"])
34
+ base_df["date"] = pd.to_datetime(base_df["date"])
35
+ base_df["weekday"] = base_df["date"].dt.weekday + 1
36
+ base_df["year"] = base_df["date"].dt.isocalendar().year
37
+ base_df["week"] = (
38
+ base_df["date"].dt.isocalendar().week.astype(str).str.zfill(2)
39
+ )
40
+
41
+ config = argparse.Namespace(
42
+ annotate=False,
43
+ cbar=False,
44
+ cmap_min=None,
45
+ cmap_max=None,
46
+ author="Test Author",
47
+ title=None,
48
+ output_dir=str(tmpdir),
49
+ format="png",
50
+ open=True,
51
+ year=2023,
52
+ week=1,
53
+ start_date=None,
54
+ end_date=None,
55
+ cmap=["vlag"],
56
+ animate_by_week=True,
57
+ )
58
+
59
+ with patch("heatmap_cli.heatmap._open_heatmap") as mocked_open:
60
+ _generate_animated_heatmap(base_df, config)
61
+ mocked_open.assert_called_once()
62
+
63
+ output_files = list(Path(str(tmpdir)).glob("*.gif"))
64
+ assert len(output_files) == 1
@@ -0,0 +1,46 @@
1
+ # Copyright (C) 2026 Kian-Meng Ang
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Affero General Public License as published
5
+ # by the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Affero General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Affero General Public License
14
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
+
16
+ import argparse
17
+ from pathlib import Path
18
+ from unittest.mock import patch
19
+
20
+ import pandas as pd
21
+
22
+ from heatmap_cli.heatmap import _generate_heatmap
23
+
24
+
25
+ def test_generate_heatmap_with_open(tmpdir):
26
+ config = argparse.Namespace(
27
+ annotate=False,
28
+ cbar=False,
29
+ cmap_min=None,
30
+ cmap_max=None,
31
+ author="Test Author",
32
+ title="Test Title",
33
+ output_dir=str(tmpdir),
34
+ format="png",
35
+ open=True,
36
+ )
37
+
38
+ df = pd.DataFrame([[10, 20], [30, 40]], index=[1, 2], columns=["01", "02"])
39
+
40
+ with patch("heatmap_cli.heatmap._open_heatmap") as mocked_open:
41
+ result = _generate_heatmap(1, "vlag", config, df)
42
+ assert result is None
43
+ mocked_open.assert_called_once()
44
+
45
+ output_files = list(Path(str(tmpdir)).glob("*.png"))
46
+ assert len(output_files) >= 1
@@ -0,0 +1,67 @@
1
+ # Copyright (C) 2026 Kian-Meng Ang
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Affero General Public License as published
5
+ # by the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Affero General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Affero General Public License
14
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
+
16
+ import argparse
17
+
18
+ import matplotlib.pyplot as plt
19
+ import pandas as pd
20
+
21
+ from heatmap_cli.heatmap import (
22
+ _configure_heatmap_options,
23
+ _read_and_prepare_data,
24
+ _setup_plot_artists,
25
+ )
26
+
27
+
28
+ def test_read_and_prepare_data_no_annotate(csv_file):
29
+ csv = csv_file("sample.csv")
30
+ config = argparse.Namespace(input_filename=str(csv), annotate=False)
31
+ result = _read_and_prepare_data(config)
32
+ assert "count" in result.columns
33
+
34
+
35
+ def test_setup_plot_artists_no_annotate(tmpdir):
36
+ config = argparse.Namespace(
37
+ annotate=False,
38
+ cbar=True,
39
+ cmap_min=None,
40
+ cmap_max=None,
41
+ author="Test Author",
42
+ title="Test Title",
43
+ output_dir=str(tmpdir),
44
+ format="png",
45
+ open=False,
46
+ )
47
+
48
+ df = pd.DataFrame([[10, 20], [30, 40]], index=[1, 2], columns=["01", "02"])
49
+
50
+ axis = _setup_plot_artists("vlag", config, df)
51
+ assert axis is not None
52
+ plt.close()
53
+
54
+
55
+ def test_configure_heatmap_options_no_annotate():
56
+ _, axis = plt.subplots()
57
+
58
+ config = argparse.Namespace(
59
+ annotate=False,
60
+ cbar=True,
61
+ cmap_min=None,
62
+ cmap_max=None,
63
+ )
64
+
65
+ options, _ = _configure_heatmap_options(config, "vlag", axis)
66
+ assert "annot" not in options
67
+ plt.close()
@@ -0,0 +1,45 @@
1
+ # Copyright (C) 2026 Kian-Meng Ang
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Affero General Public License as published
5
+ # by the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Affero General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Affero General Public License
14
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
+
16
+ import argparse
17
+ from pathlib import Path
18
+ from unittest.mock import patch
19
+
20
+ from heatmap_cli.heatmap import _refresh_output_dir
21
+
22
+
23
+ def test_purge_nonexistent_output_dir(tmpdir):
24
+ output_dir = Path(str(tmpdir)) / "nonexistent"
25
+ config = argparse.Namespace(
26
+ output_dir=str(output_dir), purge=True, yes=True
27
+ )
28
+ _refresh_output_dir(config)
29
+ assert output_dir.exists()
30
+
31
+
32
+ def test_purge_decline(tmpdir):
33
+ output_dir = Path(str(tmpdir)) / "output"
34
+ output_dir.mkdir()
35
+ (output_dir / "test.txt").write_text("data")
36
+
37
+ config = argparse.Namespace(
38
+ output_dir=str(output_dir), purge=True, yes=False
39
+ )
40
+
41
+ with patch("builtins.input", return_value="n"):
42
+ _refresh_output_dir(config)
43
+
44
+ assert output_dir.exists()
45
+ assert (output_dir / "test.txt").exists()
File without changes
File without changes
File without changes