Skip to content

Commit

Permalink
Fix kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
evhub committed Apr 30, 2023
1 parent 71bcdf7 commit 23d4959
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 13 deletions.
23 changes: 16 additions & 7 deletions coconut/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,6 @@ def get_bool_env_var(env_var, default=False):
"pyparsing",
),
"non-py26": (
"pygments",
"psutil",
),
"py2": (
Expand All @@ -823,6 +822,12 @@ def get_bool_env_var(env_var, default=False):
"py26": (
"argparse",
),
"py<39": (
("pygments", "mark<39"),
),
"py39": (
("pygments", "mark39"),
),
"kernel": (
("ipython", "py2"),
("ipython", "py3;py<38"),
Expand Down Expand Up @@ -875,7 +880,8 @@ def get_bool_env_var(env_var, default=False):
),
"docs": (
"sphinx",
"pygments",
("pygments", "mark<39"),
("pygments", "mark39"),
"myst-parser",
"pydata-sphinx-theme",
),
Expand All @@ -890,7 +896,7 @@ def get_bool_env_var(env_var, default=False):

# min versions are inclusive
min_versions = {
"cPyparsing": (2, 4, 7, 1, 2, 0),
"cPyparsing": (2, 4, 7, 1, 2, 1),
("pre-commit", "py3"): (3,),
"psutil": (5,),
"jupyter": (1, 0),
Expand All @@ -907,17 +913,19 @@ def get_bool_env_var(env_var, default=False):
("aenum", "py<34"): (3,),
"pydata-sphinx-theme": (0, 13),
"myst-parser": (1,),
"sphinx": (7,),
"mypy[python2]": (1, 2),
("jupyter-console", "py37"): (6,),
("typing", "py<35"): (3, 10),
("typing_extensions", "py37"): (4, 5),
("ipython", "py38"): (8,),
("ipykernel", "py38"): (6,),
("jedi", "py39"): (0, 18),
("pygments", "mark39"): (2, 15),

# pinned reqs: (must be added to pinned_reqs below)

# don't upgrade until myst-parser supports the new version
"sphinx": (6,),
# don't upgrade this; it breaks on Python 3.6
("pandas", "py36"): (1,),
("jupyter-client", "py36"): (7, 1, 2),
Expand All @@ -938,7 +946,7 @@ def get_bool_env_var(env_var, default=False):
# don't upgrade this; it breaks on unix
"vprof": (0, 36),
# don't upgrade this; it breaks on Python 3.4
"pygments": (2, 3),
("pygments", "mark<39"): (2, 3),
# don't upgrade these; they break on Python 2
("jupyter-client", "py<35"): (5, 3),
("pywinpty", "py2;windows"): (0, 5),
Expand All @@ -956,6 +964,7 @@ def get_bool_env_var(env_var, default=False):

# should match the reqs with comments above
pinned_reqs = (
"sphinx",
("pandas", "py36"),
("jupyter-client", "py36"),
("typing_extensions", "py==36"),
Expand All @@ -971,7 +980,7 @@ def get_bool_env_var(env_var, default=False):
("prompt_toolkit", "mark3"),
"pytest",
"vprof",
"pygments",
("pygments", "mark<39"),
("pywinpty", "py2;windows"),
("jupyter-console", "py<35"),
("ipython", "py2"),
Expand All @@ -994,7 +1003,7 @@ def get_bool_env_var(env_var, default=False):
("prompt_toolkit", "mark2"): _,
("jedi", "py<39"): _,
("pywinpty", "py2;windows"): _,
("ipython", "py3;py<39"): _,
("ipython", "py3;py<38"): _,
}

classifiers = (
Expand Down
6 changes: 3 additions & 3 deletions coconut/icoconut/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def run_cell(self, raw_cell, store_history=False, silent=False, shell_futures=Tr
if asyncio is not None:
@override
{async_}def run_cell_async(self, raw_cell, store_history=False, silent=False, shell_futures=True, cell_id=None, **kwargs):
{coroutine}def run_cell_async(self, raw_cell, store_history=False, silent=False, shell_futures=True, cell_id=None, **kwargs):
"""Version of run_cell_async that always uses shell_futures."""
# same as above
return super({cls}, self).run_cell_async(raw_cell, store_history, silent, shell_futures=True, **kwargs)
Expand All @@ -233,8 +233,8 @@ def user_expressions(self, expressions):

format_dict = dict(
dict="{}",
async_=(
"async " if PY311 else
coroutine=(
"" if PY311 else
"""@asyncio.coroutine
"""
),
Expand Down
7 changes: 7 additions & 0 deletions coconut/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from coconut.constants import (
CPYTHON,
PY34,
PY39,
IPY,
MYPY,
XONSH,
Expand Down Expand Up @@ -237,6 +238,8 @@ def everything_in(req_dict):
extras[":python_version>='2.7'"] = get_reqs("non-py26")
extras[":python_version<'3'"] = get_reqs("py2")
extras[":python_version>='3'"] = get_reqs("py3")
extras[":python_version<'3.9'"] = get_reqs("py<39")
extras[":python_version>='3.9'"] = get_reqs("py39")
else:
# old method
if PY26:
Expand All @@ -247,6 +250,10 @@ def everything_in(req_dict):
requirements += get_reqs("py2")
else:
requirements += get_reqs("py3")
if PY39:
requirements += get_reqs("py39")
else:
requirements += get_reqs("py<39")

# -----------------------------------------------------------------------------------------------------------------------
# MAIN:
Expand Down
2 changes: 1 addition & 1 deletion coconut/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
VERSION = "3.0.0"
VERSION_NAME = None
# False for release, int >= 1 for develop
DEVELOP = 38
DEVELOP = 39
ALPHA = True # for pre releases rather than post releases

# -----------------------------------------------------------------------------------------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions coconut/tests/src/extras.coco
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ from coconut.constants import (
PY34,
PY35,
PY36,
WINDOWS,
PYPY,
) # type: ignore
from coconut._pyparsing import USE_COMPUTATION_GRAPH # type: ignore
Expand All @@ -26,7 +25,7 @@ from coconut.convenience import (
coconut_eval,
)

if IPY and not WINDOWS:
if IPY:
if PY35:
import asyncio
from coconut.icoconut import CoconutKernel # type: ignore
Expand Down

0 comments on commit 23d4959

Please sign in to comment.