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

5.7.14 breaks installation of notebook extensions. #6521

Closed
GaspardBT opened this issue Aug 23, 2022 · 2 comments
Closed

5.7.14 breaks installation of notebook extensions. #6521

GaspardBT opened this issue Aug 23, 2022 · 2 comments
Labels

Comments

@GaspardBT
Copy link

Describe the bug
The version 5.7.14 for python2breaks installation of notebook extensions. Running jupyter contrib nbextension install --user fails with TypeError: '_sre.SRE_Match' object has no attribute '__getitem__'

To Reproduce
Steps to reproduce the behavior:

  1. Create a venv:
pyenv shell 2.7.18
virtualenv -p `which python` env2
source env2/bin/activate
  1. Install jupyter:
pip install jupyter
pip install jupyter-nbextensions-configurator==0.4.1
pip install jupyter_contrib_nbextensions==0.5.1
  1. Run jupyter contrib nbextension install --user

Expected behavior
Running jupyter contrib nbextension install --user should succeed.

Additional context
Reinstalling 5.7.13 (pip install notebook==5.7.13) resolve the issue. My understanding is that this commit introduce an issue. The following code

import re
__version__ = '5.7.14'
# Build up version_info tuple for backwards compatibility
pattern = r'(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)'
match = re.match(pattern, __version__)
parts = [int(match[part]) for part in ['major', 'minor', 'patch']]
if match['rest']:
    parts.append(match['rest'])
version_info = tuple(parts)

It returns TypeError: '_sre.SRE_Match' object has no attribute '__getitem__' like in the described bug. According to this this syntax was only added with python3.6.
Replacing the code by the following one works.

import re

__version__ = '5.7.14'
# Build up version_info tuple for backwards compatibility
pattern = r'(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)'
match = re.match(pattern, __version__)
parts = [int(match.group(part)) for part in ['major', 'minor', 'patch']]
if match.group('rest'):
    parts.append(match.group('rest'))
version_info = tuple(parts)
@GaspardBT GaspardBT added the bug label Aug 23, 2022
@jupyterlab-probot jupyterlab-probot bot added the status:Needs Triage Applied to issues that need triage label Aug 23, 2022
@RRosio RRosio removed the status:Needs Triage Applied to issues that need triage label Aug 24, 2022
@RRosio
Copy link
Collaborator

RRosio commented Aug 24, 2022

Hi @GaspardBT thank you for submitting this issue and sharing your findings, your suggested changes were applied in the latest release of Notebook 5!

@RRosio
Copy link
Collaborator

RRosio commented Aug 26, 2022

I'll close this issue as resolved with the merged PR #6522. Thank you!

@RRosio RRosio closed this as completed Aug 26, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants