Skip to content

Commit 5817d29

Browse files
authored
Merge pull request #931 from blink1073/use-hatch
2 parents d02f437 + 0e57c3e commit 5817d29

File tree

5 files changed

+86
-151
lines changed

5 files changed

+86
-151
lines changed

setup.cfg renamed to .flake8

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
2-
[bdist_wheel]
3-
universal=0
4-
5-
[metadata]
6-
license_file = COPYING.md
7-
version = attr: ipykernel._version.__version__
8-
91
[flake8]
102
ignore = E501, W503, E402
113
builtins = c, get_config

hatch_build.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import os
2+
import shutil
3+
import sys
4+
5+
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
6+
7+
8+
class CustomHook(BuildHookInterface):
9+
def initialize(self, version, build_data):
10+
here = os.path.abspath(os.path.dirname(__file__))
11+
sys.path.insert(0, here)
12+
from ipykernel.kernelspec import make_ipkernel_cmd, write_kernel_spec
13+
14+
# When building a standard wheel, the executable specified in the kernelspec is simply 'python'.
15+
if version == "standard":
16+
argv = make_ipkernel_cmd(executable="python")
17+
18+
# When installing an editable wheel, the full `sys.executable` can be used.
19+
else:
20+
argv = make_ipkernel_cmd()
21+
22+
dest = os.path.join(here, "data_kernelspec")
23+
if os.path.exists(dest):
24+
shutil.rmtree(dest)
25+
write_kernel_spec(dest, overrides={"argv": argv})

ipykernel/kernelspec.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
from jupyter_client.kernelspec import KernelSpecManager
1515
from traitlets import Unicode
1616

17-
from .debugger import _is_debugpy_available
17+
try:
18+
from .debugger import _is_debugpy_available
19+
except ImportError:
20+
_is_debugpy_available = False
1821

1922
pjoin = os.path.join
2023

pyproject.toml

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,60 @@
11
[build-system]
2-
build-backend = "setuptools.build_meta"
3-
requires=[
4-
"setuptools",
5-
"wheel",
6-
"debugpy",
7-
"ipython>=5",
8-
"jupyter_core>=4.2",
9-
"jupyter_client",
2+
requires = ["hatchling>=0.25", "jupyter_client>=6"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "ipykernel"
7+
version = "6.13.0"
8+
authors = [{name = "IPython Development Team", email = "[email protected]"}]
9+
license = {file = "COPYING.md"}
10+
readme = "README.md"
11+
description = "IPython Kernel for Jupyter"
12+
keywords = ["Interactive", "Interpreter", "Shell", "Web"]
13+
classifiers = [
14+
"Intended Audience :: Developers",
15+
"Intended Audience :: System Administrators",
16+
"Intended Audience :: Science/Research",
17+
"License :: OSI Approved :: BSD License",
18+
"Programming Language :: Python",
19+
"Programming Language :: Python :: 3",
20+
"Programming Language :: Python :: 3.7",
21+
"Programming Language :: Python :: 3.8",
22+
"Programming Language :: Python :: 3.9",
23+
"Programming Language :: Python :: 3.10",
24+
]
25+
urls = {Homepage = "https://ipython.org"}
26+
requires-python = ">=3.7"
27+
dependencies = [
28+
"debugpy>=1.0",
29+
"ipython>=7.23.1",
30+
"traitlets>=5.1.0",
31+
"jupyter_client>=6.1.12",
32+
"tornado>=6.1",
33+
"matplotlib-inline>=0.1",
34+
'appnope;platform_system=="Darwin"',
35+
"psutil",
36+
"nest_asyncio",
37+
"packaging",
38+
]
39+
40+
[project.optional-dependencies]
41+
test = [
42+
"pytest>=6.0",
43+
"pytest-cov",
44+
"flaky",
45+
"ipyparallel",
46+
"pre-commit",
47+
"pytest-timeout",
1048
]
1149

12-
[tool.check-manifest]
13-
ignore = []
50+
# Used to call hatch_build.py
51+
[tool.hatch.build.hooks.custom]
52+
53+
[tool.hatch.build.targets.wheel.shared-data]
54+
"data_kernelspec" = "share/jupyter/kernels/python3"
55+
56+
[tool.hatch.build]
57+
artifacts = ["ipykernel_launcher.py"]
1458

1559
[tool.jupyter-releaser]
1660
skip = ["check-links"]
@@ -29,6 +73,9 @@ tag_template = "v{new_version}"
2973
[[tool.tbump.file]]
3074
src = "ipykernel/_version.py"
3175

76+
[[tool.tbump.file]]
77+
src = "pyproject.toml"
78+
3279
[tool.mypy]
3380
check_untyped_defs = true
3481
disallow_any_generics = true

setup.py

Lines changed: 0 additions & 132 deletions
This file was deleted.

0 commit comments

Comments
 (0)