Skip to content

False positive duplicate-code on setuptools-scm autogenerated version.py files #10479

@jamesbraza

Description

@jamesbraza

Bug description

PaperQA uses the uv workspaces layout from https://docs.astral.sh/uv/concepts/projects/workspaces/#workspace-layouts.

As of setuptools-scm version 9, duplicate-code is getting triggered on autogenerated version.py files for packages in packages/.

Fwiw, as a workaround, one can fix the error by in a pyproject.toml via:

[tool.pylint.main]
ignore-patterns = ["version.py"]

Configuration

https://github.com/Future-House/paper-qa/blob/v5.27.0/pyproject.toml#L204

Command used

pylint packages

Pylint output

************* Module paperqa_pypdf.reader
packages/paper-qa-pypdf/src/paperqa_pypdf/reader.py:1:0: R0801: Similar lines in 2 files
==paperqa_pymupdf.version:[3:34]
==paperqa_pypdf.version:[3:34]
__all__ = [
    "__version__",
    "__version_tuple__",
    "version",
    "version_tuple",
    "__commit_id__",
    "commit_id",
]

TYPE_CHECKING = False
if TYPE_CHECKING:
    from typing import Tuple
    from typing import Union

    VERSION_TUPLE = Tuple[Union[int, str], ...]
    COMMIT_ID = Union[str, None]
else:
    VERSION_TUPLE = object
    COMMIT_ID = object

version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE
commit_id: COMMIT_ID
__commit_id__: COMMIT_ID

__version__ = version = '5.27.1.dev8+g697cfbd83'
__version_tuple__ = version_tuple = (5, 27, 1, 'dev8', 'g697cfbd83')

__commit_id__ = commit_id = 'g697cfbd83' (duplicate-code)

Expected behavior

It would be nice if duplicate-code wasn't triggered on autogenerated version files. Though I recognize this is special case-y and may be hard.

Pylint version

pylint 3.3.7
astroid 3.3.11
Python 3.13.5 (main, Jul 10 2025, 15:26:00) [Clang 17.0.0 (clang-1700.0.13.5)]

OS / Environment

macOS Sequoia 15.5

Additional dependencies

setuptools==80.9.0
setuptools-scm==9.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs decision 🔒Needs a decision before implemention or rejection

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions