FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[MNT]: wheel of 3.5.0 appears to depend on setuptools-scm which appears to be unintentional · Issue #21783 · matplotlib/matplotlib · GitHub

Repository navigation

[MNT]: wheel of 3.5.0 appears to depend on setuptools-scm which appears to be unintentional #21783

Closed

Description

Summary

matplotlib does pull in setuptools as a runtime dependency.

if setuptools is installed it uses the pkg_resources to look for resources.

Is this on purpose? The code in the setup.py apears to me to mean that the dependency should not be a dependency for production packages, or am i wrong?

I would like to get rid of this dependency.

Proposed fix

If possible the nicest solution would be to just drop the dependency.

I am unsure if there is really a use case for setuptools_scm at runtime (as opposed to setup time).

Thansk for the great work!

Activity

  1. epeisach commented on Nov 29, 2021

    I second this. setuptools-scm being installed on your system will affect other packages being built. The check that .git directory exists to decide on the pull in as an install requirement is wrong.

    Either setup.py needs to be changed - our when building packages in your CI - you must remove the .git directory.

  2. tacaswell commented on Nov 30, 2021

    Member

    I am sold on the wheels not depending on setuptools-scm as a matter of principle, but if it being installed or not is breaking other packages for you @epeisach my knee-jerk reaction is that there are bugs in the other packages!

  3. dopplershift commented on Nov 30, 2021

    Contributor

    setuptools_scm should only ever be a dependency of building the wheels, not runtime. @tacaswell I think this is a little suspect:

    matplotlib/setup.py

    Lines 315 to 328 in d536acf

    install_requires=[
    "cycler>=0.10",
    "fonttools>=4.22.0",
    "kiwisolver>=1.0.1",
    "numpy>=1.17",
    "packaging>=20.0",
    "pillow>=6.2.0",
    "pyparsing>=2.2.1,<3.0.0",
    "python-dateutil>=2.7",
    ] + (
    # Installing from a git checkout.
    ["setuptools_scm>=4"] if Path(__file__).with_name(".git").exists()
    else []
    ),

    Do you remember why that install_requires portion was added?

  4. tacaswell commented on Nov 30, 2021

    Member

    Because we have

    if (root / ".git").exists() and not (root / ".git/shallow").exists():
    import setuptools_scm
    return setuptools_scm.get_version(
    root=root,
    version_scheme="release-branch-semver",
    local_scheme="node-and-date",
    fallback_version=_version.version,
    )
    in __init__.py to make the version auto-track in source installs (like we used to have with versioneer).

  5. dopplershift commented on Nov 30, 2021

    Contributor

    In MetPy I chose to go with:

        try:
            from setuptools_scm import get_version
            return get_version(root='../..', relative_to=__file__,
                               version_scheme='post-release')
        except (ImportError, LookupError):
            try:
                from importlib.metadata import PackageNotFoundError, version
            except ImportError:  # Can remove when we require Python > 3.7
                from importlib_metadata import PackageNotFoundError, version
    
            try:
                return version(__package__)
            except PackageNotFoundError:
                return 'Unknown'

    and avoid polluting install_requires. I've also moved as much as possible to put metadata in setup.cfg, so I don't even have the option for this IMO anti-pattern of running code to determine install_requires.

  6. added 2 commits that reference this issue on Nov 30, 2021
    efc3b69
    71ad05e
  7. QuLogic commented on Nov 30, 2021

    Member

    I suggest we do that for 3.6.0, and do the minimal patching in the above PR for 3.5.1.

  8. added this to the v3.5.1 milestone on Dec 1, 2021
  9. pcorpet commented on Oct 9, 2023

    I still have setuptools-scm as a dep of matplotlib 3.8.0 in my lock file. Can you help me debug please? I see that it's in the requires_dist on PyPi: https://pypi.org/pypi/matplotlib/3.8.0/json. Aren't you pushing the lib to PyPi as a wheel?

  10. ksunden commented on Oct 9, 2023

    Member

    @pcorpet see #26932

    TLDR is that setuptools changed their sdist metadata generation, so while the wheels don't report that dependency the sdist (and thus pypi) report it. Will be fixed for 3.8.1

  11. changed the title [-][MNT]: wheel of 3.5.0 apears to depend on setuptools-scm which apears to be unintentional[/-] [+][MNT]: wheel of 3.5.0 appears to depend on setuptools-scm which appears to be unintentional[/+] on Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL