Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install Matplotlib as optional extra? #100

Closed
hugovk opened this issue Feb 9, 2023 · 7 comments · Fixed by #104
Closed

Install Matplotlib as optional extra? #100

hugovk opened this issue Feb 9, 2023 · 7 comments · Fixed by #104

Comments

@hugovk
Copy link
Contributor

hugovk commented Feb 9, 2023

Thank you for the social card previews (#88), they look really good!

(I would like to generate them for the CPython docs (https://docs.python.org/), but need to check some things first, e.g. how it works with translations, how to omit them from archives/non-web builds, check our deploy process works with ~500 images and 41 MB.)

We're already using this extension for OG metadata and it's working well.

Unfortunately, the new Matplotlib dependency broke our CI yesterday because we run doctests against the CPython 3.12 development branch, and unsurprisingly the NumPy dependency isn't yet compatible (for example: numpy.txt, which begins with RuntimeWarning: NumPy 1.24.2 may not yet support Python 3.12).

So in the meantime we have to pin to the earlier 0.7.5 release (python/cpython#101642).

Would it be possible to have Matplotlib installable as an optional extra? Even when using Python < 3.12, it's a pretty heavy dependency to install if you don't need it.

Docs:

Thanks again!

@Daltz333
Copy link
Member

Daltz333 commented Feb 9, 2023

Yeah, this is something we want moving forward. I can't promise a timeline currently, but @TheTripleV was investigating this.

@tony
Copy link
Contributor

tony commented Feb 11, 2023

@wpilibsuite Can you make socialcards / matplotlib optional? I'm getting bit by this. That's a super big dependency and likely going to break most users.

  • My projects support python 3.7 (EOL support ends in 4 months and 2 weeks 27 Jun 2023)
  • Due to this, numpy 1.21.1 is being forced when poetry locks poetry.lock
Error example
  ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects


  at ~/.config/asdf/installs/poetry/1.3.2/venv/lib/python3.11/site-packages/poetry/utils/env.py:1540 in _run
      1536│                 output = subprocess.check_output(
      1537│                     command, stderr=subprocess.STDOUT, env=env, **kwargs
      1538│                 )
      1539│         except CalledProcessError as e:
    → 1540│             raise EnvCommandError(e, input=input_)
      1541│
      1542│         return decode(output)
      1543│
      1544│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

The following error occurred when trying to handle this error:


  PoetryException

  Failed to install ~/.cache/pypoetry/artifacts/f2/a4/4e/0208c493a2cf7704b33cc89eb971c275ad3cf9b8775a450427bd139f71/numpy-1.21.1.zip

  at ~/.config/asdf/installs/poetry/1.3.2/venv/lib/python3.11/site-packages/poetry/utils/pip.py:58 in pip_install
       54│
       55│     try:
       56│         return environment.run_pip(*args)
       57│     except EnvCommandError as e:
    →  58│         raise PoetryException(f"Failed to install {path.as_posix()}") from e
       59│

@tony
Copy link
Contributor

tony commented Feb 11, 2023

In poetry my workaround for now is this:

sphinxext-opengraph = "<0.8"  # https://github.com/wpilibsuite/sphinxext-opengraph/issues/100

Then poetry update

@Daltz333
Copy link
Member

Note, I'm totally open to an external contributor PRing this.

@tony
Copy link
Contributor

tony commented Jun 24, 2023

Hi, thank you for the project @Daltz333 and for the excellent addition as well @choldgraf!

I use sphinxext-opengraph for opengraph tags and that's about it. Cards are a plus - but the current way of doing this needs to be done in a way that doesn't force matplotlib, which although a superb project - it's many times bigger than sphinx itself 😆.

@choldgraf, I suppose this is mostly for you:

  1. Is it possible to make an adjustment to the social cards so they:

    a. Make social cards explictly required and have matplotlib as an optional dependency?
    b. Removes the matplotlib dependency for something lighter (and hopefully still optional)?
    c. Forks the existing social cards into a separate package thats interoperable with sphinxext-opengraph?

  2. Temporarily retract ENH: Add social card previews #88 in anticipation of it being re-PR'd, with any of the above options?

Sorry for the inconvenience - also let me know if I can clarify anything above.

@choldgraf
Copy link
Contributor

choldgraf commented Jun 24, 2023

Hey all - I'm happy with whatever y'all wanna do on the project, but I don't have time to do any of this work. Sorry about that 😞

@TheTripleV
Copy link
Member

I have a PR open to make matplotlib opt in. I'll get it merged and released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants