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

add support for 3.11 #1373

Merged
merged 7 commits into from
Oct 19, 2023
Merged

add support for 3.11 #1373

merged 7 commits into from
Oct 19, 2023

Conversation

deven367
Copy link
Contributor

hello, I'm trying to add support for py3.11 for nbdev, I'm trying some stuff on my fork. The PR will also eventually close #1372.

I had a question for @jph00, there's only one test case which fails for 3.11 which is in showdoc. This has only come into existence because the docstring for the Enum was changed in 3.11. How should I try to handle the test case in such a situation? The test case is listed below,

AssertionError                            Traceback (most recent call last)
Cell In[1], line 2
      1 e = enum.Enum('e', 'a b')
----> 2 test_eq(str(show_doc(e)), '---\n\n### e\n\n>      e (value, names=None, module=None, qualname=None, type=None, start=1)\n\nAn enumeration.')

File ~/mambaforge/envs/fun/lib/python3.11/site-packages/fastcore/test.py:37, in test_eq(a, b)
     35 def test_eq(a,b):
     36     "`test` that `a==b`"
---> 37     test(a,b,equals, cname='==')

File ~/mambaforge/envs/fun/lib/python3.11/site-packages/fastcore/test.py:27, in test(a, b, cmp, cname)
     25 "`assert` that `cmp(a,b)`; display inputs and `cname or cmp.__name__` if it fails"
     26 if cname is None: cname=cmp.__name__
---> 27 assert cmp(a,b),f"{cname}:\n{a}\n{b}"

AssertionError: ==:
---

### e

>      e (value, names=None, module=None, qualname=None, type=None, start=1,
>         boundary=None)

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

- attribute access::

>>> Color.RED
<Color.RED: 1>

- value lookup:

>>> Color(1)
<Color.RED: 1>

- name lookup:

>>> Color['RED']
<Color.RED: 1>

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3

>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own
attributes -- see the documentation for details.
---

### e

>      e (value, names=None, module=None, qualname=None, type=None, start=1)

An enumeration.

@jph00
Copy link
Contributor

jph00 commented Oct 19, 2023 via email

@deven367
Copy link
Contributor Author

I think even that won't be possible. They've changed the entire docstring and they've even added a new arg (boundary=None) to the Enum class.

# new in 3.11
e (value, names=None, module=None, qualname=None, type=None, start=1, boundary=None)
Create a collection of name/value pairs.

# in previous versions
e (value, names=None, module=None, qualname=None, type=None, start=1)
An enumeration.

@jph00
Copy link
Contributor

jph00 commented Oct 19, 2023 via email

@deven367
Copy link
Contributor Author

Will do!

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@deven367
Copy link
Contributor Author

@jph00 It's ready for review.

@deven367 deven367 marked this pull request as ready for review October 19, 2023 03:07
@jph00
Copy link
Contributor

jph00 commented Oct 19, 2023

Thank you!

@jph00 jph00 merged commit 770ce70 into AnswerDotAI:master Oct 19, 2023
10 checks passed
@jph00 jph00 added the enhancement New feature or request label Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

In settings.ini min_python = 3.11 causes problem with pip install -e '.[dev]'
2 participants