PyCQA / PyCQA/docformatter

Differing behavior between linux and macos

Open
#285 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C: convention help wanted P: bug U: high
Dominant language
Python
Stars
598
Forks
93
PR merge metrics
No merged PRs in 30d

Description

if __name__ == "__main__":
    """Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaa┘."""
    # This is a comment

docformatter -i test.py on macOS (arm) results in no changes being made. docformatter -i test.py on linux aarch64 results in the following changes:

if __name__ == "__main__":
    """Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaa┘."""

    # This is a comment

Repeatedly executing docformatter -i on linux adds another line on every call which breaks idempotency.

if __name__ == "__main__":
    """Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaa┘."""




    # This is a comment

This might be related to being in the string.

breaking env on linux:

(base) mambauser@79d93f1c012c:/mnt/abc$ micromamba list -p /home/mambauser/.cache/pre-commit/repotqc_4xjd/conda-default
List of packages in environment: "/home/mambauser/.cache/pre-commit/repotqc_4xjd/conda-default"

  Name                   Version   Build               Channel    
────────────────────────────────────────────────────────────────────
  _openmp_mutex          4.5       2_gnu               conda-forge
  bzip2                  1.0.8     h31becfc_5          conda-forge
  ca-certificates        2024.6.2  hcefe29a_0          conda-forge
  charset-normalizer     3.3.2     pyhd8ed1ab_0        conda-forge
  docformatter           1.7.5     pyhd8ed1ab_0        conda-forge
  ld_impl_linux-aarch64  2.40      h9fc2d93_7          conda-forge
  libexpat               2.6.2     h2f0025b_0          conda-forge
  libffi                 3.4.2     h3557bc0_5          conda-forge
  libgcc-ng              14.1.0    he277a41_0          conda-forge
  libgomp                14.1.0    he277a41_0          conda-forge
  libnsl                 2.0.1     h31becfc_0          conda-forge
  libsqlite              3.46.0    hf51ef55_0          conda-forge
  libuuid                2.38.1    hb4cce97_0          conda-forge
  libxcrypt              4.4.36    h31becfc_1          conda-forge
  libzlib                1.3.1     h68df207_1          conda-forge
  ncurses                6.5       h0425590_0          conda-forge
  openssl                3.3.1     h68df207_1          conda-forge
  pip                    24.0      pyhd8ed1ab_0        conda-forge
  python                 3.12.4    h829453d_0_cpython  conda-forge
  readline               8.2       h8fc344f_1          conda-forge
  setuptools             70.1.1    pyhd8ed1ab_0        conda-forge
  tk                     8.6.13    h194ca79_0          conda-forge
  tomli                  2.0.1     pyhd8ed1ab_0        conda-forge
  tzdata                 2024a     h0c530f3_0          conda-forge
  untokenize             0.1.1     py_0                conda-forge
  wheel                  0.43.0    pyhd8ed1ab_1        conda-forge
  xz                     5.2.6     h9cdd2b7_0          conda-forge

working env on macos:

❯ micromamba list -p /Users/pavel/.cache/pre-commit/repox0xmrc5j/conda-default
List of packages in environment: "/Users/pavel/.cache/pre-commit/repox0xmrc5j/conda-default"

  Name                Version       Build               Channel    
─────────────────────────────────────────────────────────────────────
  bzip2               1.0.8         h93a5062_5          conda-forge
  ca-certificates     2024.2.2      hf0a4a13_0          conda-forge
  charset-normalizer  3.3.2         pyhd8ed1ab_0        conda-forge
  docformatter        1.7.5         pyhd8ed1ab_0        conda-forge
  libexpat            2.6.2         hebf3989_0          conda-forge
  libffi              3.4.2         h3422bc3_5          conda-forge
  libsqlite           3.45.2        h091b4b1_0          conda-forge
  libzlib             1.2.13        h53f4e23_5          conda-forge
  ncurses             6.4.20240210  h078ce10_0          conda-forge
  openssl             3.2.1         h0d3ecfb_1          conda-forge
  pip                 24.0          pyhd8ed1ab_0        conda-forge
  python              3.12.2        hdf0ec26_0_cpython  conda-forge
  readline            8.2           h92ec313_1          conda-forge
  setuptools          69.2.0        pyhd8ed1ab_0        conda-forge
  tk                  8.6.13        h5083fa2_1          conda-forge
  tomli               2.0.1         pyhd8ed1ab_0        conda-forge
  tzdata              2024a         h0c530f3_0          conda-forge
  untokenize          0.1.1         py_0                conda-forge
  wheel               0.43.0        pyhd8ed1ab_0        conda-forge
  xz                  5.2.6         h57fd34a_0          conda-forge

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the provided test.py snippet and docformatter -i command on Linux and macOS. Inspect how the formatter handles the non-ASCII in the docstring and repeated formatting; done means both platforms behave consistently and repeated runs no longer add blank lines.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.