trainpit 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.
trainpit-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Moriyuki-S
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,233 @@
1
+ Metadata-Version: 2.4
2
+ Name: trainpit
3
+ Version: 0.1.0
4
+ Summary: Rich CLI progress monitoring for machine learning training loops
5
+ License-Expression: MIT
6
+ Project-URL: Documentation, https://moriyuki-s.github.io/trainpit/
7
+ Project-URL: Issues, https://github.com/Moriyuki-S/trainpit/issues
8
+ Project-URL: Repository, https://github.com/Moriyuki-S/trainpit
9
+ Keywords: cli,machine-learning,monitoring,training,tui
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Classifier: Topic :: System :: Monitoring
19
+ Requires-Python: >=3.13
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: pydantic>=2.0
23
+ Requires-Dist: textual>=8.2.7
24
+ Dynamic: license-file
25
+
26
+ # trainpit
27
+
28
+ [![Quality](https://github.com/Moriyuki-S/trainpit/actions/workflows/quality.yml/badge.svg)](https://github.com/Moriyuki-S/trainpit/actions/workflows/quality.yml)
29
+ [![Pytest Linux](https://github.com/Moriyuki-S/trainpit/actions/workflows/pytest-linux.yml/badge.svg)](https://github.com/Moriyuki-S/trainpit/actions/workflows/pytest-linux.yml)
30
+ [![Pytest macOS](https://github.com/Moriyuki-S/trainpit/actions/workflows/pytest-macos.yml/badge.svg)](https://github.com/Moriyuki-S/trainpit/actions/workflows/pytest-macos.yml)
31
+ [![Pytest Windows](https://github.com/Moriyuki-S/trainpit/actions/workflows/pytest-windows.yml/badge.svg)](https://github.com/Moriyuki-S/trainpit/actions/workflows/pytest-windows.yml)
32
+ [![Coverage](https://github.com/Moriyuki-S/trainpit/actions/workflows/coverage.yml/badge.svg)](https://github.com/Moriyuki-S/trainpit/actions/workflows/coverage.yml)
33
+
34
+ trainpit is a Python package for rich CLI progress monitoring in machine learning training loops.
35
+
36
+ The goal is to make long-running training jobs easier to inspect from a terminal, with progress output that is useful during development, debugging, and experiment runs.
37
+
38
+ ## Status
39
+
40
+ trainpit is in early development. The public `train` tracker API is available,
41
+ and the Textual dashboard demo can display progress, metrics, learning curves,
42
+ timing, events, custom panels, and configurable graph renderers. Renderer
43
+ integration around the public tracker API is still evolving.
44
+
45
+ ## Requirements
46
+
47
+ - Python 3.13 or later
48
+ - uv for local development
49
+
50
+ ## Installation
51
+
52
+ Install the latest published release:
53
+
54
+ ```sh
55
+ pip install trainpit
56
+ ```
57
+
58
+ In a uv-managed project:
59
+
60
+ ```sh
61
+ uv add trainpit
62
+ ```
63
+
64
+ Or install into the active virtual environment with uv:
65
+
66
+ ```sh
67
+ uv pip install trainpit
68
+ ```
69
+
70
+ Install from a local checkout for development:
71
+
72
+ ```sh
73
+ uv sync --locked
74
+ ```
75
+
76
+ For development, include the development dependency group:
77
+
78
+ ```sh
79
+ uv sync --locked --all-extras --dev
80
+ ```
81
+
82
+ Install Git hooks for local quality checks:
83
+
84
+ ```sh
85
+ uv run pre-commit install --install-hooks
86
+ ```
87
+
88
+ ## Usage
89
+
90
+ Wrap a training loop with the `train` tracker:
91
+
92
+ ```python
93
+ from trainpit import train
94
+
95
+ with train(total_epochs=3, total_steps=5, label="demo-run") as progress:
96
+ for epoch in range(1, 4):
97
+ progress.epoch(epoch)
98
+
99
+ for step in range(1, 6):
100
+ loss = 1.0 / (epoch * step)
101
+ progress.step(
102
+ step,
103
+ loss=loss,
104
+ metrics={"acc": step / 5},
105
+ learning_rate=0.0001,
106
+ )
107
+ ```
108
+
109
+ See the documentation tutorial for a fuller walkthrough.
110
+
111
+ A runnable notebook version is available at `examples/train_tutorial.ipynb`.
112
+
113
+ To run a small PyTorch neural network example:
114
+
115
+ ```sh
116
+ uv run --group examples python examples/torch_nn.py
117
+ ```
118
+
119
+ This opens the Textual dashboard and updates progress, metrics, and learning
120
+ curves while the model trains. Press `q` to close the dashboard after inspecting
121
+ the final state.
122
+
123
+ For non-interactive output:
124
+
125
+ ```sh
126
+ uv run --group examples python examples/torch_nn.py --plain
127
+ ```
128
+
129
+ To preview the Textual dashboard demo:
130
+
131
+ ```sh
132
+ uv run python examples/textual_dashboard.py
133
+ ```
134
+
135
+ To preview user-defined dashboard panels:
136
+
137
+ ```sh
138
+ uv run python examples/custom_panels.py
139
+ ```
140
+
141
+ ## Development
142
+
143
+ Run the test suite:
144
+
145
+ ```sh
146
+ uv run pytest
147
+ ```
148
+
149
+ Run tests with coverage:
150
+
151
+ ```sh
152
+ uv run pytest --cov=trainpit --cov-report=term-missing --cov-report=xml
153
+ ```
154
+
155
+ Run the configured pre-commit checks manually:
156
+
157
+ ```sh
158
+ uv run pre-commit run --all-files
159
+ uv run pre-commit run --hook-stage pre-push --all-files
160
+ ```
161
+
162
+ Check formatting:
163
+
164
+ ```sh
165
+ uv run ruff format --check .
166
+ ```
167
+
168
+ Run lint checks:
169
+
170
+ ```sh
171
+ uv run ruff check .
172
+ ```
173
+
174
+ Build distribution artifacts:
175
+
176
+ ```sh
177
+ uv build
178
+ ```
179
+
180
+ Publish releases by merging the repository's `develop` branch into `main` with a
181
+ pull request. The `Publish` workflow reads the version from `pyproject.toml`,
182
+ creates a GitHub release tagged as `v<version>`, builds the source distribution
183
+ and wheel, then uploads them to PyPI with Trusted Publishing.
184
+
185
+ If a release for that version already exists, the workflow skips publishing so
186
+ the same package version is not uploaded twice. Publishing a GitHub release
187
+ manually also triggers the PyPI upload path.
188
+
189
+ Before the first release, configure a PyPI Trusted Publisher for:
190
+
191
+ - owner: `Moriyuki-S`
192
+ - repository: `trainpit`
193
+ - workflow: `publish.yml`
194
+ - environment: `pypi`
195
+
196
+ Before opening a pull request, run:
197
+
198
+ ```sh
199
+ uv lock --check
200
+ uv run ruff format --check .
201
+ uv run ruff check .
202
+ uv run pytest
203
+ uv run pytest --cov=trainpit --cov-report=term-missing --cov-report=xml
204
+ uv build
205
+ ```
206
+
207
+ ## CI
208
+
209
+ GitHub Actions checks the following:
210
+
211
+ - lockfile validation
212
+ - formatting and linting with ruff
213
+ - Python file compilation
214
+ - package build
215
+ - wheel installation in a temporary environment
216
+ - pytest on Linux, macOS, and Windows
217
+ - coverage on Linux with `coverage.xml` uploaded as an artifact
218
+ - documentation builds with zensical
219
+
220
+ On pull requests, each CI workflow updates a dedicated conversation comment with
221
+ the overall job status, run link, commit, and step-level outcomes.
222
+
223
+ Dependabot is configured for GitHub Actions, uv, and devcontainer updates.
224
+
225
+ ## Contributing
226
+
227
+ Issues and pull requests are welcome while the project is taking shape.
228
+
229
+ For code changes, please keep the scope focused and include tests when the change affects behavior. For larger changes, open an issue first so the approach can be discussed before implementation.
230
+
231
+ ## License
232
+
233
+ MIT License.
@@ -0,0 +1,208 @@
1
+ # trainpit
2
+
3
+ [![Quality](https://github.com/Moriyuki-S/trainpit/actions/workflows/quality.yml/badge.svg)](https://github.com/Moriyuki-S/trainpit/actions/workflows/quality.yml)
4
+ [![Pytest Linux](https://github.com/Moriyuki-S/trainpit/actions/workflows/pytest-linux.yml/badge.svg)](https://github.com/Moriyuki-S/trainpit/actions/workflows/pytest-linux.yml)
5
+ [![Pytest macOS](https://github.com/Moriyuki-S/trainpit/actions/workflows/pytest-macos.yml/badge.svg)](https://github.com/Moriyuki-S/trainpit/actions/workflows/pytest-macos.yml)
6
+ [![Pytest Windows](https://github.com/Moriyuki-S/trainpit/actions/workflows/pytest-windows.yml/badge.svg)](https://github.com/Moriyuki-S/trainpit/actions/workflows/pytest-windows.yml)
7
+ [![Coverage](https://github.com/Moriyuki-S/trainpit/actions/workflows/coverage.yml/badge.svg)](https://github.com/Moriyuki-S/trainpit/actions/workflows/coverage.yml)
8
+
9
+ trainpit is a Python package for rich CLI progress monitoring in machine learning training loops.
10
+
11
+ The goal is to make long-running training jobs easier to inspect from a terminal, with progress output that is useful during development, debugging, and experiment runs.
12
+
13
+ ## Status
14
+
15
+ trainpit is in early development. The public `train` tracker API is available,
16
+ and the Textual dashboard demo can display progress, metrics, learning curves,
17
+ timing, events, custom panels, and configurable graph renderers. Renderer
18
+ integration around the public tracker API is still evolving.
19
+
20
+ ## Requirements
21
+
22
+ - Python 3.13 or later
23
+ - uv for local development
24
+
25
+ ## Installation
26
+
27
+ Install the latest published release:
28
+
29
+ ```sh
30
+ pip install trainpit
31
+ ```
32
+
33
+ In a uv-managed project:
34
+
35
+ ```sh
36
+ uv add trainpit
37
+ ```
38
+
39
+ Or install into the active virtual environment with uv:
40
+
41
+ ```sh
42
+ uv pip install trainpit
43
+ ```
44
+
45
+ Install from a local checkout for development:
46
+
47
+ ```sh
48
+ uv sync --locked
49
+ ```
50
+
51
+ For development, include the development dependency group:
52
+
53
+ ```sh
54
+ uv sync --locked --all-extras --dev
55
+ ```
56
+
57
+ Install Git hooks for local quality checks:
58
+
59
+ ```sh
60
+ uv run pre-commit install --install-hooks
61
+ ```
62
+
63
+ ## Usage
64
+
65
+ Wrap a training loop with the `train` tracker:
66
+
67
+ ```python
68
+ from trainpit import train
69
+
70
+ with train(total_epochs=3, total_steps=5, label="demo-run") as progress:
71
+ for epoch in range(1, 4):
72
+ progress.epoch(epoch)
73
+
74
+ for step in range(1, 6):
75
+ loss = 1.0 / (epoch * step)
76
+ progress.step(
77
+ step,
78
+ loss=loss,
79
+ metrics={"acc": step / 5},
80
+ learning_rate=0.0001,
81
+ )
82
+ ```
83
+
84
+ See the documentation tutorial for a fuller walkthrough.
85
+
86
+ A runnable notebook version is available at `examples/train_tutorial.ipynb`.
87
+
88
+ To run a small PyTorch neural network example:
89
+
90
+ ```sh
91
+ uv run --group examples python examples/torch_nn.py
92
+ ```
93
+
94
+ This opens the Textual dashboard and updates progress, metrics, and learning
95
+ curves while the model trains. Press `q` to close the dashboard after inspecting
96
+ the final state.
97
+
98
+ For non-interactive output:
99
+
100
+ ```sh
101
+ uv run --group examples python examples/torch_nn.py --plain
102
+ ```
103
+
104
+ To preview the Textual dashboard demo:
105
+
106
+ ```sh
107
+ uv run python examples/textual_dashboard.py
108
+ ```
109
+
110
+ To preview user-defined dashboard panels:
111
+
112
+ ```sh
113
+ uv run python examples/custom_panels.py
114
+ ```
115
+
116
+ ## Development
117
+
118
+ Run the test suite:
119
+
120
+ ```sh
121
+ uv run pytest
122
+ ```
123
+
124
+ Run tests with coverage:
125
+
126
+ ```sh
127
+ uv run pytest --cov=trainpit --cov-report=term-missing --cov-report=xml
128
+ ```
129
+
130
+ Run the configured pre-commit checks manually:
131
+
132
+ ```sh
133
+ uv run pre-commit run --all-files
134
+ uv run pre-commit run --hook-stage pre-push --all-files
135
+ ```
136
+
137
+ Check formatting:
138
+
139
+ ```sh
140
+ uv run ruff format --check .
141
+ ```
142
+
143
+ Run lint checks:
144
+
145
+ ```sh
146
+ uv run ruff check .
147
+ ```
148
+
149
+ Build distribution artifacts:
150
+
151
+ ```sh
152
+ uv build
153
+ ```
154
+
155
+ Publish releases by merging the repository's `develop` branch into `main` with a
156
+ pull request. The `Publish` workflow reads the version from `pyproject.toml`,
157
+ creates a GitHub release tagged as `v<version>`, builds the source distribution
158
+ and wheel, then uploads them to PyPI with Trusted Publishing.
159
+
160
+ If a release for that version already exists, the workflow skips publishing so
161
+ the same package version is not uploaded twice. Publishing a GitHub release
162
+ manually also triggers the PyPI upload path.
163
+
164
+ Before the first release, configure a PyPI Trusted Publisher for:
165
+
166
+ - owner: `Moriyuki-S`
167
+ - repository: `trainpit`
168
+ - workflow: `publish.yml`
169
+ - environment: `pypi`
170
+
171
+ Before opening a pull request, run:
172
+
173
+ ```sh
174
+ uv lock --check
175
+ uv run ruff format --check .
176
+ uv run ruff check .
177
+ uv run pytest
178
+ uv run pytest --cov=trainpit --cov-report=term-missing --cov-report=xml
179
+ uv build
180
+ ```
181
+
182
+ ## CI
183
+
184
+ GitHub Actions checks the following:
185
+
186
+ - lockfile validation
187
+ - formatting and linting with ruff
188
+ - Python file compilation
189
+ - package build
190
+ - wheel installation in a temporary environment
191
+ - pytest on Linux, macOS, and Windows
192
+ - coverage on Linux with `coverage.xml` uploaded as an artifact
193
+ - documentation builds with zensical
194
+
195
+ On pull requests, each CI workflow updates a dedicated conversation comment with
196
+ the overall job status, run link, commit, and step-level outcomes.
197
+
198
+ Dependabot is configured for GitHub Actions, uv, and devcontainer updates.
199
+
200
+ ## Contributing
201
+
202
+ Issues and pull requests are welcome while the project is taking shape.
203
+
204
+ For code changes, please keep the scope focused and include tests when the change affects behavior. For larger changes, open an issue first so the approach can be discussed before implementation.
205
+
206
+ ## License
207
+
208
+ MIT License.
@@ -0,0 +1,72 @@
1
+ [project]
2
+ name = "trainpit"
3
+ version = "0.1.0"
4
+ description = "Rich CLI progress monitoring for machine learning training loops"
5
+ readme = "README.md"
6
+ requires-python = ">=3.13"
7
+ license = "MIT"
8
+ license-files = ["LICENSE"]
9
+ keywords = ["cli", "machine-learning", "monitoring", "training", "tui"]
10
+ classifiers = [
11
+ "Development Status :: 3 - Alpha",
12
+ "Environment :: Console",
13
+ "Intended Audience :: Developers",
14
+ "Operating System :: OS Independent",
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.13",
17
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
18
+ "Topic :: Software Development :: Libraries :: Python Modules",
19
+ "Topic :: System :: Monitoring",
20
+ ]
21
+ dependencies = [
22
+ "pydantic>=2.0",
23
+ "textual>=8.2.7",
24
+ ]
25
+
26
+ [project.urls]
27
+ Documentation = "https://moriyuki-s.github.io/trainpit/"
28
+ Issues = "https://github.com/Moriyuki-S/trainpit/issues"
29
+ Repository = "https://github.com/Moriyuki-S/trainpit"
30
+
31
+ [build-system]
32
+ requires = ["setuptools>=82.0.1"]
33
+ build-backend = "setuptools.build_meta"
34
+
35
+ [dependency-groups]
36
+ dev = [
37
+ "pre-commit>=4.6.0",
38
+ "pytest>=9.1.1",
39
+ "pytest-cov>=7.1.0",
40
+ "ruff>=0.15.18",
41
+ "zensical>=0.0.46",
42
+ ]
43
+ examples = [
44
+ "numpy>=2.4.6",
45
+ "torch>=2.12.0",
46
+ ]
47
+
48
+ [tool.uv.sources]
49
+ torch = [{ index = "pytorch-cpu" }]
50
+
51
+ [[tool.uv.index]]
52
+ name = "pytorch-cpu"
53
+ url = "https://download.pytorch.org/whl/cpu"
54
+ explicit = true
55
+
56
+ [tool.setuptools.packages.find]
57
+ where = ["src"]
58
+
59
+ [tool.pytest.ini_options]
60
+ addopts = "-ra"
61
+ testpaths = ["tests"]
62
+
63
+ [tool.coverage.run]
64
+ branch = true
65
+ source = ["trainpit"]
66
+
67
+ [tool.coverage.report]
68
+ show_missing = true
69
+ skip_covered = true
70
+
71
+ [tool.ruff]
72
+ target-version = "py313"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,5 @@
1
+ """Rich CLI progress monitoring for machine learning training loops."""
2
+
3
+ from trainpit._tracker import TrainTracker, train
4
+
5
+ __all__ = ["TrainTracker", "train"]