Skip to content

Pre-commit hook seems to not create the correct version #123

@WilliamJamieson

Description

@WilliamJamieson

When I add the following hook per the documentation:

  - repo: https://github.com/scientific-python/repo-review
    rev: "v0.9.2"
    hooks:
      - id: repo-review
        additional_dependencies: ["sp-repo-review==2023.08.03"]

I am getting the following error when pre-commit attempts to install the repo-review hook:

[INFO] Initializing environment for https://github.com/scientific-python/repo-review.
[INFO] Initializing environment for https://github.com/scientific-python/repo-review:sp-repo-review==2023.08.03.
[INFO] Installing environment for https://github.com/scientific-python/repo-review.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/Users/wjamieson/.cache/pre-commit/repommi24uuq/py_env-python3.11/bin/python', '-mpip', 'install', '.', 'sp-repo-review==2023.08.03')
return code: 1
stdout:
    Processing /Users/wjamieson/.cache/pre-commit/repommi24uuq
      Installing build dependencies: started
      Installing build dependencies: finished with status 'done'
      Getting requirements to build wheel: started
      Getting requirements to build wheel: finished with status 'done'
      Preparing metadata (pyproject.toml): started
      Preparing metadata (pyproject.toml): finished with status 'done'
    Collecting sp-repo-review==2023.08.03
      Obtaining dependency information for sp-repo-review==2023.08.03 from https://files.pythonhosted.org/packages/88/fb/65ca8b7550de38f6cde1daa3cfe57160af3fc2f807d5993acb0a23ae968b/sp_repo_review-2023.8.3-py3-none-any.whl.metadata
      Using cached sp_repo_review-2023.8.3-py3-none-any.whl.metadata (10 kB)
    Collecting pyyaml (from sp-repo-review==2023.08.03)
      Obtaining dependency information for pyyaml from https://files.pythonhosted.org/packages/28/09/55f715ddbf95a054b764b547f617e22f1d5e45d83905660e9a088078fe67/PyYAML-6.0.1-cp311-cp311-macosx_11_0_arm64.whl.metadata
      Using cached PyYAML-6.0.1-cp311-cp311-macosx_11_0_arm64.whl.metadata (2.1 kB)
    INFO: pip is looking at multiple versions of sp-repo-review to determine which version is compatible with other requirements. This could take a while.
    
    The conflict is caused by:
        The user requested repo-review 0.1.dev1+gb62cba7 (from /Users/wjamieson/.cache/pre-commit/repommi24uuq)
        sp-repo-review 2023.8.3 depends on repo-review<0.10 and >=0.7
    
    To fix this you could try to:
    1. loosen the range of package versions you've specified
    2. remove package versions to allow pip attempt to solve the dependency conflict
stderr:
    ERROR: Cannot install repo-review 0.1.dev1+gb62cba7 (from /Users/wjamieson/.cache/pre-commit/repommi24uuq) and sp-repo-review==2023.8.3 because these package versions have conflicting dependencies.
    ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
Check the log at /Users/wjamieson/.cache/pre-commit/pre-commit.log

When I examine the version of repo-review installed by pre-commit I find that its generated _version.py is:

# file generated by setuptools_scm
# don't change, don't track in version control
__version__ = version = '0.1.dev1+gb62cba7'
__version_tuple__ = version_tuple = (0, 1, 'dev1', 'gb62cba7')

which indicates to me that the dynamic versioning for repo-review is not correctly creating the version from the repo's tag.

Note that when I run sp-repo-review directly, I do get the right versions

❯ pipx run 'sp-repo-review[cli]' --version
sp-repo-review, version 0.9.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions