ai-voice-learner 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 John R. Kosinski
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,85 @@
1
+ Metadata-Version: 2.4
2
+ Name: ai-voice-learner
3
+ Version: 0.0.1
4
+ Summary: Learns a writer's voice from the edits they make to machine drafts, then drafts in it.
5
+ Author: John R. Kosinski
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Classifier: Development Status :: 1 - Planning
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Topic :: Text Processing :: Linguistic
12
+ Classifier: Typing :: Typed
13
+ Requires-Python: >=3.12
14
+ Project-URL: Repository, https://github.com/jrkosinski/ai-voice-learner
15
+ Description-Content-Type: text/markdown
16
+
17
+ # AI Voice Learner
18
+
19
+ Learns a writer's voice from the edits they make to machine drafts, then drafts in it.
20
+
21
+ A style prompt built from writing samples shows a model what a writer kept. An edit also shows what
22
+ they threw away: each time a person changes what the model wrote, the before and after mark where
23
+ the model's instinct was wrong. Voice Learner keeps those pairs, finds the patterns in them, and
24
+ turns the patterns that hold up into rules the next draft follows.
25
+
26
+ ## Status
27
+
28
+ Nothing works yet. This is the skeleton: the package layout, the tooling and CI. The learner comes
29
+ in pull requests from here.
30
+
31
+ ## Layout
32
+
33
+ The package is split to keep the logic testable without a model, a disk or a network:
34
+
35
+ - `voice_learner.core`: the logic, pure. Pairs in, the voice's layers out
36
+ - `voice_learner.ports`: what the core needs from the outside (the model, the voice store, the
37
+ clock, etc...), declared as protocols
38
+ - `voice_learner.adapters`: the only code that touches files, the network or a model. It implements
39
+ the ports, and turns each way of interacting into pairs
40
+
41
+ `tests/test_architecture.py` enforces the split by reading the source. The core and the ports may
42
+ import each other and a short list of standard library modules that do no I/O, and may not call the
43
+ builtins that do. `docs/decisions/` records why.
44
+
45
+ ## Development
46
+
47
+ Needs [uv](https://docs.astral.sh/uv/).
48
+
49
+ ```sh
50
+ uv sync
51
+ uv run pre-commit install
52
+
53
+ uv run pytest # tests, with network access blocked
54
+ uv run mypy # types, strict
55
+ uv run ruff check # lint
56
+ uv run ruff format # formatting
57
+ uv run pre-commit run --all-files # every hook: lint, formatting, types and file checks
58
+ ```
59
+
60
+ CI runs the hooks, builds the wheel and runs the tests on every pull request, across the supported
61
+ Python versions.
62
+
63
+ ## Releasing
64
+
65
+ 1. In a pull request, run `uv version X.Y.Z`, which sets the version in both `pyproject.toml` and
66
+ `uv.lock`, and give the version a section in `CHANGELOG.md`
67
+ 2. Once it's merged, tag main and push the tag:
68
+
69
+ ```sh
70
+ git switch main && git pull
71
+ git tag vX.Y.Z && git push origin vX.Y.Z
72
+ ```
73
+
74
+ The tag starts the release workflow. It runs CI on the tagged commit, and refuses a tag on a commit
75
+ that isn't on main, a tag that doesn't match the version, and a version with no changelog notes.
76
+ Then it builds the package, checks its metadata, publishes it to PyPI through trusted publishing,
77
+ and creates the GitHub release with the changelog section as its notes; a pre-release version gets
78
+ a GitHub pre-release. `docs/decisions/0003-releases.md` says why it works this way.
79
+
80
+ If a job fails, retry it with "Re-run failed jobs". "Re-run all jobs" uploads to PyPI again, PyPI
81
+ refuses files it already has, and the GitHub release is skipped.
82
+
83
+ ## License
84
+
85
+ MIT
@@ -0,0 +1,69 @@
1
+ # AI Voice Learner
2
+
3
+ Learns a writer's voice from the edits they make to machine drafts, then drafts in it.
4
+
5
+ A style prompt built from writing samples shows a model what a writer kept. An edit also shows what
6
+ they threw away: each time a person changes what the model wrote, the before and after mark where
7
+ the model's instinct was wrong. Voice Learner keeps those pairs, finds the patterns in them, and
8
+ turns the patterns that hold up into rules the next draft follows.
9
+
10
+ ## Status
11
+
12
+ Nothing works yet. This is the skeleton: the package layout, the tooling and CI. The learner comes
13
+ in pull requests from here.
14
+
15
+ ## Layout
16
+
17
+ The package is split to keep the logic testable without a model, a disk or a network:
18
+
19
+ - `voice_learner.core`: the logic, pure. Pairs in, the voice's layers out
20
+ - `voice_learner.ports`: what the core needs from the outside (the model, the voice store, the
21
+ clock, etc...), declared as protocols
22
+ - `voice_learner.adapters`: the only code that touches files, the network or a model. It implements
23
+ the ports, and turns each way of interacting into pairs
24
+
25
+ `tests/test_architecture.py` enforces the split by reading the source. The core and the ports may
26
+ import each other and a short list of standard library modules that do no I/O, and may not call the
27
+ builtins that do. `docs/decisions/` records why.
28
+
29
+ ## Development
30
+
31
+ Needs [uv](https://docs.astral.sh/uv/).
32
+
33
+ ```sh
34
+ uv sync
35
+ uv run pre-commit install
36
+
37
+ uv run pytest # tests, with network access blocked
38
+ uv run mypy # types, strict
39
+ uv run ruff check # lint
40
+ uv run ruff format # formatting
41
+ uv run pre-commit run --all-files # every hook: lint, formatting, types and file checks
42
+ ```
43
+
44
+ CI runs the hooks, builds the wheel and runs the tests on every pull request, across the supported
45
+ Python versions.
46
+
47
+ ## Releasing
48
+
49
+ 1. In a pull request, run `uv version X.Y.Z`, which sets the version in both `pyproject.toml` and
50
+ `uv.lock`, and give the version a section in `CHANGELOG.md`
51
+ 2. Once it's merged, tag main and push the tag:
52
+
53
+ ```sh
54
+ git switch main && git pull
55
+ git tag vX.Y.Z && git push origin vX.Y.Z
56
+ ```
57
+
58
+ The tag starts the release workflow. It runs CI on the tagged commit, and refuses a tag on a commit
59
+ that isn't on main, a tag that doesn't match the version, and a version with no changelog notes.
60
+ Then it builds the package, checks its metadata, publishes it to PyPI through trusted publishing,
61
+ and creates the GitHub release with the changelog section as its notes; a pre-release version gets
62
+ a GitHub pre-release. `docs/decisions/0003-releases.md` says why it works this way.
63
+
64
+ If a job fails, retry it with "Re-run failed jobs". "Re-run all jobs" uploads to PyPI again, PyPI
65
+ refuses files it already has, and the GitHub release is skipped.
66
+
67
+ ## License
68
+
69
+ MIT
@@ -0,0 +1,115 @@
1
+ [project]
2
+ name = "ai-voice-learner"
3
+ version = "0.0.1"
4
+ description = "Learns a writer's voice from the edits they make to machine drafts, then drafts in it."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.12"
9
+ dependencies = []
10
+ classifiers = [
11
+ "Development Status :: 1 - Planning",
12
+ "Intended Audience :: Developers",
13
+ "Programming Language :: Python :: 3",
14
+ "Topic :: Text Processing :: Linguistic",
15
+ "Typing :: Typed",
16
+ ]
17
+
18
+ [[project.authors]]
19
+ name = "John R. Kosinski"
20
+
21
+ [project.urls]
22
+ Repository = "https://github.com/jrkosinski/ai-voice-learner"
23
+
24
+ [build-system]
25
+ requires = ["uv_build>=0.13.10,<0.14.0"]
26
+ build-backend = "uv_build"
27
+
28
+ [tool.uv]
29
+ required-version = ">=0.13.10,<0.14"
30
+
31
+ [tool.uv.build-backend]
32
+ module-name = "voice_learner"
33
+
34
+ [tool.ruff]
35
+ line-length = 100
36
+ src = [
37
+ "src",
38
+ "tests",
39
+ "scripts",
40
+ ]
41
+
42
+ [tool.ruff.lint]
43
+ select = [
44
+ "E",
45
+ "W",
46
+ "F",
47
+ "I",
48
+ "B",
49
+ "UP",
50
+ "SIM",
51
+ "RUF",
52
+ "N",
53
+ "D",
54
+ "PT",
55
+ "C4",
56
+ "PTH",
57
+ "RET",
58
+ "ARG",
59
+ "ERA",
60
+ "T20",
61
+ ]
62
+ ignore = ["D107"]
63
+
64
+ [tool.ruff.lint.pydocstyle]
65
+ convention = "google"
66
+
67
+ [tool.ruff.lint.per-file-ignores]
68
+ "tests/**" = ["D103"]
69
+
70
+ [tool.mypy]
71
+ strict = true
72
+ warn_unreachable = true
73
+ files = [
74
+ "src",
75
+ "tests",
76
+ "scripts",
77
+ ]
78
+ mypy_path = "scripts"
79
+
80
+ [tool.pytest.ini_options]
81
+ testpaths = ["tests"]
82
+ pythonpath = ["scripts"]
83
+ addopts = [
84
+ "-ra",
85
+ "--import-mode=importlib",
86
+ "--strict-config",
87
+ "--strict-markers",
88
+ "--disable-socket",
89
+ ]
90
+ xfail_strict = true
91
+ filterwarnings = ["error"]
92
+
93
+ [tool.coverage.run]
94
+ branch = true
95
+ source = ["voice_learner"]
96
+
97
+ [tool.coverage.report]
98
+ show_missing = true
99
+ fail_under = 90
100
+ exclude_also = ["if TYPE_CHECKING:"]
101
+
102
+ [dependency-groups]
103
+ dev = [
104
+ "mypy>=2.4.1",
105
+ "pre-commit>=4.7.0",
106
+ "pytest>=9.2.0",
107
+ "pytest-cov>=7.1.0",
108
+ "pytest-socket>=0.8.1",
109
+ "ruff>=0.17.6",
110
+ ]
111
+ release = ["twine>=7.0.0"]
112
+ workflows = [
113
+ "actionlint-py>=1.7.12.25",
114
+ "shellcheck-py>=0.11.0.1",
115
+ ]
@@ -0,0 +1,107 @@
1
+ [project]
2
+ name = "ai-voice-learner"
3
+ version = "0.0.1"
4
+ description = "Learns a writer's voice from the edits they make to machine drafts, then drafts in it."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ authors = [{ name = "John R. Kosinski" }]
9
+ requires-python = ">=3.12"
10
+ dependencies = []
11
+ classifiers = [
12
+ "Development Status :: 1 - Planning",
13
+ "Intended Audience :: Developers",
14
+ "Programming Language :: Python :: 3",
15
+ "Topic :: Text Processing :: Linguistic",
16
+ "Typing :: Typed",
17
+ ]
18
+
19
+ [project.urls]
20
+ Repository = "https://github.com/jrkosinski/ai-voice-learner"
21
+
22
+ [build-system]
23
+ requires = ["uv_build>=0.13.10,<0.14.0"]
24
+ build-backend = "uv_build"
25
+
26
+ [tool.uv]
27
+ required-version = ">=0.13.10,<0.14"
28
+
29
+ [tool.uv.build-backend]
30
+ module-name = "voice_learner"
31
+
32
+ [tool.ruff]
33
+ line-length = 100
34
+ src = ["src", "tests", "scripts"]
35
+
36
+ [tool.ruff.lint]
37
+ select = [
38
+ "E", # pycodestyle errors
39
+ "W", # pycodestyle warnings
40
+ "F", # pyflakes
41
+ "I", # import order
42
+ "B", # bugbear
43
+ "UP", # pyupgrade
44
+ "SIM", # simplify
45
+ "RUF", # ruff's own rules
46
+ "N", # naming
47
+ "D", # docstrings
48
+ "PT", # pytest style
49
+ "C4", # comprehensions
50
+ "PTH", # pathlib over os.path
51
+ "RET", # returns
52
+ "ARG", # unused arguments
53
+ "ERA", # commented-out code
54
+ "T20", # print
55
+ ]
56
+ ignore = ["D107"]
57
+
58
+ [tool.ruff.lint.pydocstyle]
59
+ convention = "google"
60
+
61
+ [tool.ruff.lint.per-file-ignores]
62
+ "tests/**" = ["D103"]
63
+
64
+ [tool.mypy]
65
+ strict = true
66
+ warn_unreachable = true
67
+ files = ["src", "tests", "scripts"]
68
+ mypy_path = "scripts"
69
+
70
+ [tool.pytest.ini_options]
71
+ testpaths = ["tests"]
72
+ pythonpath = ["scripts"]
73
+ addopts = [
74
+ "-ra",
75
+ "--import-mode=importlib",
76
+ "--strict-config",
77
+ "--strict-markers",
78
+ "--disable-socket",
79
+ ]
80
+ xfail_strict = true
81
+ filterwarnings = ["error"]
82
+
83
+ [tool.coverage.run]
84
+ branch = true
85
+ source = ["voice_learner"]
86
+
87
+ [tool.coverage.report]
88
+ show_missing = true
89
+ fail_under = 90
90
+ exclude_also = ["if TYPE_CHECKING:"]
91
+
92
+ [dependency-groups]
93
+ dev = [
94
+ "mypy>=2.4.1",
95
+ "pre-commit>=4.7.0",
96
+ "pytest>=9.2.0",
97
+ "pytest-cov>=7.1.0",
98
+ "pytest-socket>=0.8.1",
99
+ "ruff>=0.17.6",
100
+ ]
101
+ release = [
102
+ "twine>=7.0.0",
103
+ ]
104
+ workflows = [
105
+ "actionlint-py>=1.7.12.25",
106
+ "shellcheck-py>=0.11.0.1",
107
+ ]
@@ -0,0 +1,25 @@
1
+ """Learns a writer's voice from the edits they make to machine drafts, then drafts in it.
2
+
3
+ The package has three parts. `core` holds the logic and is pure: pairs in, the voice's layers out,
4
+ with no file, network or model calls. `ports` declares what the core needs from the outside.
5
+ `adapters` implements the ports and turns each way of interacting into pairs.
6
+ `tests/test_architecture.py` holds the line between them.
7
+ """
8
+
9
+ from importlib.metadata import PackageNotFoundError, version
10
+
11
+ UNKNOWN_VERSION = "0+unknown"
12
+
13
+
14
+ def __getattr__(name: str) -> str:
15
+ """Read `__version__` from the installed metadata when it's asked for, not at import.
16
+
17
+ Importing the core then never touches the disk, and a source tree with nothing installed
18
+ still imports.
19
+ """
20
+ if name == "__version__":
21
+ try:
22
+ return version("ai-voice-learner")
23
+ except PackageNotFoundError:
24
+ return UNKNOWN_VERSION
25
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
@@ -0,0 +1,6 @@
1
+ """The adapters: the only code that touches files, the network or a model.
2
+
3
+ An adapter either implements a port (the Claude model, the voice folder on disk) or turns a way of
4
+ interacting into pairs (a file edit, a before and after). Adapters may import the core and the
5
+ ports; the core and the ports never import an adapter.
6
+ """
@@ -0,0 +1,6 @@
1
+ """The core: the logic, kept pure.
2
+
3
+ Pairs come in and the voice's layers come out. Nothing here touches a file, the network or a model;
4
+ the core reaches the outside only through the protocols in `voice_learner.ports`. It imports other
5
+ core and port modules and the standard library modules listed in `tests/test_architecture.py`.
6
+ """
@@ -0,0 +1,6 @@
1
+ """The ports: what the core needs from the outside, declared as protocols.
2
+
3
+ Each outside dependency of the core (the model, the voice store, the clock, etc...) is a protocol
4
+ here, with a real implementation in `voice_learner.adapters` and a fake one in the tests. The ports
5
+ follow the core's import rules.
6
+ """
File without changes