pytest-stepline 0.0.1__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 Steven "Kabbe" Karbjinsky
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,13 @@
1
+ Metadata-Version: 2.4
2
+ Name: pytest-stepline
3
+ Version: 0.0.1
4
+ Summary: Add your description here
5
+ Author: Steven Karbjinsky
6
+ Author-email: Steven Karbjinsky <steven.karbjinsky@web.de>
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Requires-Dist: rich>=15.0.0
10
+ Requires-Dist: typer>=0.29.1
11
+ Requires-Python: >=3.15
12
+ Description-Content-Type: text/markdown
13
+
File without changes
@@ -0,0 +1,79 @@
1
+ [project]
2
+ name = "pytest-stepline"
3
+ version = "0.0.1"
4
+ description = "Add your description here"
5
+ license = "MIT"
6
+ license-files = ["LICENSE"]
7
+ readme = "README.md"
8
+ requires-python = ">=3.15"
9
+ dependencies = [
10
+ "rich>=15.0.0",
11
+ "typer>=0.29.1",
12
+ ]
13
+
14
+ [[project.authors]]
15
+ name = "Steven Karbjinsky"
16
+ email = "steven.karbjinsky@web.de"
17
+
18
+ [project.scripts]
19
+ stepline = "stepline._cli.app:main"
20
+
21
+ [project.entry-points.pytest11]
22
+ stepline = "stepline._pytest.plugin"
23
+
24
+ [build-system]
25
+ requires = ["uv_build>=0.13,<0.14"]
26
+ build-backend = "uv_build"
27
+
28
+ [tool.uv.build-backend]
29
+ module-name = "stepline"
30
+
31
+ [tool.pyright]
32
+ include = [
33
+ "src",
34
+ "tests",
35
+ ]
36
+ typeCheckingMode = "strict"
37
+ venvPath = "."
38
+ venv = ".venv"
39
+
40
+ [tool.pytest.ini_options]
41
+ testpaths = ["tests"]
42
+ addopts = [
43
+ "--import-mode=importlib",
44
+ "--strict-markers",
45
+ "--strict-config",
46
+ "-ra",
47
+ ]
48
+ xfail_strict = true
49
+ filterwarnings = ["error"]
50
+
51
+ [tool.coverage.run]
52
+ source = ["stepline"]
53
+ branch = true
54
+ dynamic_context = "test_function"
55
+
56
+ [tool.coverage.report]
57
+ fail_under = 100
58
+ show_missing = true
59
+ skip_covered = true
60
+ exclude_also = [
61
+ "if TYPE_CHECKING:",
62
+ "@overload",
63
+ "raise NotImplementedError",
64
+ ]
65
+
66
+ [tool.coverage.html]
67
+ show_contexts = true
68
+ skip_covered = false
69
+
70
+ [dependency-groups]
71
+ dev = [
72
+ "import-linter>=2.16",
73
+ "poethepoet>=0.49.0",
74
+ "pre-commit>=4.7.0",
75
+ "pyright>=1.1.414",
76
+ "pytest>=9.2.0",
77
+ "pytest-cov>=7.1.0",
78
+ "ruff>=0.17.4",
79
+ ]
@@ -0,0 +1,75 @@
1
+ [project]
2
+ name = "pytest-stepline"
3
+ version = "0.0.1"
4
+ description = "Add your description here"
5
+ license = "MIT"
6
+ license-files = ["LICENSE"]
7
+ readme = "README.md"
8
+ authors = [
9
+ { name = "Steven Karbjinsky", email = "steven.karbjinsky@web.de" }
10
+ ]
11
+ requires-python = ">=3.15"
12
+ dependencies = [
13
+ "rich>=15.0.0",
14
+ "typer>=0.29.1",
15
+ ]
16
+
17
+ [project.scripts]
18
+ stepline = "stepline._cli.app:main"
19
+
20
+ [project.entry-points.pytest11]
21
+ stepline = "stepline._pytest.plugin"
22
+
23
+ [build-system]
24
+ requires = ["uv_build>=0.13,<0.14"]
25
+ build-backend = "uv_build"
26
+
27
+ [tool.uv.build-backend]
28
+ module-name = "stepline"
29
+
30
+ [dependency-groups]
31
+ dev = [
32
+ "import-linter>=2.16",
33
+ "poethepoet>=0.49.0",
34
+ "pre-commit>=4.7.0",
35
+ "pyright>=1.1.414",
36
+ "pytest>=9.2.0",
37
+ "pytest-cov>=7.1.0",
38
+ "ruff>=0.17.4",
39
+ ]
40
+
41
+ [tool.pyright]
42
+ include = ["src", "tests"]
43
+ typeCheckingMode = "strict"
44
+ venvPath = "."
45
+ venv = ".venv"
46
+
47
+ [tool.pytest.ini_options]
48
+ testpaths = ["tests"]
49
+ addopts = [
50
+ "--import-mode=importlib",
51
+ "--strict-markers",
52
+ "--strict-config",
53
+ "-ra"
54
+ ]
55
+ xfail_strict = true
56
+ filterwarnings = ["error"]
57
+
58
+ [tool.coverage.run]
59
+ source = ["stepline"]
60
+ branch = true
61
+ dynamic_context = "test_function"
62
+
63
+ [tool.coverage.report]
64
+ fail_under = 100
65
+ show_missing = true
66
+ skip_covered = true
67
+ exclude_also = [
68
+ "if TYPE_CHECKING:",
69
+ "@overload",
70
+ "raise NotImplementedError"
71
+ ]
72
+
73
+ [tool.coverage.html]
74
+ show_contexts = true
75
+ skip_covered = false
@@ -0,0 +1,5 @@
1
+ """Structured pytest tests with steps, typed assertions, and test documentation."""
2
+
3
+ from importlib.metadata import version
4
+
5
+ __version__ = version("pytest-stepline")
@@ -0,0 +1 @@
1
+ """Internal implementation of the stepline command-line tool."""
@@ -0,0 +1,44 @@
1
+ """The stepline command-line tool."""
2
+
3
+ from typing import Annotated
4
+
5
+ import typer
6
+
7
+ from stepline._cli.options.version import version_option
8
+
9
+ app = typer.Typer(
10
+ name="stepline",
11
+ help="Step by step. Line by line.",
12
+ no_args_is_help=True,
13
+ add_completion=False,
14
+ rich_markup_mode="rich",
15
+ context_settings={"help_option_names": ["-h", "--help"]},
16
+ pretty_exceptions_show_locals=False,
17
+ )
18
+
19
+
20
+ @app.callback()
21
+ def cli(
22
+ version: Annotated[
23
+ bool,
24
+ typer.Option(
25
+ "--version",
26
+ "-V",
27
+ callback=version_option,
28
+ is_eager=True,
29
+ help="Show the stepline banner with version information and exit.",
30
+ ),
31
+ ] = False,
32
+ ) -> None:
33
+ """
34
+ Step by step. Line by line.
35
+
36
+ Args:
37
+ version: Handled by `version_option`, which shows the banner and exits.
38
+ The parameter only exists so that Typer adds the option.
39
+ """
40
+
41
+
42
+ def main() -> None:
43
+ """Run the stepline command-line tool."""
44
+ app()
@@ -0,0 +1 @@
1
+ """Subcommands of the stepline command-line tool, such as `stepline spec export`."""
@@ -0,0 +1 @@
1
+ """Options of the stepline command-line tool, such as `--version`."""
@@ -0,0 +1,24 @@
1
+ """The `--version` option of the stepline command-line tool."""
2
+
3
+ import typer
4
+ from rich.console import Console
5
+
6
+ from stepline._render.banner import render_banner
7
+
8
+
9
+ def version_option(value: bool) -> None:
10
+ """
11
+ Show the stepline banner and exit when `--version` is given.
12
+
13
+ Typer calls this function for every run, because the option is eager.
14
+ It only acts when the `--version` option was actually given.
15
+
16
+ Args:
17
+ value: Whether `--version` or `-V` was given on the command line.
18
+
19
+ Raises:
20
+ typer.Exit: After showing the banner, to end the program.
21
+ """
22
+ if value:
23
+ render_banner(console=Console(), command="--version")
24
+ raise typer.Exit
@@ -0,0 +1 @@
1
+ """Internal core: failures, records, context and events."""
@@ -0,0 +1 @@
1
+ """Internal pytest plugin hooks and options."""
@@ -0,0 +1,20 @@
1
+ """pytest plugin that integrates stepline into every test run."""
2
+
3
+ import platform
4
+
5
+ import pytest
6
+
7
+ import stepline
8
+
9
+
10
+ def pytest_report_header(config: pytest.Config) -> str:
11
+ """
12
+ Add the stepline header line to the start of a test run.
13
+
14
+ Args:
15
+ config: The pytest configuration object.
16
+
17
+ Returns:
18
+ The header line shown below pytest's own session information.
19
+ """
20
+ return f"├─ stepline {stepline.__version__} · Python {platform.python_version()} · pytest {pytest.__version__}"
@@ -0,0 +1 @@
1
+ """Internal rendering of console output with rich."""
@@ -0,0 +1,140 @@
1
+ """The stepline banner shown by standalone commands such as `stepline --version`."""
2
+
3
+ import platform
4
+ from importlib.metadata import PackageNotFoundError, metadata, version
5
+
6
+ from rich import box
7
+ from rich.console import Console, Group
8
+ from rich.measure import Measurement
9
+ from rich.panel import Panel
10
+ from rich.table import Table
11
+ from rich.text import Text
12
+
13
+ import stepline
14
+
15
+ LOGO_LINES = (
16
+ r" __ ___",
17
+ r" _____/ /____ ____ / (_)___ ___",
18
+ r" / ___/ __/ _ \/ __ \/ / / __ \/ _ \ ",
19
+ r" (__ ) /_/ __/ /_/ / / / / / / __/",
20
+ r"/____/\__/\___/ .___/_/_/_/ /_/\___/",
21
+ r" /_/",
22
+ )
23
+ SLOGAN = "Step by step. Line by line."
24
+
25
+ GRADIENT_START = (34, 211, 238)
26
+ GRADIENT_END = (139, 92, 246)
27
+
28
+ PANEL_PADDING = (1, 2)
29
+ PANEL_CHROME = 2 + 2 * PANEL_PADDING[1]
30
+ MEASURE_WIDTH = 1_000
31
+
32
+
33
+ def render_banner(console: Console, command: str) -> None:
34
+ """
35
+ Render the stepline banner for a specific command in the console.
36
+
37
+ The banner uses the widest of the following layouts that fits into the console:
38
+
39
+ - Logo and table with information displayed side by side
40
+ - Logo and table with information displayed on top of each other
41
+ - Only a short statement with the stepline version, if neither layout fits
42
+
43
+ Args:
44
+ console: The rich console to print to.
45
+ command: The command that shows the banner, e.g. "--version".
46
+ """
47
+ logo, info = _gradient_logo(), _info_table(command=command)
48
+
49
+ side_by_side = Table.grid(padding=(0, 4))
50
+ side_by_side.add_column()
51
+ side_by_side.add_column(vertical="middle")
52
+ side_by_side.add_row(logo, info)
53
+
54
+ stacked = Group(logo, Text(), info)
55
+
56
+ measure_options = console.options.update_width(MEASURE_WIDTH)
57
+ content = next(
58
+ (
59
+ layout
60
+ for layout in (side_by_side, stacked)
61
+ if Measurement.get(console, measure_options, layout).maximum + PANEL_CHROME <= console.width
62
+ ),
63
+ None,
64
+ )
65
+
66
+ if content is None:
67
+ console.print(f"stepline {stepline.__version__} · {command}")
68
+ return
69
+
70
+ console.print(
71
+ Panel(
72
+ content,
73
+ box=box.ROUNDED,
74
+ border_style="grey42",
75
+ title=f"[dim]by {metadata('pytest-stepline').get('author')}[/]",
76
+ title_align="left",
77
+ subtitle=f"[italic dim]{SLOGAN}[/]",
78
+ subtitle_align="right",
79
+ padding=PANEL_PADDING,
80
+ expand=False,
81
+ )
82
+ )
83
+
84
+
85
+ def _gradient_logo() -> Text:
86
+ """
87
+ Build the stepline logo with a horizontal color gradient.
88
+
89
+ Returns:
90
+ The colored logo as rich text.
91
+ """
92
+ width = max(len(line) for line in LOGO_LINES)
93
+ logo = Text()
94
+
95
+ for line in LOGO_LINES:
96
+ for column, char in enumerate(line):
97
+ share = column / (width - 1)
98
+ red, green, blue = (
99
+ round(start + (end - start) * share) for start, end in zip(GRADIENT_START, GRADIENT_END, strict=True)
100
+ )
101
+
102
+ logo.append(char, style=f"bold rgb({red},{green},{blue})")
103
+ logo.append("\n")
104
+ logo.rstrip()
105
+
106
+ return logo
107
+
108
+
109
+ def _info_table(command: str) -> Table:
110
+ """
111
+ Build the info table column next to the logo.
112
+
113
+ Args:
114
+ command: The command that shows the banner, e.g. "--version".
115
+
116
+ Returns:
117
+ A two-column table with labels and values.
118
+ """
119
+ table = Table.grid(padding=(0, 1))
120
+ table.add_column(style="dim", justify="right")
121
+ table.add_column()
122
+ table.add_row("version", f"[bold cyan]{stepline.__version__}[/]")
123
+ table.add_row("python", platform.python_version())
124
+ table.add_row("pytest", _get_pytest_version())
125
+ table.add_row("platform", f"{platform.system()} {platform.release()} · {platform.machine()}")
126
+ table.add_row("command", command)
127
+ return table
128
+
129
+
130
+ def _get_pytest_version() -> str:
131
+ """
132
+ Return the installed version of pytest.
133
+
134
+ Returns:
135
+ The version string, or "not installed".
136
+ """
137
+ try:
138
+ return version("pytest")
139
+ except PackageNotFoundError:
140
+ return "not installed"
@@ -0,0 +1 @@
1
+ """Fluent, type-aware assertions built around assert_that()."""
@@ -0,0 +1 @@
1
+ """Logging that attaches messages to the current step."""
@@ -0,0 +1 @@
1
+ """Decorators that document tests directly in the code."""
@@ -0,0 +1 @@
1
+ """Timing and performance budgets for tests and steps."""
File without changes
@@ -0,0 +1 @@
1
+ """Named, timed and nestable test steps."""