simple-terminal-banner 0.0.6__tar.gz → 0.1.0__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.
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.2
2
+ Name: simple_terminal_banner
3
+ Version: 0.1.0
4
+ Summary: A simple Python utility to display banners in the terminal
5
+ Author-email: "Stephen J. Graham" <stephen@seesawweb.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/charlbury/simple_terminal_banner
8
+ Project-URL: Repository, https://github.com/charlbury/simple_terminal_banner
9
+ Project-URL: Issues, https://github.com/charlbury/simple_terminal_banner/issues
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.7
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+
17
+ # Simple Terminal Banner
18
+
19
+ ![Build Status](https://github.com/charlbury/simple_terminal_banner/actions/workflows/python-package.yml/badge.svg)
20
+
21
+ ```
22
+ ** Simple Terminal Banner **************
23
+ * *
24
+ * Hello, World! *
25
+ * *
26
+ ****************************************
27
+ ```
28
+
29
+ Display a simple terminal banner.
30
+
31
+ ## Features
32
+
33
+ * Banner Title
34
+ * Themes
35
+ * Padding
36
+ * Margin
37
+ * Configurable border symbols
38
+ * Configurable background symbols
39
+
40
+ ## Example
41
+
42
+ ```python
43
+ from simple_terminal_banner import Banner
44
+
45
+ banner = Banner("Hello, World!")
46
+ banner.display()
47
+ ```
48
+
49
+ Produces:
50
+
51
+ ```
52
+ ****************************************
53
+ * *
54
+ * Hello, World! *
55
+ * *
56
+ ****************************************
57
+ ```
58
+
59
+ ## Titles
60
+
61
+ ```
62
+ banner.title = "Banner Example"
63
+ ```
64
+ Produces:
65
+ ```
66
+ ** Banner Example **********************
67
+ * *
68
+ * Hello, World! *
69
+ * *
70
+ ****************************************
71
+ ```
72
+
73
+ ## Padding
74
+
75
+ ### Title Padding
76
+
77
+ ```
78
+ banner.title_padding = 4
79
+ ```
80
+
81
+ Produces:
82
+
83
+ ```
84
+ ** Banner Example ****************
85
+ * *
86
+ * Hello, World! *
87
+ * *
88
+ ****************************************
89
+ ```
90
+
91
+ ### Content Padding
92
+
93
+ ```
94
+ banner.padding_top = 4
95
+ ```
96
+
97
+ Produces:
98
+
99
+ ```
100
+ ** Banner Example ****************
101
+ * *
102
+ * *
103
+ * *
104
+ * *
105
+ * Hello, World! *
106
+ * *
107
+ ****************************************
108
+ ```
109
+
110
+ ## Configurable Symbols
111
+
112
+ ### Border Symbols
113
+
114
+ ```
115
+ banner.border_symbol = "="
116
+ ```
117
+
118
+ Produces:
119
+
120
+ ```
121
+ == Banner Example ================
122
+ = =
123
+ = =
124
+ = =
125
+ = =
126
+ = Hello, World! =
127
+ = =
128
+ ========================================
129
+ ```
130
+
131
+ ### Background Symbols
132
+
133
+ ```
134
+ banner.background_symbol = "."
135
+ ```
136
+
137
+ Produces:
138
+
139
+ ```
140
+ ```
@@ -0,0 +1,124 @@
1
+ # Simple Terminal Banner
2
+
3
+ ![Build Status](https://github.com/charlbury/simple_terminal_banner/actions/workflows/python-package.yml/badge.svg)
4
+
5
+ ```
6
+ ** Simple Terminal Banner **************
7
+ * *
8
+ * Hello, World! *
9
+ * *
10
+ ****************************************
11
+ ```
12
+
13
+ Display a simple terminal banner.
14
+
15
+ ## Features
16
+
17
+ * Banner Title
18
+ * Themes
19
+ * Padding
20
+ * Margin
21
+ * Configurable border symbols
22
+ * Configurable background symbols
23
+
24
+ ## Example
25
+
26
+ ```python
27
+ from simple_terminal_banner import Banner
28
+
29
+ banner = Banner("Hello, World!")
30
+ banner.display()
31
+ ```
32
+
33
+ Produces:
34
+
35
+ ```
36
+ ****************************************
37
+ * *
38
+ * Hello, World! *
39
+ * *
40
+ ****************************************
41
+ ```
42
+
43
+ ## Titles
44
+
45
+ ```
46
+ banner.title = "Banner Example"
47
+ ```
48
+ Produces:
49
+ ```
50
+ ** Banner Example **********************
51
+ * *
52
+ * Hello, World! *
53
+ * *
54
+ ****************************************
55
+ ```
56
+
57
+ ## Padding
58
+
59
+ ### Title Padding
60
+
61
+ ```
62
+ banner.title_padding = 4
63
+ ```
64
+
65
+ Produces:
66
+
67
+ ```
68
+ ** Banner Example ****************
69
+ * *
70
+ * Hello, World! *
71
+ * *
72
+ ****************************************
73
+ ```
74
+
75
+ ### Content Padding
76
+
77
+ ```
78
+ banner.padding_top = 4
79
+ ```
80
+
81
+ Produces:
82
+
83
+ ```
84
+ ** Banner Example ****************
85
+ * *
86
+ * *
87
+ * *
88
+ * *
89
+ * Hello, World! *
90
+ * *
91
+ ****************************************
92
+ ```
93
+
94
+ ## Configurable Symbols
95
+
96
+ ### Border Symbols
97
+
98
+ ```
99
+ banner.border_symbol = "="
100
+ ```
101
+
102
+ Produces:
103
+
104
+ ```
105
+ == Banner Example ================
106
+ = =
107
+ = =
108
+ = =
109
+ = =
110
+ = Hello, World! =
111
+ = =
112
+ ========================================
113
+ ```
114
+
115
+ ### Background Symbols
116
+
117
+ ```
118
+ banner.background_symbol = "."
119
+ ```
120
+
121
+ Produces:
122
+
123
+ ```
124
+ ```
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "simple_terminal_banner"
7
- version = "0.0.6"
7
+ version = "0.1.0"
8
8
  authors = [
9
9
  { name="Stephen J. Graham", email="stephen@seesawweb.com" },
10
10
  ]
@@ -48,7 +48,8 @@ class Banner:
48
48
  for row in self._rows:
49
49
  print(row)
50
50
  else:
51
- print(self._line(self.message))
51
+ if self.message:
52
+ print(self._line(self.message))
52
53
  print(self._create_padding_bottom())
53
54
  print(self._separator())
54
55
  if self.margin_bottom > 0: print(self._create_margin_bottom())
@@ -1,5 +1,10 @@
1
1
  from simple_terminal_banner import Banner, BannerThemes
2
2
 
3
+
4
+ b = Banner()
5
+ b.title = "Hello, World!"
6
+ b.display()
7
+
3
8
  # create a simple banner showing the easiest possible
4
9
  # way to have a quick and easy banner message displayed
5
10
  banner = Banner("Hello, World!")
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.2
2
+ Name: simple_terminal_banner
3
+ Version: 0.1.0
4
+ Summary: A simple Python utility to display banners in the terminal
5
+ Author-email: "Stephen J. Graham" <stephen@seesawweb.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/charlbury/simple_terminal_banner
8
+ Project-URL: Repository, https://github.com/charlbury/simple_terminal_banner
9
+ Project-URL: Issues, https://github.com/charlbury/simple_terminal_banner/issues
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.7
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+
17
+ # Simple Terminal Banner
18
+
19
+ ![Build Status](https://github.com/charlbury/simple_terminal_banner/actions/workflows/python-package.yml/badge.svg)
20
+
21
+ ```
22
+ ** Simple Terminal Banner **************
23
+ * *
24
+ * Hello, World! *
25
+ * *
26
+ ****************************************
27
+ ```
28
+
29
+ Display a simple terminal banner.
30
+
31
+ ## Features
32
+
33
+ * Banner Title
34
+ * Themes
35
+ * Padding
36
+ * Margin
37
+ * Configurable border symbols
38
+ * Configurable background symbols
39
+
40
+ ## Example
41
+
42
+ ```python
43
+ from simple_terminal_banner import Banner
44
+
45
+ banner = Banner("Hello, World!")
46
+ banner.display()
47
+ ```
48
+
49
+ Produces:
50
+
51
+ ```
52
+ ****************************************
53
+ * *
54
+ * Hello, World! *
55
+ * *
56
+ ****************************************
57
+ ```
58
+
59
+ ## Titles
60
+
61
+ ```
62
+ banner.title = "Banner Example"
63
+ ```
64
+ Produces:
65
+ ```
66
+ ** Banner Example **********************
67
+ * *
68
+ * Hello, World! *
69
+ * *
70
+ ****************************************
71
+ ```
72
+
73
+ ## Padding
74
+
75
+ ### Title Padding
76
+
77
+ ```
78
+ banner.title_padding = 4
79
+ ```
80
+
81
+ Produces:
82
+
83
+ ```
84
+ ** Banner Example ****************
85
+ * *
86
+ * Hello, World! *
87
+ * *
88
+ ****************************************
89
+ ```
90
+
91
+ ### Content Padding
92
+
93
+ ```
94
+ banner.padding_top = 4
95
+ ```
96
+
97
+ Produces:
98
+
99
+ ```
100
+ ** Banner Example ****************
101
+ * *
102
+ * *
103
+ * *
104
+ * *
105
+ * Hello, World! *
106
+ * *
107
+ ****************************************
108
+ ```
109
+
110
+ ## Configurable Symbols
111
+
112
+ ### Border Symbols
113
+
114
+ ```
115
+ banner.border_symbol = "="
116
+ ```
117
+
118
+ Produces:
119
+
120
+ ```
121
+ == Banner Example ================
122
+ = =
123
+ = =
124
+ = =
125
+ = =
126
+ = Hello, World! =
127
+ = =
128
+ ========================================
129
+ ```
130
+
131
+ ### Background Symbols
132
+
133
+ ```
134
+ banner.background_symbol = "."
135
+ ```
136
+
137
+ Produces:
138
+
139
+ ```
140
+ ```
@@ -8,4 +8,5 @@ simple_terminal_banner/examples.py
8
8
  simple_terminal_banner.egg-info/PKG-INFO
9
9
  simple_terminal_banner.egg-info/SOURCES.txt
10
10
  simple_terminal_banner.egg-info/dependency_links.txt
11
- simple_terminal_banner.egg-info/top_level.txt
11
+ simple_terminal_banner.egg-info/top_level.txt
12
+ tests/test_banner.py
@@ -0,0 +1,95 @@
1
+ # filepath: /Users/sjg/tmp/simple_terminal_banner/tests/test_banner.py
2
+ import unittest
3
+ from simple_terminal_banner import Banner, BannerThemes
4
+
5
+ class TestBanner(unittest.TestCase):
6
+
7
+ def test_banner_creation(self):
8
+ banner = Banner("Hello, World!")
9
+ self.assertEqual(banner.message, "Hello, World!")
10
+
11
+ def test_no_message(self):
12
+ banner = Banner()
13
+ banner.display()
14
+ self.assertIsNone(banner.message)
15
+
16
+ def test_banner_display(self):
17
+ banner = Banner("Hello, World!")
18
+ banner.display()
19
+ # Since display prints to the console, you might want to capture stdout and assert its content
20
+
21
+ def test_banner_title(self):
22
+ banner = Banner("Hello, World!")
23
+ banner.title = "Test Title"
24
+ self.assertEqual(banner.title, "Test Title")
25
+
26
+ def test_banner_themes(self):
27
+ theme_symbols = {
28
+ 'default': '*',
29
+ 'simple': '-',
30
+ 'hash': '#',
31
+ 'star': '*',
32
+ 'space': ' ',
33
+ 'none': ''}
34
+ banner = Banner("Hello, World!")
35
+ for theme in BannerThemes:
36
+ banner.theme(theme.value)
37
+ self.assertEqual(banner.border_symbol, theme_symbols[theme.value])
38
+
39
+ def test_multiline_banner(self):
40
+ multiline_banner = Banner()
41
+ multiline_banner.title = "Multiline Banner"
42
+ multiline_banner.width = 40
43
+ multiline_banner.padding_left = 4
44
+ multiline_banner.padding_right = 4
45
+ multiline_banner.margin_bottom = 1
46
+ multiline_banner.add_row("Hello, World!")
47
+ multiline_banner.add_row(type="blank")
48
+ multiline_banner.add_row("This is a multiline banner.")
49
+ multiline_banner.add_row("It can display multiple lines.")
50
+ multiline_banner.add_row(type="separator")
51
+ multiline_banner.add_row("This is the last line.")
52
+ multiline_banner.display()
53
+ # Capture stdout and assert its content if needed
54
+
55
+ def test_set_title(self):
56
+ banner = Banner()
57
+ banner.title = "Test Title"
58
+ self.assertEqual(banner.title, "Test Title")
59
+
60
+ def test_set_theme(self):
61
+ banner = Banner()
62
+ banner.theme("hash")
63
+ self.assertEqual(banner.border_symbol, "#")
64
+ self.assertEqual(banner.background_symbol, " ")
65
+ self.assertEqual(banner.padding_symbol, " ")
66
+
67
+ def test_add_row(self):
68
+ banner = Banner()
69
+ banner.add_row("Test Row")
70
+ self.assertIn("Test Row", banner._rows[0])
71
+
72
+ def test_padding_and_margins(self):
73
+ banner = Banner()
74
+ banner.padding_top = 2
75
+ banner.padding_bottom = 2
76
+ banner.margin_top = 1
77
+ banner.margin_bottom = 1
78
+ self.assertEqual(banner.padding_top, 2)
79
+ self.assertEqual(banner.padding_bottom, 2)
80
+ self.assertEqual(banner.margin_top, 1)
81
+ self.assertEqual(banner.margin_bottom, 1)
82
+
83
+ def test_different_widths(self):
84
+ banner = Banner()
85
+ banner.width = 50
86
+ self.assertEqual(banner.width, 50)
87
+
88
+ def test_multiline_content(self):
89
+ banner = Banner()
90
+ banner.add_row("This is a long line that should be wrapped if the width is too small.")
91
+ self.assertTrue(len(banner._rows) > 1)
92
+
93
+
94
+ if __name__ == '__main__':
95
+ unittest.main()
@@ -1,54 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: simple_terminal_banner
3
- Version: 0.0.6
4
- Summary: A simple Python utility to display banners in the terminal
5
- Author-email: "Stephen J. Graham" <stephen@seesawweb.com>
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/charlbury/simple_terminal_banner
8
- Project-URL: Repository, https://github.com/charlbury/simple_terminal_banner
9
- Project-URL: Issues, https://github.com/charlbury/simple_terminal_banner/issues
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Operating System :: OS Independent
13
- Requires-Python: >=3.7
14
- Description-Content-Type: text/markdown
15
- License-File: LICENSE
16
-
17
- # Simple Terminal Banner
18
-
19
- ```
20
- ** Simple Terminal Banner **************
21
- * *
22
- * Hello, World! *
23
- * *
24
- ****************************************
25
- ```
26
-
27
- Display a simple terminal banner.
28
-
29
- ## Features
30
-
31
- * Banner Title
32
- * Themes
33
- * Padding
34
- * Configurable border symbols
35
- * Configurable background symbols
36
-
37
- ## Example
38
-
39
- ```python
40
- from banner import Banner
41
-
42
- banner = Banner("Hello, World!")
43
- banner.display()
44
- ```
45
-
46
- Produces:
47
-
48
- ```
49
- ****************************************
50
- * *
51
- * Hello, World! *
52
- * *
53
- ****************************************
54
- ```
@@ -1,38 +0,0 @@
1
- # Simple Terminal Banner
2
-
3
- ```
4
- ** Simple Terminal Banner **************
5
- * *
6
- * Hello, World! *
7
- * *
8
- ****************************************
9
- ```
10
-
11
- Display a simple terminal banner.
12
-
13
- ## Features
14
-
15
- * Banner Title
16
- * Themes
17
- * Padding
18
- * Configurable border symbols
19
- * Configurable background symbols
20
-
21
- ## Example
22
-
23
- ```python
24
- from banner import Banner
25
-
26
- banner = Banner("Hello, World!")
27
- banner.display()
28
- ```
29
-
30
- Produces:
31
-
32
- ```
33
- ****************************************
34
- * *
35
- * Hello, World! *
36
- * *
37
- ****************************************
38
- ```
@@ -1,54 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: simple_terminal_banner
3
- Version: 0.0.6
4
- Summary: A simple Python utility to display banners in the terminal
5
- Author-email: "Stephen J. Graham" <stephen@seesawweb.com>
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/charlbury/simple_terminal_banner
8
- Project-URL: Repository, https://github.com/charlbury/simple_terminal_banner
9
- Project-URL: Issues, https://github.com/charlbury/simple_terminal_banner/issues
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Operating System :: OS Independent
13
- Requires-Python: >=3.7
14
- Description-Content-Type: text/markdown
15
- License-File: LICENSE
16
-
17
- # Simple Terminal Banner
18
-
19
- ```
20
- ** Simple Terminal Banner **************
21
- * *
22
- * Hello, World! *
23
- * *
24
- ****************************************
25
- ```
26
-
27
- Display a simple terminal banner.
28
-
29
- ## Features
30
-
31
- * Banner Title
32
- * Themes
33
- * Padding
34
- * Configurable border symbols
35
- * Configurable background symbols
36
-
37
- ## Example
38
-
39
- ```python
40
- from banner import Banner
41
-
42
- banner = Banner("Hello, World!")
43
- banner.display()
44
- ```
45
-
46
- Produces:
47
-
48
- ```
49
- ****************************************
50
- * *
51
- * Hello, World! *
52
- * *
53
- ****************************************
54
- ```