juniorprint 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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hero
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.4
2
+ Name: juniorprint
3
+ Version: 1.0
4
+ Summary: Smart print function with inline color formatting
5
+ Author: Hero
6
+ Requires-Python: >=3.7
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: colorama
10
+ Dynamic: license-file
11
+
12
+ # smartprint
13
+ Smartprint est une librairie Python simple pour afficher du texte coloré et stylé directement dans le terminal.
14
+ Elle remplace automatiquement print() par print_() si importée.
15
+ Les scripts d'exemple se trouvent dans smartprint/examples/
@@ -0,0 +1,4 @@
1
+ # smartprint
2
+ Smartprint est une librairie Python simple pour afficher du texte coloré et stylé directement dans le terminal.
3
+ Elle remplace automatiquement print() par print_() si importée.
4
+ Les scripts d'exemple se trouvent dans smartprint/examples/
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.4
2
+ Name: juniorprint
3
+ Version: 1.0
4
+ Summary: Smart print function with inline color formatting
5
+ Author: Hero
6
+ Requires-Python: >=3.7
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: colorama
10
+ Dynamic: license-file
11
+
12
+ # smartprint
13
+ Smartprint est une librairie Python simple pour afficher du texte coloré et stylé directement dans le terminal.
14
+ Elle remplace automatiquement print() par print_() si importée.
15
+ Les scripts d'exemple se trouvent dans smartprint/examples/
@@ -0,0 +1,15 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ juniorprint.egg-info/PKG-INFO
5
+ juniorprint.egg-info/SOURCES.txt
6
+ juniorprint.egg-info/dependency_links.txt
7
+ juniorprint.egg-info/requires.txt
8
+ juniorprint.egg-info/top_level.txt
9
+ smartprint/__init__.py
10
+ smartprint/formatter.py
11
+ smartprint/printer.py
12
+ smartprint/styles.py
13
+ smartprint/examples/demo1.py
14
+ smartprint/examples/demo2.py
15
+ smartprint/examples/demo3.py
@@ -0,0 +1 @@
1
+ colorama
@@ -0,0 +1 @@
1
+ smartprint
@@ -0,0 +1,12 @@
1
+ [build-system]
2
+ requires = ["setuptools", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "juniorprint"
7
+ version = "1.0"
8
+ description = "Smart print function with inline color formatting"
9
+ authors = [{name = "Hero"}]
10
+ dependencies = ["colorama"]
11
+ requires-python = ">=3.7"
12
+ readme = "README.md"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ from .printer import print_
2
+ import builtins
3
+ builtins.print = print_
@@ -0,0 +1,3 @@
1
+ from smartprint import print_
2
+ print_("r_[Erreur] b_[Connexion] Texte normal")
3
+ print_("g_[Succès] y_[Avertissement] Texte normal")
@@ -0,0 +1,3 @@
1
+ from smartprint import print_
2
+ print_("rd_[Important en gras] b_[Info en bleu] normal")
3
+ print_("r_[Rouge] g_[Vert] b_[Bleu] m_[Magenta] c_[Cyan] w_[Blanc]")
@@ -0,0 +1,4 @@
1
+ from smartprint import print_
2
+ error_msg = "Impossible de se connecter"
3
+ success_msg = "Connexion établie"
4
+ print_("r_[Erreur] " + error_msg + " g_[Succès] " + success_msg)
@@ -0,0 +1,14 @@
1
+ import re
2
+ from .styles import COLORS, STYLES, RESET
3
+
4
+ pattern = re.compile(r'([a-z]+)_\[(.*?)\]')
5
+
6
+ def format_text(text: str) -> str:
7
+ def repl(match):
8
+ key, content = match.group(1), match.group(2)
9
+ codes = ""
10
+ for char in key:
11
+ if char in COLORS: codes += COLORS[char]
12
+ elif char in STYLES: codes += STYLES[char]
13
+ return f"{codes}{content}{RESET}"
14
+ return pattern.sub(repl, text)
@@ -0,0 +1,9 @@
1
+ from colorama import init
2
+ init(autoreset=True)
3
+ from .formatter import format_text
4
+
5
+ def print_(*args, **kwargs):
6
+ sep = kwargs.pop("sep", " ")
7
+ end = kwargs.pop("end", "\n")
8
+ formatted = [format_text(str(arg)) for arg in args]
9
+ print(*formatted, sep=sep, end=end, **kwargs)
@@ -0,0 +1,11 @@
1
+ COLORS = {
2
+ "r": "\033[31m",
3
+ "g": "\033[32m",
4
+ "y": "\033[33m",
5
+ "b": "\033[34m",
6
+ "m": "\033[35m",
7
+ "c": "\033[36m",
8
+ "w": "\033[37m",
9
+ }
10
+ STYLES = {"d": "\033[1m"}
11
+ RESET = "\033[0m"