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

BUG: 8.7.0 removes code-block:: ipython pygment lexer support #13845

Closed
larsoner opened this issue Nov 28, 2022 · 8 comments · Fixed by #13848
Closed

BUG: 8.7.0 removes code-block:: ipython pygment lexer support #13845

larsoner opened this issue Nov 28, 2022 · 8 comments · Fixed by #13848

Comments

@larsoner
Copy link

Installed via pip / PyPI -- previously this RST worked:

.. code-block:: ipython

    In [1]: %matplotlib qt

but now we get:

/home/circleci/project/doc/install/advanced.rst:33: WARNING: Pygments lexer name 'ipython' is not known

At least this is what I think is happening in our CircleCI build today (which fails because we treat warnings as errors), we haven't changed the RST lines in question at all recently:

https://app.circleci.com/pipelines/github/mne-tools/mne-python/17137/workflows/27c6f253-b7a7-4b67-9c2e-db9aa4e925fc/jobs/50745?invite=true#step-112-532

And 8.7.0 is being installed properly in the env:

https://app.circleci.com/pipelines/github/mne-tools/mne-python/17137/workflows/27c6f253-b7a7-4b67-9c2e-db9aa4e925fc/jobs/50745?invite=true#step-112-532

Changing this to .. code-block:: ipythonconsole does not seem to help.

Is this an intentional change? Or is this lexer meant to be installed a different way? I didn't see anything in these pages at least:

@jenshnielsen
Copy link
Contributor

jenshnielsen commented Nov 28, 2022

I ran into the same problem. I think this is due to the Pygments entry points not being correctly installed with 8.6.0

Compare

Python 3.10.8 | packaged by conda-forge | (main, Nov  4 2022, 13:42:51) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.6.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from importlib.metadata import entry_points

In [2]: entry_points(group="pygments.lexers")
Out[2]:
[EntryPoint(name='ipython', value='IPython.lib.lexers:IPythonLexer', group='pygments.lexers'),
 EntryPoint(name='ipython3', value='IPython.lib.lexers:IPython3Lexer', group='pygments.lexers'),
 EntryPoint(name='ipythonconsole', value='IPython.lib.lexers:IPythonConsoleLexer', group='pygments.lexers')]

to this

Python 3.10.8 | packaged by conda-forge | (main, Nov  4 2022, 13:42:51) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.7.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from importlib.metadata import entry_points

In [2]: entry_points(group="pygments.lexers")
Out[2]: []

I suspect this is related to #13842 as setuptools probably doesn't merge the entry points configured in setup.py with the ones configured in setup.cfg

@matthewfeickert
Copy link
Contributor

Agree that this seems to be a bug that snuck into v8.7.0 (it happens!), but we can easily get around this for the time being by just having

ipython!=8.7.0

in our setup.{py,cfg} files and build requirements.txts to disallow this version. As this will get fixed by the next release (I would assume) then you're basically done as you don't have to uncap later. 👍

matthewfeickert added a commit to scikit-hep/pyhf that referenced this issue Nov 29, 2022
* Disallow ipython v8.7.0 to avoid Pygments warning

> WARNING: Pygments lexer name 'ipython3' is not known

which arises during the docs build. This is a stopgap measure and this
line should be removed as soon as there is a resolution and new ipython
release.
   - c.f. ipython/ipython#13845
smithara added a commit to Swarm-DISC/SwarmPAL that referenced this issue Nov 30, 2022
smithara added a commit to Swarm-DISC/SwarmPAL that referenced this issue Nov 30, 2022
smithara added a commit to Swarm-DISC/SwarmPAL that referenced this issue Nov 30, 2022
* Update docs dependencies

* Avoid bug in ipython 8.7.0

See ipython/ipython#13845
@frenzymadness
Copy link
Contributor

I also have the same problem because the not available lexer breaks the build of TestSlide package. Unfortunately, it seems that I won't be able to update ipython in Fedora Linux to 8.7.0 because of this issue.

jenshnielsen added a commit to jenshnielsen/Qcodes that referenced this issue Nov 30, 2022
jenshnielsen added a commit to jenshnielsen/Qcodes that referenced this issue Nov 30, 2022
jenshnielsen added a commit to jenshnielsen/Qcodes that referenced this issue Nov 30, 2022
@frenzymadness
Copy link
Contributor

I want to prepare a fix for this issue. What should be the single point of truth for the entrypoints? Setup.cfg or setup.py?

@jenshnielsen
Copy link
Contributor

@frenzymadness I think it needs to be setup.py #13842 moved some of the entry points to setup.py since they are dynamically generated and that is apparently only supported in setup.py

bollwyvl added a commit to bollwyvl/ipython that referenced this issue Dec 1, 2022
bollwyvl added a commit to bollwyvl/ipython that referenced this issue Dec 1, 2022
bollwyvl added a commit to bollwyvl/ipython that referenced this issue Dec 1, 2022
bollwyvl added a commit to bollwyvl/ipython that referenced this issue Dec 1, 2022
bollwyvl added a commit to bollwyvl/ipython that referenced this issue Dec 1, 2022
bollwyvl added a commit to bollwyvl/ipython that referenced this issue Dec 1, 2022
bollwyvl added a commit to bollwyvl/ipython that referenced this issue Dec 1, 2022
@bollwyvl
Copy link
Contributor

bollwyvl commented Dec 1, 2022

ah, was behind on this discussion, this would have been a great first contribution! entry_points are dark magic indeed, and packaging bugs are never fun in general, but the fix is not that large:

#13848

hopefully that patch will be sufficient for any that would like to ship 8.7.0 with the pygments integration, if your build system allows patches.

to that end: i've applied something similar on conda-forge/ipython-feedstock#182, but also had to deal with wanting to do minimal builds, so we've also added the python-minor entry_point, e.g. ipython3.8, as a separate package, _ipython_minor_entry_point-feedstock

@matthew-brett
Copy link
Contributor

Thanks for the quick fix. Any chance of a point release with the fix?

weiji14 added a commit to weiji14/zen3geo that referenced this issue Dec 9, 2022
The latest ipython=8.7.0 version installed via readthedocs has a bug that raises `WARNING: Pygments lexer name 'ipython' is not known`. This is being tracked at ipython/ipython#13845, and will need to wait for ipython=8.7.1 or later to be released, so keep using ipython=8.6.0 for now.
weiji14 added a commit to weiji14/zen3geo that referenced this issue Dec 9, 2022
* ⬆️ Bump certifi from 2022.5.18.1 to 2022.12.7

Bumps [certifi](https://github.com/certifi/python-certifi) from 2022.5.18.1 to 2022.12.7.
- [Release notes](https://github.com/certifi/python-certifi/releases)
- [Commits](certifi/python-certifi@2022.05.18.1...2022.12.07)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* 🩹 Relock with poetry 1.2.0

Reverting the hyphen underscore package name normalization for now.

* 📌 Temporarily pin ipython!=8.7.0 to prevent warning

The latest ipython=8.7.0 version installed via readthedocs has a bug that raises `WARNING: Pygments lexer name 'ipython' is not known`. This is being tracked at ipython/ipython#13845, and will need to wait for ipython=8.7.1 or later to be released, so keep using ipython=8.6.0 for now.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
sebp added a commit to sebp/scikit-survival that referenced this issue Dec 18, 2022
sebp added a commit to sebp/scikit-survival that referenced this issue Dec 18, 2022
Carreau added a commit that referenced this issue Dec 21, 2022
@choldgraf
Copy link

♥️ for fixing this

NickleDave added a commit to vocalpy/crowsetta that referenced this issue Dec 29, 2022
tillahoffmann added a commit to tillahoffmann/gptools that referenced this issue Dec 29, 2022
NickleDave added a commit to vocalpy/crowsetta that referenced this issue Jan 1, 2023
NickleDave added a commit to vocalpy/crowsetta that referenced this issue Jan 1, 2023
rossbar added a commit to rossbar/nx-guides that referenced this issue Jan 3, 2023
MridulS pushed a commit to networkx/nx-guides that referenced this issue Jan 3, 2023
TristanFauvel pushed a commit to TristanFauvel/scikit-survival that referenced this issue Jan 4, 2023
TristanFauvel pushed a commit to TristanFauvel/scikit-survival that referenced this issue Jan 4, 2023
NickleDave added a commit to vocalpy/crowsetta that referenced this issue Jan 28, 2023
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.

7 participants