onesentence
A Pre-commit hook for checking 'one sentence per line' documentation practices.
One sentence per line is a practice where developers use only one line per sentence.
This can make it easier to review or provide comments on in version control systems like git.
That said, it can sometimes be difficult to remember or "debug" this style preference.
We provide this linting tool to assist with finding and fixing areas of content where the style preference is one sentence per line.
Installation
Install onesentence from PyPI or from source.
Also reference the pre-commit hook instructions for use through pre-commit.
# install from pypi
pip install onesentence
# install directly from source
pip install git+https://github.com/CU-DBMI/onesentence.git
Usage
The onesentence tool provides a command-line interface for checking and fixing files to ensure they follow the "one sentence per line" rule.
Commands
onesentence check <file_path> [<file_path> ...]
This command checks whether each given file adheres to the "one sentence per line" rule. One or more files may be passed (for example, the filenames pre-commit hands to a hook). It returns a non-zero exit code if any file has a violation.
onesentence fix <file_path> [<file_path> ...] [--output <path>]
This command corrects each given file by splitting lines with multiple sentences onto separate lines.
By default every file is corrected in place, so processing many files never lets one file overwrite another.
Pass --output <path> to write a single corrected file to a separate destination; this is only valid with exactly one input file.
It returns a non-zero exit code if any file required changes.
Pre-commit hook
Install this pre-commit hook into your project with a block like the following:
repos:
- repo: https://github.com/CU-DBMI/onesentence
rev: v0.1.1
hooks:
# run checks
- id: check
# run checks and fixes where possible
- id: fix
Using onesentence with a Markdown formatter
If you also run a Markdown formatter such as
mdformat, configure it to
preserve existing line breaks so it does not undo the one-sentence-per-line
splitting.
For mdformat this means using --wrap=keep (the default), and notably not
--wrap=no or a fixed wrap width, either of which would rejoin sentences onto a
single line.
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.22
hooks:
- id: mdformat
args: ["--wrap=keep"]
Metadata
Release files for onesentence 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| onesentence-0.1.5.tar.gz | 57.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| onesentence-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 68.9 kB
Release files / onesentence-0.1.5.tar.gz
| Download URL | onesentence-0.1.5.tar.gz |
|---|---|
| Size | 57.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bca720785efdf2f2825b99cfb1a3911277889c22bdfd2dd0d41f5fabb2258d58
|
|
BLAKE2b-256 checksum How to use checksums |
dcc42f90a7cea16f7a79135d24c649789b2d86299f3d3b83d9c4d2174fd2015d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.
Transparency logRelease files / onesentence-0.1.5-py3-none-any.whl
| Download URL | onesentence-0.1.5-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10f3e9235f4ff029f13790530a3ae50289025253307c29abbb95d2b045e22178
|
|
BLAKE2b-256 checksum How to use checksums |
1690530c9d67a88b2299c6656a461927ba38a07452d2d42b8f5a94ffba6a2254
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.
Transparency log