Skip to main content

A Pre-commit hook for 'one sentence per line' documentation practices.

Project description

onesentence

PyPI - Version Build Status Ruff uv Software DOI badge

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"]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onesentence-0.1.2.tar.gz (49.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

onesentence-0.1.2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file onesentence-0.1.2.tar.gz.

File metadata

  • Download URL: onesentence-0.1.2.tar.gz
  • Upload date:
  • Size: 49.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for onesentence-0.1.2.tar.gz
Algorithm Hash digest
SHA256 666c8d9bdc006fc43cbcd62a5bf797b8a640f83a3fdcf470713b795c3e63ee96
MD5 e8d039a94c55bc67afa247b49934cc79
BLAKE2b-256 77847de95c31ede71ba57a5234f05693b284e728cf6ada52d2f7fbc900cd6504

See more details on using hashes here.

Provenance

The following attestation bundles were made for onesentence-0.1.2.tar.gz:

Publisher: publish-pypi.yml on CU-DBMI/onesentence

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file onesentence-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: onesentence-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for onesentence-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 93df80bdea242e07d28f5e7408f4186a3967a76d90183df2794797e0c4541a1a
MD5 3689198d2292b5515242686b1e1753f4
BLAKE2b-256 8399cbc3959c311103bbb833a4704a7251cbe73136fdda30a785813dff4209ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for onesentence-0.1.2-py3-none-any.whl:

Publisher: publish-pypi.yml on CU-DBMI/onesentence

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page